01: package net.refractions.udig.style;
02:
03: import java.util.HashSet;
04: import java.util.Set;
05:
06: import net.refractions.udig.core.internal.ExtensionPointProcessor;
07: import net.refractions.udig.core.internal.ExtensionPointUtil;
08: import net.refractions.udig.project.internal.Layer;
09:
10: import org.eclipse.core.runtime.IConfigurationElement;
11: import org.eclipse.core.runtime.IExtension;
12:
13: public class Styles {
14: /**
15: *
16: * Returns the set of style id's which support a particular layer.
17: *
18: * @return A set of id's.
19: */
20: public static Set<String> getStyleIDs(final Layer layer) {
21: final Set<String> ids = new HashSet<String>();
22: ExtensionPointProcessor p = new ExtensionPointProcessor() {
23: public void process(IExtension extension,
24: IConfigurationElement element) throws Exception {
25: IStyleConfigurator sce = (IStyleConfigurator) element
26: .createExecutableExtension("class"); //$NON-NLS-1$
27: if (sce.canStyle(layer)) {
28: ids.add(sce.getStyleId());
29: }
30: }
31: };
32: ExtensionPointUtil.process(StylePlugin.getDefault(),
33: IStyleConfigurator.XPID, p);
34: return ids;
35: }
36: }
|