Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/queries/GetImageQuery.java')
-rw-r--r--plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/queries/GetImageQuery.java41
1 files changed, 3 insertions, 38 deletions
diff --git a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/queries/GetImageQuery.java b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/queries/GetImageQuery.java
index ee4b55eec6d..afafb78478c 100644
--- a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/queries/GetImageQuery.java
+++ b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/queries/GetImageQuery.java
@@ -12,58 +12,23 @@
/*****************************************************************************/
package org.eclipse.papyrus.uml.modelexplorer.queries;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.papyrus.emf.facet.custom.metamodel.custompt.IImage;
import org.eclipse.papyrus.emf.facet.custom.ui.ImageUtils;
-import org.eclipse.papyrus.emf.facet.custom.ui.internal.query.ImageQuery;
import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager;
import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException;
-import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue;
import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2;
import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2;
-import org.eclipse.papyrus.uml.tools.utils.ElementUtil;
+import org.eclipse.papyrus.uml.tools.providers.UMLLabelProvider;
import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Stereotype;
/** Create a basic label based on element name */
public class GetImageQuery implements IJavaQuery2<Element, IImage> {
// public static final String sysml_plugin_path = "platform:/plugin/org.eclipse.papyrus.sysml/";
-
+ private static UMLLabelProvider umlLabelProvider = new UMLLabelProvider();
// @Override
public IImage evaluate(Element source, IParameterValueList2 parameterValues, IFacetManager facetManager) throws DerivedTypedElementException {
- ParameterValue parameterValue = parameterValues.getParameterValueByName("eObject");
- if (parameterValue.getValue() instanceof EStructuralFeature) {
- return ImageQuery.getEObjectImage((EStructuralFeature) parameterValue.getValue());
- }
-
- String iconPath = "";
- if (!source.getAppliedStereotypes().isEmpty()) {
- Stereotype first_stereotype = source.getAppliedStereotypes().get(0);
-
- if (!first_stereotype.getIcons().isEmpty()) {
- org.eclipse.uml2.uml.Image icon = ElementUtil.getStereotypeImage(source, first_stereotype, "icon");
- if (icon != null) {
- iconPath = icon.getLocation();
- }
- }
- }
-
- String imagePath = "";
-
- if (iconPath != null && !"".equals(iconPath)) {
- URI iconURI = URI.createURI(iconPath);
- // if(iconURI.isRelative()) {
- // imagePath = sysml_plugin_path + iconPath;
- // } else {
- imagePath = iconURI.toString();
- // }
- }
- if ("".equals(imagePath)) {
- return ImageQuery.getEObjectImage(source);
- }
- return ImageUtils.wrap(imagePath);
+ return ImageUtils.wrap(umlLabelProvider.getImage(source));
}
}

Back to the top