Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Rennie2007-02-13 22:13:51 +0000
committerMichael Rennie2007-02-13 22:13:51 +0000
commitd22bcff1807ec0892302b6d76ca1c5a36992e063 (patch)
treec41cdd6ea83f9e1fd7efd181b5a2c52576fb583f /org.eclipse.debug.ui/ui/org/eclipse/debug/internal
parent4bf071f432fb4e312b6878c490b9fd76e892873d (diff)
downloadeclipse.platform.debug-d22bcff1807ec0892302b6d76ca1c5a36992e063.tar.gz
eclipse.platform.debug-d22bcff1807ec0892302b6d76ca1c5a36992e063.tar.xz
eclipse.platform.debug-d22bcff1807ec0892302b6d76ca1c5a36992e063.zip
Bug 74480
[launching] Simplify the launch experience for less technical users of Eclipse
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java19
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchConfigurationAction.java (renamed from org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/SharedLaunchConfigAction.java)12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchShortcutAction.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchablePropertyTester.java37
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.properties2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextRunner.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/DebugContextLaunchingAction.java35
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ProfileContextLaunchingAction.java36
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/RunContextLaunchingAction.java36
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java226
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchHistory.java11
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutSelectionDialog.java52
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ContextLaunchingPreferencePage.java15
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java129
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneManager.java2
20 files changed, 246 insertions, 391 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java
index 9de5c5e39..8c3842479 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java
@@ -51,8 +51,7 @@ public class DebugUIPreferenceInitializer extends AbstractPreferenceInitializer
//contextual launching preference page
prefs.setDefault(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH, false);
- prefs.setDefault(IInternalDebugUIConstants.PREF_ALWAYS_RUN_LAST_LAUNCH, MessageDialogWithToggle.PROMPT);
- prefs.setDefault(IInternalDebugUIConstants.PREF_ALWAYS_RUN_PROJECT_CONFIGURATION, MessageDialogWithToggle.PROMPT);
+ prefs.setDefault(IInternalDebugUIConstants.PREF_LAUNCH_PARENT_PROJECT, false);
//View Management preference page
prefs.setDefault(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES, IDebugUIConstants.ID_DEBUG_PERSPECTIVE);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java
index c767cc431..4d6f18b3d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java
@@ -208,25 +208,16 @@ public interface IInternalDebugUIConstants {
* @since 3.3
* CONTEXTLAUNCHING
*/
- public static final String PREF_USE_CONTEXTUAL_LAUNCH= IDebugUIConstants.PLUGIN_ID + ".UseContextualLaunch"; //$NON-NLS-1$
+ public static final String PREF_USE_CONTEXTUAL_LAUNCH = IDebugUIConstants.PLUGIN_ID + ".UseContextualLaunch"; //$NON-NLS-1$
/**
- * always/never/prompt preference indicating the action for the event when there is no context to launch during context launching
+ * Boolean preference indicating if we should always consider the parent project when
+ * a selected context is not runnable
*
- * @since 3.3
- *
+ * @since 3.3
* CONTEXTLAUNCHING
*/
- public static final String PREF_ALWAYS_RUN_LAST_LAUNCH = IDebugUIConstants.PLUGIN_ID + ".AlwaysRunLastLaunch"; //$NON-NLS-1$
-
- /**
- * always/never/prompt preference indicating the action to take when an un-runnable file is the context
- *
- * @since 3.3
- *
- * CONTEXTLAUNCHING
- */
- public static final String PREF_ALWAYS_RUN_PROJECT_CONFIGURATION = IDebugUIConstants.PLUGIN_ID + ".ALwaysRunProjectConfiguration"; //$NON-NLS-1$
+ public static final String PREF_LAUNCH_PARENT_PROJECT = IDebugUIConstants.PLUGIN_ID + ".LaunchParentProject"; //$NON-NLS-1$
/**
* String preference controlling whether editors are saved before launching.
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java
index c7dd35811..5a68a8af7 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java
@@ -38,6 +38,8 @@ public class ActionMessages extends NLS {
public static String ConfigureColumnsAction_0;
public static String ConfigureColumnsAction_1;
public static String ConfigureColumnsAction_2;
+
+ public static String ContextualLaunchAction_0;
public static String CopyToClipboardActionDelegate_Problem_Copying_to_Clipboard_1;
public static String CopyToClipboardActionDelegate_There_was_a_problem_when_accessing_the_system_clipboard__Retry__2;
@@ -56,6 +58,8 @@ public class ActionMessages extends NLS {
public static String EnableBreakpointAction_Enabling_breakpoints_3;
public static String EnableBreakpointAction_Exceptions_occurred_enabling_the_breakpoint_s___4;
+ public static String LaunchConfigurationAction_0;
+
public static String OpenBreakpointMarkerAction__Go_to_File_1;
public static String OpenBreakpointMarkerAction_Exceptions_occurred_attempting_to_open_the_editor_for_the_breakpoint_resource_2;
public static String OpenBreakpointMarkerAction_Go_to_Breakpoint_1;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties
index 7595cf0fb..ab3c09730 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties
@@ -127,6 +127,7 @@ RetargetAction_3=Operation failed
ModifyWatchpointAction_0=Error
ModifyWatchpointAction_1=Failed to modify watchpoint
LaunchShortcutsAction_1=(none applicable)
+LaunchConfigurationAction_0=&{0} {1}
FindDialog_1=&Specify an element to select (? = any character, * = any String):
FindDialog_3=Find
FindAction_0=&Find...
@@ -165,3 +166,4 @@ SuspendAction_3=Suspend
ConfigureColumnsAction_0=Select &Columns...
ConfigureColumnsAction_1=Select the &columns to display:
ConfigureColumnsAction_2=Select Columns
+ContextualLaunchAction_0={0} (default)
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/SharedLaunchConfigAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchConfigurationAction.java
index fa4032838..5371d66bd 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/SharedLaunchConfigAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchConfigurationAction.java
@@ -15,24 +15,26 @@ import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;
+import com.ibm.icu.text.MessageFormat;
+
/**
- * This class provides an action warpper for adding shared launch configuration actions to the context menu
+ * This class provides an action wrapper for adding launch configuration actions to the context menu
* of the Run->... menu item
*
* @since 3.3
*/
-public class SharedLaunchConfigAction extends Action {
+public class LaunchConfigurationAction extends Action {
private ILaunchConfiguration fConfig;
private String fMode;
/**
- * Consturtor
+ * Constructor
* @param text the text for the action
* @param image the image for the action
*/
- public SharedLaunchConfigAction(ILaunchConfiguration config, String mode, ImageDescriptor image) {
- super(config.getName(), image);
+ public LaunchConfigurationAction(ILaunchConfiguration config, String mode, String text, ImageDescriptor image, int accelerator) {
+ super(MessageFormat.format(ActionMessages.LaunchConfigurationAction_0, new String[] {Integer.toString(accelerator), text}), image);
fConfig = config;
fMode = mode;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchShortcutAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchShortcutAction.java
index 675befe00..673a4488c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchShortcutAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchShortcutAction.java
@@ -45,8 +45,6 @@ public class LaunchShortcutAction extends Action {
updateEnablement();
}
-
-
/**
* Runs with either the active editor or workbench selection.
*
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchablePropertyTester.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchablePropertyTester.java
index c98dd9a0d..96523c819 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchablePropertyTester.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchablePropertyTester.java
@@ -17,7 +17,7 @@ import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
-import org.eclipse.debug.internal.ui.contextlaunching.ContextRunner;
+import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager;
import org.eclipse.debug.ui.actions.ILaunchable;
/**
@@ -34,29 +34,30 @@ public class LaunchablePropertyTester extends PropertyTester {
return Platform.getAdapterManager().hasAdapter(receiver, ILaunchable.class.getName());
}
}
- if("resource".equals(property)) { //$NON-NLS-1$
- IResource res = getResource(receiver);
- if(res != null) {
- return res.isAccessible();
- }
- }
if("contextlaunch".equals(property)) { //$NON-NLS-1$
- return DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH);
- }
- if("contextlaunchable".equals(property)) { //$NON-NLS-1$
- try {
- IResource res = getResource(receiver);
- if(res != null) {
- return ContextRunner.getDefault().getLaunchShortcuts(getResource(receiver)).size() > 0 && ContextRunner.getDefault().isSharedConfig(receiver) == null;
- }
- return false;
- }
- catch (CoreException e) {return false;}
+ if(DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH)) {
+ try {
+ IResource res = getResource(receiver);
+ if(res != null) {
+ return res.isAccessible() && getLaunchConfiguraitonManager().getLaunchShortcuts(getResource(receiver)).size() > 0 && getLaunchConfiguraitonManager().isSharedConfig(receiver) == null;
+ }
+ return false;
+ }
+ catch (CoreException e) {return false;}
+ }
}
return false;
}
/**
+ * Returns the launch configuration manager
+ * @return the launch configuration manager
+ */
+ protected LaunchConfigurationManager getLaunchConfiguraitonManager() {
+ return DebugUIPlugin.getDefault().getLaunchConfigurationManager();
+ }
+
+ /**
* Returns the resource this property page is open on.
*
* @return resource
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.java
index 8aa2142f3..9f9bf4f15 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.java
@@ -15,6 +15,8 @@ public class ContextMessages extends NLS {
public static String ContextRunner_11;
public static String ContextRunner_12;
public static String ContextRunner_13;
+ public static String ContextRunner_14;
+ public static String ContextRunner_15;
public static String ContextRunner_7;
public static String ContextRunner_8;
public static String ContextRunner_9;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.properties
index 3922e9940..0083a5e59 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.properties
@@ -6,5 +6,7 @@ ContextRunner_10=There is no way to launch {2}\n\nWould you like to try and laun
ContextRunner_11=Launch Parent Project?
ContextRunner_12=&Always launch project if resource is not launchable
ContextRunner_13=The resource [{0}] is not accessible for launching
+ContextRunner_14=As...
+ContextRunner_15=...
OpenLaunchDialogAction_0=Open {0} Dialog...
OpenLaunchDialogAction_1=&Open {0} Dialog...
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextRunner.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextRunner.java
index 0c83e4458..15b4e7ee1 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextRunner.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextRunner.java
@@ -356,7 +356,8 @@ public final class ContextRunner {
return config.getName();
}
else {
- return "As..."; //$NON-NLS-1$
+ //TODO could cause TVT issues
+ return ContextMessages.ContextRunner_14;
}
}
else {
@@ -364,10 +365,12 @@ public final class ContextRunner {
List exts = getLaunchConfigurationManager().getLaunchShortcuts(res);
int esize = exts.size();
if(esize == 0) {
- return "..."; //$NON-NLS-1$
+ //TODO could cause TVT issues
+ return ContextMessages.ContextRunner_15;
}
else {
- return "As..."; //$NON-NLS-1$
+ //TODO could cause TVT issues
+ return ContextMessages.ContextRunner_14;
}
}
catch(CoreException ce) {DebugUIPlugin.log(ce);}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/DebugContextLaunchingAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/DebugContextLaunchingAction.java
deleted file mode 100644
index a3b6ccdae..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/DebugContextLaunchingAction.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.contextlaunching;
-
-import org.eclipse.debug.core.ILaunchManager;
-
-/**
- * Specialization of <code>ContextLaunchingAction</code> for debug mode
- *
- * @see ContextLaunchingAction
- * @see ILaunchManager
- * @see RunContextLaunchingAction
- * @see ProfileContextLaunchingAction
- *
- * @since 3.3
- * EXPERIMENTAL
- * CONTEXTLAUNCHING
- */
-public class DebugContextLaunchingAction extends ContextLaunchingAction {
-
- /**
- * Constructor
- */
- public DebugContextLaunchingAction() {
- super(ILaunchManager.DEBUG_MODE);
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ProfileContextLaunchingAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ProfileContextLaunchingAction.java
deleted file mode 100644
index 2193689a0..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ProfileContextLaunchingAction.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.contextlaunching;
-
-import org.eclipse.debug.core.ILaunchManager;
-
-/**
- * Specialization of <code>ContextLaunchingAction</code> for profile mode
- *
- * @see ContextLaunchingAction
- * @see ILaunchManager
- * @see RunContextLaunchingAction
- * @see DebugContextLaunchingAction
- *
- * @since 3.3
- * EXPERIMENTAL
- * CONTEXTLAUNCHING
- */
-public class ProfileContextLaunchingAction extends ContextLaunchingAction {
-
- /**
- * Constructor
- */
- public ProfileContextLaunchingAction() {
- super(ILaunchManager.PROFILE_MODE);
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/RunContextLaunchingAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/RunContextLaunchingAction.java
deleted file mode 100644
index 7f203b133..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/RunContextLaunchingAction.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.contextlaunching;
-
-import org.eclipse.debug.core.ILaunchManager;
-
-/**
- * Specialization of <code>ContextLaunchingAction</code> for run mode
- *
- * @see ContextLaunchingAction
- * @see ILaunchManager
- * @see DebugContextLaunchingAction
- * @see ProfileContextLaunchingAction
- *
- * @since 3.3
- * EXPERIMENTAL
- * CONTEXTLAUNCHING
- */
-public class RunContextLaunchingAction extends ContextLaunchingAction {
-
- /**
- * Constructor
- */
- public RunContextLaunchingAction() {
- super(ILaunchManager.RUN_MODE);
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java
index 72337de3c..f2b16fcbb 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java
@@ -34,7 +34,7 @@ import javax.xml.transform.TransformerException;
import org.eclipse.core.expressions.EvaluationContext;
import org.eclipse.core.expressions.IEvaluationContext;
-import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ISaveContext;
import org.eclipse.core.resources.ISaveParticipant;
@@ -43,10 +43,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
@@ -63,6 +60,7 @@ import org.eclipse.debug.internal.ui.DebugPluginImages;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
import org.eclipse.debug.internal.ui.ILaunchHistoryChangedListener;
+import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.debug.ui.ILaunchGroup;
@@ -70,11 +68,10 @@ import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.activities.IWorkbenchActivitySupport;
import org.eclipse.ui.activities.WorkbenchActivityHelper;
-import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -600,13 +597,38 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
}
/**
+ * Creates a listing of the launch shortcut extensions that are applicable to the underlying resource
+ * @param resource the underlying resource
+ * @return a listing of applicable launch shortcuts or an empty list, never <code>null</code>
+ * @throws CoreException
+ * @since 3.3
+ */
+ public List getLaunchShortcuts(IResource resource) throws CoreException {
+ List list = new ArrayList();
+ List sc = getLaunchShortcuts();
+ List ctxt = new ArrayList();
+ ctxt.add(resource);
+ IEvaluationContext context = new EvaluationContext(null, ctxt);
+ context.addVariable("selection", ctxt); //$NON-NLS-1$
+ LaunchShortcutExtension ext = null;
+ for(Iterator iter = sc.iterator(); iter.hasNext();) {
+ ext = (LaunchShortcutExtension) iter.next();
+ if(ext.evalEnablementExpression(context, ext.getContextualLaunchEnablementExpression()) && !WorkbenchActivityHelper.filterItem(ext)) {
+ if(!list.contains(ext)) {
+ list.add(ext);
+ }
+ }
+ }
+ return list;
+ }
+
+ /**
* Returns a listing of all of the <code>ILaunchConfigurationType</code>s that apply to the currently
* specified <code>IResource</code>.
*
* @param resource the resource context
* @return a listing of applicable <code>ILaunchConfigurationType</code>s, or an empty list, never <code>null</code>
* @since 3.3
- * EXPERIMENTAL
* CONTEXTLAUNCHING
*/
public List getApplicableConfigurationTypes(IResource resource) {
@@ -617,6 +639,7 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
List list = new ArrayList();
list.add(resource);
IEvaluationContext context = new EvaluationContext(null, list);
+ context.setAllowPluginActivation(true);
context.addVariable("selection", list); //$NON-NLS-1$
HashSet set = new HashSet();
for(Iterator iter = exts.iterator(); iter.hasNext();) {
@@ -641,27 +664,81 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
}
/**
- * Returns a listing of all applicable <code>LaunchShortcutExtension</code>s for the given
- * launch configuration type id.
- * @param typeid the id of the launch configuration
- * @return a listing of <code>LaunchShortcutExtension</code>s that are associated with the specified launch configuration
- * type id or an empty list, never <code>null</code>
- *
+ * Returns a list of the <code>ILaunchConfiguration</code>s that apply to the specified <code>IResource</code>
+ * @param resource the resource
+ * @return a listing of applicable <code>ILaunchConfiguration</code>s for the specified <code>IResource</code> or an empty
+ * list if none, never <code>null</code>
* @since 3.3
*/
- public List getApplicableLaunchShortcuts(String typeid) {
- List list = new ArrayList();
- LaunchShortcutExtension ext = null;
- for(int i = 0; i < fLaunchShortcuts.size(); i++) {
- ext = (LaunchShortcutExtension) fLaunchShortcuts.get(i);
- if(ext.getAssociatedConfigurationTypes().contains(typeid)) {
- list.add(ext);
+ public List getApplicableLaunchConfigurations(IResource resource) {
+ ArrayList list = new ArrayList();
+ IPath resourcePath = resource.getFullPath();
+ try {
+ List types = getApplicableConfigurationTypes(resource);
+ List configs = new ArrayList();
+ ILaunchConfiguration[] configurations = getLaunchManager().getLaunchConfigurations();
+ for(int i = 0; i < configurations.length; i++) {
+ if(types.contains(configurations[i].getType())) {
+ if(configurations[i].isMigrationCandidate()) {
+ configurations[i].migrate();
+ }
+ configs.add(configurations[i]);
+ }
+ }
+ ILaunchConfiguration configuration = null;
+ IResource[] resources = null;
+ for (Iterator iter = configs.iterator(); iter.hasNext();) {
+ configuration = (ILaunchConfiguration) iter.next();
+ if(acceptConfiguration(configuration)) {
+ if(configuration.contentsEqual(getLaunchManager().getDefaultConfiguration(resource))) {
+ list.add(configuration);
+ }
+ else {
+ resources = configuration.getMappedResources();
+ if (resources != null) {
+ for (int j = 0; j < resources.length; j++) {
+ if (resource.equals(resources[j]) || resourcePath.isPrefixOf(resources[j].getFullPath())) {
+ list.add(configuration);
+ break;
+ }
+ }
+ }
+ else {
+ //in the event the config has no mapping
+ list.add(configuration);
+ }
+ }
+ }
}
+ } catch (CoreException e) {
+ list.clear();
+ DebugPlugin.log(e);
}
return list;
}
/**
+ * Returns if the specified configuration should be considered as a potential candidate
+ * @param config
+ * @return if the specified configuration should be considered as a potential candidate
+ * @throws CoreException
+ */
+ private boolean acceptConfiguration(ILaunchConfiguration config) throws CoreException {
+ if(config != null && !DebugUITools.isPrivate(config)) {
+ if(!"org.eclipse.ui.externaltools".equals(config.getType().getCategory())) { //$NON-NLS-1$
+ return true;
+ }
+ else {
+ IResource[] res = config.getMappedResources();
+ if(res != null) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
* Returns all launch shortcuts for the given category
*
* @return all launch shortcuts
@@ -738,9 +815,6 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
* or <code>null</code>
*
* @since 3.3
- *
- * EXPERIMENTAL
- * CONTEXTLAUNCHING
*/
public LaunchShortcutExtension getLaunchShortcut(String id) {
loadLaunchShortcuts();
@@ -755,6 +829,33 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
}
/**
+ * Returns the shared config from the selected resource or <code>null</code> if the selected resources is not a shared config
+ * @param receiver the object to test if it is a shared launch configuration
+ * @return the shared config from the selected resource or <code>null</code> if the selected resources is not a shared config
+ * @since 3.3
+ */
+ public ILaunchConfiguration isSharedConfig(Object receiver) {
+ if(receiver instanceof IFile) {
+ IFile file = (IFile) receiver;
+ String ext = file.getFileExtension();
+ if(ext == null) {
+ return null;
+ }
+ if(ext.equals("launch")) { //$NON-NLS-1$
+ ILaunchConfiguration config = DebugPlugin.getDefault().getLaunchManager().getLaunchConfiguration(file);
+ if(config != null && config.exists()) {
+ return config;
+ }
+ }
+ }
+ else if(receiver instanceof IFileEditorInput) {
+ IFileEditorInput input = (IFileEditorInput) receiver;
+ return isSharedConfig(input.getFile());
+ }
+ return null;
+ }
+
+ /**
* Returns the image used to display an error in the given tab
*/
public Image getErrorTabImage(ILaunchConfigurationTab tab) {
@@ -815,6 +916,15 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
}
/**
+ * Returns the singleton instance of the launch manager
+ * @return the singleton instance of the launch manager
+ * @since 3.3
+ */
+ private LaunchManager getLaunchManager() {
+ return (LaunchManager) DebugPlugin.getDefault().getLaunchManager();
+ }
+
+ /**
* Restore launch history
*/
private void loadLaunchHistories() {
@@ -835,76 +945,6 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
}
/**
- * This method allows a default launch shortcut to be specified for the given resource. This sets
- * a default way of <i>how</i> something should be launched, not what specific <code>ILaunchConfiguration</code>
- * will do the launching. Passing in <code>null</code> for a shortcut will remove the attribute.
- *
- * @see {@link ILaunchManager#setDefaultConfiguration(IResource, ILaunchConfiguration)}
- * @param resource the resource to map the specified launch shortcut to
- * @param shortcut the shortcut to map
- *
- * @since 3.3
- *
- * EXPERIMENTAL
- * CONTEXTLAUNCHING
- */
- public void setDefaultLaunchShortcut(IResource resource, LaunchShortcutExtension shortcut) throws CoreException {
- IProject project = resource.getProject();
- if (project == null) {
- throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugPlugin.INTERNAL_ERROR, "Illegal argument: can only set default launch shortcut on and within projects.", null)); //$NON-NLS-1$ (internal error)
- }
- Preferences node = getInstanceNode(resource);
- if(shortcut != null) {
- node.put(IConfigurationElementConstants.DEFAULT_LAUNCH_SHORTCUT, shortcut.getId());
- }
- else {
- node.remove(IConfigurationElementConstants.DEFAULT_LAUNCH_SHORTCUT);
- }
- try {
- node.flush();
- }
- catch (BackingStoreException e) {DebugUIPlugin.log(e);}
- }
-
- /**
- * This method allows access to the default <code>LaunchShortcutExtension</code> for
- * the specified <code>IResource</code>.
- *
- * @see {@link ILaunchManager#getDefaultConfiguration(IResource)}
- * @param resource the resource
- * @return the corresponding <code>LaunchShortcutExtension</code> for the given <code>IResource</code>,
- * or <code>null</code> if there is not one.
- *
- * @since 3.3
- *
- * EXPERIMENTAL
- * CONTEXTLAUNCHING
- */
- public LaunchShortcutExtension getDefaultLaunchShortcut(IResource resource) {
- IProject project = resource.getProject();
- if (project != null) {
- Preferences node = getInstanceNode(resource);
- String id = node.get(IConfigurationElementConstants.DEFAULT_LAUNCH_SHORTCUT, null);
- if(id != null) {
- return getLaunchShortcut(id);
- }
- }
- return null;
- }
-
- /**
- * Returns the node for instance project preferences
- * @param resource the resource to get the node for
- * @return the instance node for debug UI
- */
- private org.osgi.service.prefs.Preferences getInstanceNode(IResource resource) {
- org.osgi.service.prefs.Preferences node = Platform.getPreferencesService().getRootNode();
- node = node.node(InstanceScope.SCOPE).node(DebugUIPlugin.getUniqueIdentifier());
- return node.node(resource.getFullPath().makeRelative().toString());
- }
-
- /**
* Returns the default launch group for the given mode.
*
* @param mode
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchHistory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchHistory.java
index 7b792c8e8..b1a575fb9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchHistory.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchHistory.java
@@ -73,6 +73,17 @@ public class LaunchHistory implements ILaunchListener, ILaunchConfigurationListe
}
/**
+ * Returns if either the history listing or the favorites listing contain the specified <code>ILaunchConfiguration</code>
+ * @param config the config to look for
+ * @return true if one of the listing contains the specified config, false otherwise
+ * @since 3.3
+ * CONTEXTLAUNCHING
+ */
+ public boolean contains(ILaunchConfiguration config) {
+ return fHistory.contains(config) || fFavorites.contains(config);
+ }
+
+ /**
* Adds the given configuration to this history
*
* @param configuration
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 e0af87df4..d7b729d4f 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
@@ -20,17 +20,12 @@ import org.eclipse.debug.core.ILaunchMode;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.DefaultLabelProvider;
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
-import org.eclipse.debug.internal.ui.SWTUtil;
-import org.eclipse.debug.internal.ui.contextlaunching.ContextRunner;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.PlatformUI;
@@ -57,10 +52,6 @@ public class LaunchShortcutSelectionDialog extends ListDialog {
*/
private String fMode = null;
private IResource fResource = null;
- private boolean fChecked = false;
- private boolean fProject = false;
- private boolean fShowProject = false;
- private boolean fShowResource = false;
/**
* Constructor
@@ -68,13 +59,11 @@ public class LaunchShortcutSelectionDialog extends ListDialog {
* @param resource
* @param mode
*/
- public LaunchShortcutSelectionDialog(IResource resource, String mode, boolean showresource, boolean showproject) {
+ public LaunchShortcutSelectionDialog(IResource resource, String mode) {
super(DebugUIPlugin.getShell());
setShellStyle(getShellStyle() | SWT.RESIZE);
fResource = resource;
fMode = mode;
- fShowProject = showproject;
- fShowResource = showresource;
ILaunchMode lmode = DebugPlugin.getDefault().getLaunchManager().getLaunchMode(fMode);
String modename = fMode;
if (lmode != null) {
@@ -127,47 +116,10 @@ public class LaunchShortcutSelectionDialog extends ListDialog {
protected Control createDialogArea(Composite container) {
Composite comp = (Composite) super.createDialogArea(container);
try {
- List input = new ArrayList(ContextRunner.getDefault().getLaunchShortcuts(fResource));
- Button butt = null;
- if(!input.isEmpty()) {
- if(fShowResource) {
- butt = SWTUtil.createCheckButton(comp, MessageFormat.format(LaunchConfigurationsMessages.LaunchShortcutSelectionDialog_2, new String[] {fResource.getName()}), null, fChecked);
- butt.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {}
- public void widgetSelected(SelectionEvent e) {
- fChecked = ((Button)e.getSource()).getSelection();
- }
- });
- }
- if(fShowProject) {
- butt = SWTUtil.createCheckButton(comp, MessageFormat.format(LaunchConfigurationsMessages.LaunchShortcutSelectionDialog_3, new String[] {fResource.getProject().getName()}), null, false);
- butt.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {}
- public void widgetSelected(SelectionEvent e) {
- fProject = ((Button)e.getSource()).getSelection();
- }
- });
- }
- }
+ List input = new ArrayList(DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchShortcuts(fResource));
getTableViewer().setInput(input);
}
catch(CoreException ce) {DebugUIPlugin.log(ce);}
return comp;
}
-
- /**
- * Returns if the launched config from the selected shortcut should be made the default for the underlying resource
- * @return if the launched config should be made the default
- */
- public boolean makeDefault() {
- return fChecked;
- }
-
- /**
- * Returns if the launched config from the selected shortcut should be made the default for the underlying resources' associated project
- * @return if the launched config from the selected shortcut should be made the default for the underlying resources' associated project
- */
- public boolean makeProjectDefault() {
- return fProject;
- }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ContextLaunchingPreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ContextLaunchingPreferencePage.java
index 0e19f5a60..a3f4ddf32 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ContextLaunchingPreferencePage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ContextLaunchingPreferencePage.java
@@ -17,11 +17,9 @@ import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
import org.eclipse.debug.internal.ui.SWTUtil;
-import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.preference.RadioGroupFieldEditor;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -69,17 +67,10 @@ public class ContextLaunchingPreferencePage extends PreferencePage implements IW
//use contextual launch
FieldEditor edit = new BooleanFieldEditor(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH, DebugPreferencesMessages.ContextualLaunchPreferencePage_1, comp);
fFieldEditors.add(edit);
-
- edit = new RadioGroupFieldEditor(IInternalDebugUIConstants.PREF_ALWAYS_RUN_LAST_LAUNCH, DebugPreferencesMessages.ContextLaunchingPreferencePage_0, 3,
- new String[][] {{DebugPreferencesMessages.LaunchingPreferencePage_3, MessageDialogWithToggle.ALWAYS},
- {DebugPreferencesMessages.LaunchingPreferencePage_5, MessageDialogWithToggle.PROMPT}},
- comp, true);
- fFieldEditors.add(edit);
- edit = new RadioGroupFieldEditor(IInternalDebugUIConstants.PREF_ALWAYS_RUN_PROJECT_CONFIGURATION, DebugPreferencesMessages.ContextLaunchingPreferencePage_1, 3,
- new String[][] {{DebugPreferencesMessages.LaunchingPreferencePage_7, MessageDialogWithToggle.ALWAYS},
- {DebugPreferencesMessages.LaunchingPreferencePage_9, MessageDialogWithToggle.PROMPT}},
- comp, true);
+
+ edit = new BooleanFieldEditor(IInternalDebugUIConstants.PREF_LAUNCH_PARENT_PROJECT, DebugPreferencesMessages.ContextLaunchingPreferencePage_0, comp);
fFieldEditors.add(edit);
+
//init the field editors
FieldEditor editor;
for(int i = 0; i < fFieldEditors.size(); i++) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties
index a7d6ba217..b0991a942 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties
@@ -18,8 +18,7 @@ ConsolePreferencePage_Standard_Out__2=Standard &Out text color:
ConsolePreferencePage_Wrap_text_1=Fixed &width console
ContextualLaunchPreferencePage_0=This page is used to edit contextual launching options (EXPERIMENTAL).
ContextualLaunchPreferencePage_1=&Enable contextual launching.
-ContextLaunchingPreferencePage_0=Launch previous when no context available
-ContextLaunchingPreferencePage_1=Launch project of un-runnable context
+ContextLaunchingPreferencePage_0=Always launch &related project if context is not launchable
ConsolePreferencePage_Console_width=&Maximum character width:
ConsolePreferencePage_Limit_console_output_1=&Limit console output
ConsolePreferencePage_Console_buffer_size__characters___2=Console &buffer size (characters):
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java
index 2ccb2d592..2b0c51e69 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.preferences;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
@@ -22,7 +21,6 @@ import java.util.Set;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
@@ -33,8 +31,8 @@ import org.eclipse.debug.internal.ui.DefaultLabelProvider;
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
import org.eclipse.debug.internal.ui.SWTUtil;
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationComparator;
-import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
@@ -84,6 +82,11 @@ public class RunDebugPropertiesPage extends PropertyPage {
private Set fOriginalCandidates;
/**
+ * Holds configurations that need to be saved when the page closes
+ */
+ private Set fChangedConfigurations = new HashSet();
+
+ /**
* List of the applicable launch config types for the backing resource
*/
private List fTypeCandidates = null;
@@ -207,6 +210,21 @@ public class RunDebugPropertiesPage extends PropertyPage {
}
/**
+ * @see org.eclipse.jface.dialogs.DialogPage#dispose()
+ */
+ public void dispose() {
+ if(fOriginalCandidates != null) {
+ fOriginalCandidates.clear();
+ fOriginalCandidates = null;
+ }
+ if(fChangedConfigurations != null) {
+ fChangedConfigurations.clear();
+ fChangedConfigurations = null;
+ }
+ super.dispose();
+ }
+
+ /**
* Returns the viewer displaying possible default configurations.
*
* @return viewer
@@ -253,72 +271,18 @@ public class RunDebugPropertiesPage extends PropertyPage {
protected Set collectConfigCandidates(IResource resource) {
if(fOriginalCandidates == null) {
fOriginalCandidates = new HashSet();
- IPath resourcePath = resource.getFullPath();
try {
- List types = collectTypeCandidates();
- List configs = new ArrayList();
- ILaunchConfiguration[] configurations = getLaunchManager().getLaunchConfigurations();
- for(int i = 0; i < configurations.length; i++) {
- if(types.contains(configurations[i].getType())) {
- if(configurations[i].isMigrationCandidate()) {
- configurations[i].migrate();
- }
- configs.add(configurations[i]);
- }
- }
- ILaunchConfiguration configuration = null;
- IResource[] resources = null;
- for (Iterator iter = configs.iterator(); iter.hasNext();) {
- configuration = (ILaunchConfiguration) iter.next();
- if(acceptConfiguration(configuration)) {
- if(configuration.contentsEqual(getLaunchManager().getDefaultConfiguration(resource))) {
- fOriginalCandidates.add(configuration.getWorkingCopy());
- }
- else {
- resources = configuration.getMappedResources();
- if (resources != null) {
- for (int j = 0; j < resources.length; j++) {
- if (resource.equals(resources[j]) || resourcePath.isPrefixOf(resources[j].getFullPath())) {
- fOriginalCandidates.add(configuration.getWorkingCopy());
- break;
- }
- }
- }
- else {
- //in the event the config has no mapping
- fOriginalCandidates.add(configuration.getWorkingCopy());
- }
- }
- }
+ List configs = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getApplicableLaunchConfigurations(resource);
+ for(Iterator iter = configs.iterator(); iter.hasNext();) {
+ fOriginalCandidates.add(((ILaunchConfiguration)iter.next()).getWorkingCopy());
}
- } catch (CoreException e) {
- fOriginalCandidates.clear();
- DebugPlugin.log(e);
}
+ catch(CoreException ce) {DebugUIPlugin.log(ce);}
}
return fOriginalCandidates;
}
- /**
- * Returns if the specified configuration should be considered as a potential candidate
- * @param config
- * @return if the specified configuration should be considered as a potential candidate
- * @throws CoreException
- */
- private boolean acceptConfiguration(ILaunchConfiguration config) throws CoreException {
- if(config != null && !DebugUITools.isPrivate(config)) {
- if(!"org.eclipse.ui.externaltools".equals(config.getType().getCategory())) { //$NON-NLS-1$
- return true;
- }
- else {
- IResource[] res = config.getMappedResources();
- if(res != null) {
- return true;
- }
- }
- }
- return false;
- }
+
/**
* Returns the resource this property page is open on.
@@ -365,15 +329,13 @@ public class RunDebugPropertiesPage extends PropertyPage {
}
}
//add
- iter = fOriginalCandidates.iterator();
+ iter = fChangedConfigurations.iterator();
while (iter.hasNext()) {
ILaunchConfigurationWorkingCopy currentConfig = (ILaunchConfigurationWorkingCopy) iter.next();
- if (currentConfig.isDirty()){
- try{
- currentConfig.doSave();
- } catch (CoreException e) {
- DebugPlugin.logMessage("Problem saving changes to configuration " + currentConfig.getName(), e); //$NON-NLS-1$
- }
+ try{
+ currentConfig.doSave();
+ } catch (CoreException e) {
+ DebugPlugin.logMessage("Problem saving changes to configuration " + currentConfig.getName(), e); //$NON-NLS-1$
}
}
@@ -397,12 +359,12 @@ public class RunDebugPropertiesPage extends PropertyPage {
private Set getConfigurationNames() {
Set names = new HashSet();
Iterator iter = fOriginalCandidates.iterator();
- Object o = null;
while (iter.hasNext()) {
- o = iter.next();
- if(o instanceof ILaunchConfiguration) {
- names.add(((ILaunchConfiguration)o).getName());
- }
+ names.add(((ILaunchConfiguration)iter.next()).getName());
+ }
+ iter = fChangedConfigurations.iterator();
+ while (iter.hasNext()) {
+ names.add(((ILaunchConfiguration)iter.next()).getName());
}
return names;
}
@@ -426,8 +388,8 @@ public class RunDebugPropertiesPage extends PropertyPage {
ILaunchConfigurationWorkingCopy copy = configuration.copy(
((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).generateUniqueLaunchConfigurationNameFrom(configuration.getName(), getConfigurationNames()));
copy.setAttributes(configuration.getAttributes());
- fOriginalCandidates.add(copy);
- fViewer.refresh();
+ fChangedConfigurations.add(copy);
+ fViewer.add(copy);
fViewer.setSelection(new StructuredSelection(copy));
} catch (CoreException e) {
setErrorMessage(e.getMessage());
@@ -444,9 +406,9 @@ public class RunDebugPropertiesPage extends PropertyPage {
ILaunchConfiguration[] configurations = getSelectedConfigurations();
for (int i = 0; i < configurations.length; i++) {
fDeletedConfigurations.add(configurations[i]);
- fOriginalCandidates.remove(configurations[i]);
+ fChangedConfigurations.remove(configurations[i]);
+ fViewer.remove(configurations[i]);
}
- fViewer.refresh();
if (indices[0] < table.getItemCount()) {
fViewer.setSelection(new StructuredSelection(table.getItem(indices[0]).getData()));
} else if (table.getItemCount() > 0) {
@@ -458,8 +420,11 @@ public class RunDebugPropertiesPage extends PropertyPage {
* Edit the selection
*/
private void handleEdit() {
- edit(getSelectedConfigurations()[0]);
- fViewer.refresh();
+ ILaunchConfigurationWorkingCopy config = getSelectedConfigurations()[0];
+ if(edit(config) == IDialogConstants.OK_ID) {
+ fChangedConfigurations.add(config);
+ fViewer.refresh();
+ }
}
/**
@@ -493,8 +458,8 @@ public class RunDebugPropertiesPage extends PropertyPage {
((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).
generateUniqueLaunchConfigurationNameFrom("New_configuration", getConfigurationNames())); //$NON-NLS-1$
if (edit(wc) == Window.OK) {
- fOriginalCandidates.add(wc);
- fViewer.refresh();
+ fChangedConfigurations.add(wc);
+ fViewer.add(wc);
fViewer.setSelection(new StructuredSelection(wc));
}
} catch (CoreException e) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneManager.java
index 20b9bd5b4..f1d44e4d7 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneManager.java
@@ -195,7 +195,7 @@ public class DetailPaneManager {
* @return an evaluatable expression or <code>null</code>
*/
private Expression getEnablementExpression(){
- // all of this stuff is optional, so...tedius testing is required
+ // all of this stuff is optional, so...tedious testing is required
if (fEnablementExpression == null) {
try{
IConfigurationElement[] elements = fConfigElement.getChildren(ExpressionTagNames.ENABLEMENT);

Back to the top