/******************************************************************************* | |
* <copyright> | |
* | |
* Copyright (c) 2013, 2013 SAP AG. | |
* All rights reserved. This program and the accompanying materials | |
* are made available under the terms of the Eclipse Public License v1.0 | |
* which accompanies this distribution, and is available at | |
* http://www.eclipse.org/legal/epl-v10.html | |
* | |
* Contributors: | |
* SAP AG - initial API, implementation and documentation | |
* | |
* </copyright> | |
* | |
*******************************************************************************/ | |
package org.eclipse.fmc.blockdiagram.editor.meta.property; | |
import org.eclipse.core.runtime.CoreException; | |
import org.eclipse.core.runtime.IConfigurationElement; | |
import org.eclipse.core.runtime.IExtensionRegistry; | |
import org.eclipse.core.runtime.Platform; | |
import org.eclipse.fmc.blockdiagram.editor.meta.profile.ISectionProvider; | |
import org.eclipse.graphiti.mm.pictograms.PictogramElement; | |
import org.eclipse.graphiti.ui.platform.AbstractPropertySectionFilter; | |
/** | |
* Extends the AbstractPropertySectionFilter Class for Stereotype Extension | |
* specific subjects. | |
* | |
* @author Patrick Jahnke | |
* | |
*/ | |
public class ProfileFilter extends AbstractPropertySectionFilter { | |
/** | |
* Check if the given PictogramElement has the possibility to add Stereotype | |
* Values. This will be checked in the Stereotype Extension. | |
*/ | |
@Override | |
protected boolean accept(PictogramElement pictogramElement) { | |
IExtensionRegistry reg = Platform.getExtensionRegistry(); | |
IConfigurationElement[] extensions = reg | |
.getConfigurationElementsFor("org.eclipse.fmc.blockdiagram.editor.meta.profile"); | |
if (extensions.length == 1) { | |
ISectionProvider entry; | |
try { | |
entry = (ISectionProvider) extensions[0] | |
.createExecutableExtension("profileSection"); | |
return entry.accept(pictogramElement); | |
} catch (CoreException e) { | |
e.printStackTrace(); | |
} | |
} | |
return false; | |
} | |
} |