Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 39f5d75a04d1b957f8852cd0d6dea5b1c25bddff (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package org.eclipse.papyrus.customization.paletteconfiguration.queries;

import org.eclipse.emf.facet.efacet.core.IFacetManager;
import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
import org.eclipse.emf.facet.query.java.core.IJavaQuery2;
import org.eclipse.emf.facet.query.java.core.IParameterValueList2;
import org.eclipse.papyrus.uml.diagram.paletteconfiguration.Configuration;
import org.eclipse.papyrus.uml.diagram.paletteconfiguration.IconDescriptor;

/** Gets the icon for a configuration element in the palette configuration model */
public class GetIconQuery implements IJavaQuery2<Configuration, String> {


	public String evaluate(Configuration source, IParameterValueList2 parameterValues, IFacetManager facetManager) throws DerivedTypedElementException {
		// retrieves icon descriptor
		IconDescriptor descriptor = source.getIcon();
		if(descriptor == null) {
			return "";
		}

		String bundleID = descriptor.getPluginID();
		String iconPath = descriptor.getIconPath();

		if(bundleID == null || iconPath == null) {
			return "";
		}

		return "/" + bundleID + iconPath;
	}

}

Back to the top