Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2001-09-18 17:11:33 +0000
committerDarin Wright2001-09-18 17:11:33 +0000
commit58014b7f85dc7041cfe0ae23f7ece52e509a932b (patch)
tree410ad63816e11505418f9bee29d17accc8f28ed0
parent5712234a3dff4eb86485017879d9284decfcb8b6 (diff)
downloadeclipse.platform.debug-58014b7f85dc7041cfe0ae23f7ece52e509a932b.tar.gz
eclipse.platform.debug-58014b7f85dc7041cfe0ae23f7ece52e509a932b.tar.xz
eclipse.platform.debug-58014b7f85dc7041cfe0ae23f7ece52e509a932b.zip
1GHP2H1: ITPDUI:ALL - API Change: Icons for launchers
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java41
1 files changed, 37 insertions, 4 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java
index b29c53ce6..3000646cd 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java
@@ -5,6 +5,8 @@ package org.eclipse.debug.internal.ui;
* All Rights Reserved.
*/
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
@@ -122,11 +124,18 @@ public class DelegatingModelPresentation implements IDebugModelPresentation {
}
} else
if (item instanceof ILaunch) {
- String mode= ((ILaunch) item).getLaunchMode();
- if (mode.equals(ILaunchManager.DEBUG_MODE)) {
- return iRegistry.get(IDebugUIConstants.IMG_ACT_DEBUG);
+ ILaunch launch = (ILaunch) item;
+ Image image = getLaunchImage(launch);
+ if (image == null) {
+ // return default image
+ String mode= launch.getLaunchMode();
+ if (mode.equals(ILaunchManager.DEBUG_MODE)) {
+ return iRegistry.get(IDebugUIConstants.IMG_ACT_DEBUG);
+ } else {
+ return iRegistry.get(IDebugUIConstants.IMG_ACT_RUN);
+ }
} else {
- return iRegistry.get(IDebugUIConstants.IMG_ACT_RUN);
+ return image;
}
} else
if (item instanceof InspectItem) {
@@ -147,6 +156,30 @@ public class DelegatingModelPresentation implements IDebugModelPresentation {
}
}
+ protected Image getLaunchImage(ILaunch launch) {
+ ILauncher launcher = launch.getLauncher();
+ String iconPath = launcher.getIconPath();
+ if (iconPath != null) {
+ // return custom image
+ ImageRegistry registry = DebugPluginImages.getImageRegistry();
+ Image image = registry.get(launcher.getIdentifier());
+ if (image == null) {
+ URL iconURL = launcher.getConfigurationElement().getDeclaringExtension().getDeclaringPluginDescriptor().getInstallURL();
+ ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
+ try {
+ iconURL = new URL(iconURL, iconPath);
+ desc= ImageDescriptor.createFromURL(iconURL);
+ } catch (MalformedURLException e) {
+ }
+ DebugPluginImages.getImageRegistry().put(launcher.getIdentifier(), desc);
+ return registry.get(launcher.getIdentifier());
+ } else {
+ return image;
+ }
+ }
+ return null;
+ }
+
/**
* @see IDebugModelPresentation
*/

Back to the top