rcp: Fix icons for project explorer on Eclipse 4.6M5
authorBernd Hufmann <Bernd.Hufmann@ericsson.com>
Sat, 30 Jan 2016 02:10:59 +0000 (21:10 -0500)
committerBernd Hufmann <bernd.hufmann@ericsson.com>
Sat, 30 Jan 2016 13:29:04 +0000 (08:29 -0500)
All the platform icons where changed to png file types and file
extension. Since in the RCP we need to register these images for
the RCP product and there are no constants available we need to check
for gif and png file extension to support Eclipse 4.5 and 4.6.

Change-Id: I2d751df1177adc991e300ec9e12a19922c163fe9
Signed-off-by: Bernd Hufmann <Bernd.Hufmann@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/65505
Reviewed-by: Hudson CI
Reviewed-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Tested-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
rcp/org.eclipse.tracecompass.rcp.ui/src/org/eclipse/tracecompass/internal/tracing/rcp/ui/ApplicationWorkbenchAdvisor.java

index f10785b1954e7e448791a8d7dabb187cdddab05f..56b86965d572f1ccf46f0b3331a1672db4fd3ba8 100644 (file)
@@ -19,6 +19,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.MultiStatus;
@@ -60,8 +61,9 @@ public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
     private static final String PATH_ETOOL = ICONS_PATH + "etool16/"; //$NON-NLS-1$
     private static final String PATH_DTOOL = ICONS_PATH + "dtool16/"; //$NON-NLS-1$
     private static final String PATH_OBJECT = ICONS_PATH + "obj16/"; //$NON-NLS-1$
-    private static final String PATH_WIZBAN = ICONS_PATH + "wizban/";//$NON-NLS-1$
+    private static final String PATH_WIZBAN = ICONS_PATH + "wizban/"; //$NON-NLS-1$
 
+    private static final String IMAGE_FILE_EXT = "png"; //$NON-NLS-1$
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
@@ -233,6 +235,15 @@ public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
      */
     private void declareWorkbenchImage(Bundle ideBundle, String symbolicName, String path, boolean shared) {
         URL url = FileLocator.find(ideBundle, new Path(path), null);
+        /*
+         *  Files where changed to *.png in Eclipse 4.6. The following will make sure that it
+         *  also works with Eclipse 4.6.
+         */
+        if (url == null) {
+            IPath newName = new Path(path);
+            newName = newName.removeFileExtension().addFileExtension(IMAGE_FILE_EXT);
+            url = FileLocator.find(ideBundle, newName, null);
+        }
         ImageDescriptor desc = ImageDescriptor.createFromURL(url);
         getWorkbenchConfigurer().declareImage(symbolicName, desc, shared);
     }
This page took 0.03104 seconds and 5 git commands to generate.