Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Rennie2007-03-13 20:01:09 +0000
committerMichael Rennie2007-03-13 20:01:09 +0000
commit90668de6f9384d87b6528385630c140a5e8d05bf (patch)
tree64a7f4b6a16533dc2ac5668d2ee166d39973ce29 /org.eclipse.debug.ui/ui/org/eclipse
parent3a4ee75206dd9ecb6acfdea6bf2d6a37181118b0 (diff)
downloadeclipse.platform.debug-90668de6f9384d87b6528385630c140a5e8d05bf.tar.gz
eclipse.platform.debug-90668de6f9384d87b6528385630c140a5e8d05bf.tar.xz
eclipse.platform.debug-90668de6f9384d87b6528385630c140a5e8d05bf.zip
Bug 176440
Add optional description attribute to launch shortcuts
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java33
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutSelectionDialog.java4
2 files changed, 32 insertions, 5 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java
index c00716a8b..bbf9f46ed 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java
@@ -12,9 +12,11 @@ package org.eclipse.debug.internal.ui.launchConfigurations;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
@@ -53,6 +55,7 @@ public class LaunchShortcutExtension implements ILaunchShortcut, IPluginContribu
private ILaunchShortcut fDelegate = null;
private Set fModes = null;
private Set fAssociatedTypes = null;
+ private Map fDescriptions = null;
private IConfigurationElement fContextualLaunchConfigurationElement = null;
private Expression fContextualLaunchExpr = null;
private Expression fStandardLaunchExpr = null;
@@ -233,12 +236,36 @@ public class LaunchShortcutExtension implements ILaunchShortcut, IPluginContribu
/**
* Returns the contributed description of the launch delegate or <code>null</code>
* if one has not been provided
- * @return the description of the shortcut or <code>null</code> if one was not provided
+ * @param mode the mode to get the description for
+ * @return the description of the shortcut for that specific mode or <code>null</code> if one was not provided
*
* @since 3.3
*/
- public String getShortcutDescription() {
- return fConfig.getAttribute(IConfigurationElementConstants.DESCRIPTION);
+ public String getShortcutDescription(String mode) {
+ if(mode == null) {
+ return null;
+ }
+ if(fDescriptions == null) {
+ fDescriptions = new HashMap();
+ //get the description for the main element first
+ String descr = fConfig.getAttribute(IConfigurationElementConstants.DESCRIPTION);
+ String lmode = null;
+ Set modes = getModes();
+ if(descr != null) {
+ for(Iterator iter = modes.iterator(); iter.hasNext();) {
+ lmode = (String) iter.next();
+ fDescriptions.put(lmode, descr);
+ }
+ }
+ //load descriptions for child description elements
+ IConfigurationElement[] children = fConfig.getChildren(IConfigurationElementConstants.DESCRIPTION);
+ for(int i = 0; i < children.length; i++) {
+ lmode = children[i].getAttribute(IConfigurationElementConstants.MODE);
+ descr = children[i].getAttribute(IConfigurationElementConstants.DESCRIPTION);
+ fDescriptions.put(lmode, descr);
+ }
+ }
+ return (String) fDescriptions.get(mode);
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutSelectionDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutSelectionDialog.java
index adfac45dd..f4cafc0b3 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutSelectionDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutSelectionDialog.java
@@ -142,7 +142,7 @@ public class LaunchShortcutSelectionDialog extends ListDialog {
}
});
}
-
+
/**
* @see org.eclipse.ui.dialogs.ListDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@@ -163,7 +163,7 @@ public class LaunchShortcutSelectionDialog extends ListDialog {
public void widgetSelected(SelectionEvent e) {
Object o = e.item.getData();
if(o instanceof LaunchShortcutExtension) {
- String txt = ((LaunchShortcutExtension)o).getShortcutDescription();
+ String txt = ((LaunchShortcutExtension)o).getShortcutDescription(fMode);
fDescriptionText.setText((txt == null ? LaunchConfigurationsMessages.LaunchShortcutSelectionDialog_3 : txt));
}
}

Back to the top