| author | Mohamed Hussein | 2012-06-18 16:49:07 (EDT) |
|---|---|---|
| committer | Mike Rennie | 2012-06-19 11:10:19 (EDT) |
| commit | 8e246fd6bc086525333fe984b2d2ef5fee616b90 (patch) (side-by-side diff) | |
| tree | 783d647a295ae815cd9420be0462a5455592a7f9 | |
| parent | 47b47e012a23dac84ef19ec0d295776aa2702479 (diff) | |
| download | eclipse.platform.debug-8e246fd6bc086525333fe984b2d2ef5fee616b90.zip eclipse.platform.debug-8e246fd6bc086525333fe984b2d2ef5fee616b90.tar.gz eclipse.platform.debug-8e246fd6bc086525333fe984b2d2ef5fee616b90.tar.bz2 | |
Bug 381175 - [patch] launchConfigurationTypeImage to support platform:
style icons
| -rw-r--r-- | org.eclipse.debug.tests/build.properties | 4 | ||||
| -rw-r--r-- | org.eclipse.debug.tests/icons/image1.gif | bin | 0 -> 355 bytes | |||
| -rw-r--r-- | org.eclipse.debug.tests/icons/image2.gif | bin | 0 -> 157 bytes | |||
| -rw-r--r-- | org.eclipse.debug.tests/plugin.xml | 13 | ||||
| -rw-r--r-- | org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java | 26 | ||||
| -rw-r--r-- | org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java | 10 |
6 files changed, 50 insertions, 3 deletions
diff --git a/org.eclipse.debug.tests/build.properties b/org.eclipse.debug.tests/build.properties index 6b24bcb..5ffcfa8 100644 --- a/org.eclipse.debug.tests/build.properties +++ b/org.eclipse.debug.tests/build.properties @@ -16,4 +16,6 @@ bin.includes = META-INF/,\ about.html,\ plugin.properties,\ plugin.xml,\ - test-import/ + test-import/,\ + icons/ +src.includes = icons/ diff --git a/org.eclipse.debug.tests/icons/image1.gif b/org.eclipse.debug.tests/icons/image1.gif Binary files differnew file mode 100644 index 0000000..87e57e3 --- a/dev/null +++ b/org.eclipse.debug.tests/icons/image1.gif diff --git a/org.eclipse.debug.tests/icons/image2.gif b/org.eclipse.debug.tests/icons/image2.gif Binary files differnew file mode 100644 index 0000000..dc923f5 --- a/dev/null +++ b/org.eclipse.debug.tests/icons/image2.gif diff --git a/org.eclipse.debug.tests/plugin.xml b/org.eclipse.debug.tests/plugin.xml index 477f5e0..62504e8 100644 --- a/org.eclipse.debug.tests/plugin.xml +++ b/org.eclipse.debug.tests/plugin.xml @@ -82,5 +82,18 @@ id="org.eclipse.debug.tests.statusHandler" plugin="org.eclipse.debug.tests"> </statusHandler> + </extension> + <extension + point="org.eclipse.debug.ui.launchConfigurationTypeImages"> + <launchConfigurationTypeImage + configTypeID="org.eclipse.debug.tests.launch.type1" + icon="platform:/plugin/org.eclipse.debug.tests/icons/image1.gif" + id="type.image.1"> + </launchConfigurationTypeImage> + <launchConfigurationTypeImage + configTypeID="org.eclipse.debug.tests.launch.type" + icon="icons/image2.gif" + id="type.image.2"> + </launchConfigurationTypeImage> </extension> </plugin> diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java index 5b669e4..02c6da2 100644 --- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java +++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java @@ -51,6 +51,8 @@ import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.internal.core.LaunchManager; import org.eclipse.debug.tests.TestsPlugin; +import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; @@ -1376,6 +1378,26 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau assertTrue("Renamed and moved config should exist", next.exists()); } + + /** + * Test support for a URL in the 'icon' part of the launchConfigurationTypeImages extension point + * + * Bug 381175 - [patch] launchConfigurationTypeImage to support platform: style icons + * @throws Exception + */ + public void testGetTypeImageFromURI() throws Exception { + ImageDescriptor descriptor = DebugUITools.getImageDescriptor("org.eclipse.debug.tests.launch.type1"); + assertNotNull("The image descriptior type.image.1 must exist", descriptor); + assertNotSame("The image descriptor is not type.image.1", ImageDescriptor.getMissingImageDescriptor(), descriptor); + } + + /** + * Test support for a declared launch configuration type image + * @throws Exception + */ + public void testGetTyeImage() throws Exception { + ImageDescriptor descriptor = DebugUITools.getImageDescriptor("org.eclipse.debug.tests.launch.type"); + assertNotNull("The image descriptior type.image.2 must exist", descriptor); + assertNotSame("The image descriptor is not type.image.2", ImageDescriptor.getMissingImageDescriptor(), descriptor); + } } - - diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java index 4e6a8d0..d63d904 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java @@ -14,6 +14,7 @@ package org.eclipse.debug.internal.ui; import java.lang.reflect.InvocationTargetException; +import java.net.MalformedURLException; import java.net.URL; import java.util.HashSet; import java.util.Hashtable; @@ -1376,6 +1377,15 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener, URL iconURL = FileLocator.find(bundle , new Path(iconPath), null); if (iconURL != null) { return ImageDescriptor.createFromURL(iconURL); + } else { // try to search as a URL in case it is absolute path + try { + iconURL = FileLocator.find(new URL(iconPath)); + if (iconURL != null) { + return ImageDescriptor.createFromURL(iconURL); + } + } catch (MalformedURLException e) { + // return null + } } } return null; |

