Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2001-09-20 18:03:10 +0000
committerDarin Wright2001-09-20 18:03:10 +0000
commit3013c7840dea20f6a6531c0d9a7a99bcba29197b (patch)
tree8ee8dc09b3ebb17d969d231c9598b850ee5b383f /org.eclipse.debug.ui
parent2790c0a41d4d5102db9eb9714960039d20f85bc1 (diff)
downloadeclipse.platform.debug-3013c7840dea20f6a6531c0d9a7a99bcba29197b.tar.gz
eclipse.platform.debug-3013c7840dea20f6a6531c0d9a7a99bcba29197b.tar.xz
eclipse.platform.debug-3013c7840dea20f6a6531c0d9a7a99bcba29197b.zip
1GG8JIO: ITPDUI:WIN2000 - FEATURE - Support icons for launchers
Diffstat (limited to 'org.eclipse.debug.ui')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java27
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java21
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchSelectionAction.java15
3 files changed, 35 insertions, 28 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java
index 69e2653f0..eb0e58d7b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java
@@ -5,13 +5,16 @@ package org.eclipse.debug.internal.ui;
* All Rights Reserved.
*/
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILauncher;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashMap;
/**
* The images provided by the debug plugin.
@@ -124,6 +127,24 @@ public class DebugPluginImages {
//Wizard Banners
declareRegistryImage(IDebugUIConstants.IMG_WIZBAN_DEBUG, WIZBAN + "debug_wiz.gif");
declareRegistryImage(IDebugUIConstants.IMG_WIZBAN_RUN, WIZBAN + "run_wiz.gif");
+
+ // launchers
+ ILauncher[] launchers = DebugPlugin.getDefault().getLaunchManager().getLaunchers();
+ for (int i = 0; i < launchers.length; i++) {
+ ILauncher launcher = launchers[i];
+ String iconPath = launcher.getIconPath();
+ if (iconPath != 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) {
+ }
+ imageRegistry.put(launcher.getIdentifier(), desc);
+ imageDescriptors.put(launcher.getIdentifier(), desc);
+ }
+ }
}
/**
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 042bd5fc7..4693b6f57 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
@@ -154,26 +154,7 @@ public class DelegatingModelPresentation implements IDebugModelPresentation {
}
protected Image getLauncherImage(ILauncher launcher) {
- 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;
+ return DebugPluginImages.getImage(launcher.getIdentifier());
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchSelectionAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchSelectionAction.java
index fa390110a..cd188e0f6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchSelectionAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchSelectionAction.java
@@ -6,10 +6,12 @@ package org.eclipse.debug.internal.ui;
*/
import java.text.MessageFormat;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.ILauncher;
+import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -17,6 +19,7 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchWindow;
@@ -39,11 +42,13 @@ public class LaunchSelectionAction extends Action {
fMode= mode;
fElement= element;
setText(new DelegatingModelPresentation().getText(launcher));
- ImageDescriptor descriptor= null;
- if (fMode.equals(ILaunchManager.DEBUG_MODE)) {
- descriptor= DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_ACT_DEBUG);
- } else {
- descriptor= DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_ACT_RUN);
+ ImageDescriptor descriptor= DebugPluginImages.getImageDescriptor(launcher.getIdentifier());
+ if (descriptor == null) {
+ if (fMode.equals(ILaunchManager.DEBUG_MODE)) {
+ descriptor= DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_ACT_DEBUG);
+ } else {
+ descriptor= DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_ACT_RUN);
+ }
}
if (descriptor != null) {

Back to the top