1 | package de.uka.ipd.sdq.featureinstance; |
2 | |
3 | import java.net.MalformedURLException; |
4 | import java.net.URL; |
5 | |
6 | import org.eclipse.core.resources.IWorkspace; |
7 | import org.eclipse.core.resources.ResourcesPlugin; |
8 | import org.eclipse.core.runtime.Platform; |
9 | import org.eclipse.jface.resource.ImageDescriptor; |
10 | import org.eclipse.ui.plugin.AbstractUIPlugin; |
11 | |
12 | public class FeatureModelInstancePlugin extends AbstractUIPlugin { |
13 | //The shared instance. |
14 | private static FeatureModelInstancePlugin plugin; |
15 | |
16 | /** |
17 | * The constructor. |
18 | */ |
19 | public FeatureModelInstancePlugin() { |
20 | super(); |
21 | plugin = this; |
22 | } |
23 | |
24 | /*/** |
25 | * Returns the shared instance. |
26 | |
27 | public static FeatureModelInstancePlugin getDefault() { |
28 | return plugin; |
29 | }*/ |
30 | |
31 | /** |
32 | * Returns the workspace instance. |
33 | */ |
34 | public static IWorkspace getWorkspace() { |
35 | return ResourcesPlugin.getWorkspace(); |
36 | } |
37 | |
38 | public static ImageDescriptor getImageDescriptor(String name) { |
39 | String iconPath = "icons/"; |
40 | try { |
41 | URL installURL = Platform.getBundle("de.uka.ipd.sdq.featureinstance.editor").getEntry("/"); |
42 | URL url = new URL(installURL, iconPath + name); |
43 | return ImageDescriptor.createFromURL(url); |
44 | } catch (MalformedURLException e) { |
45 | return ImageDescriptor.getMissingImageDescriptor(); |
46 | } |
47 | } |
48 | } |