|
23 | 23 |
|
24 | 24 | import static de.ovgu.featureide.fm.core.localization.StringTable.SELECT_THE_FEATURE_MODEL_FOR_THE_CURRENT_PROJECT; |
25 | 25 |
|
| 26 | +import java.net.URL; |
26 | 27 | import java.util.Arrays; |
27 | 28 | import java.util.Optional; |
28 | 29 |
|
|
31 | 32 | import org.eclipse.core.resources.IResource; |
32 | 33 | import org.eclipse.core.resources.IResourceChangeListener; |
33 | 34 | import org.eclipse.core.resources.ResourcesPlugin; |
| 35 | +import org.eclipse.core.runtime.FileLocator; |
34 | 36 | import org.eclipse.core.runtime.IStatus; |
| 37 | +import org.eclipse.core.runtime.Path; |
| 38 | +import org.eclipse.core.runtime.Platform; |
35 | 39 | import org.eclipse.core.runtime.Status; |
36 | 40 | import org.eclipse.jface.resource.ImageDescriptor; |
37 | 41 | import org.eclipse.swt.graphics.Image; |
@@ -87,12 +91,11 @@ public static FMUIPlugin getDefault() { |
87 | 91 | } |
88 | 92 |
|
89 | 93 | public static Image getImage(String name) { |
90 | | - final ImageDescriptor descriptor = getDefault().getImageDescriptor("icons/" + name); |
91 | | - if (descriptor != null) { |
92 | | - return descriptor.createImage(); |
| 94 | + final URL url = FileLocator.find(Platform.getBundle(PLUGIN_ID), new Path("icons/" + name), null); |
| 95 | + if (url != null) { |
| 96 | + return ImageDescriptor.createFromURL(url).createImage(); |
93 | 97 | } else { |
94 | | - final IStatus status = new Status(IStatus.WARNING, PLUGIN_ID, "[FeatureIDE] Image not found: icons/" + name); |
95 | | - getDefault().getLog().log(status); |
| 98 | + getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, "Image not found: " + name)); |
96 | 99 | return null; |
97 | 100 | } |
98 | 101 | } |
|
0 commit comments