diff options
author | Michael Rennie | 2007-04-04 20:41:19 +0000 |
---|---|---|
committer | Michael Rennie | 2007-04-04 20:41:19 +0000 |
commit | 44e8825d74ca00c454ba536399f83c2e5fd3ad0f (patch) | |
tree | 4f98f4348abfdf7e8c55793371a2c35ab240cd3c | |
parent | 12b2ae63b4162186780444f09ea998e4e93c17e2 (diff) | |
download | eclipse.platform.debug-44e8825d74ca00c454ba536399f83c2e5fd3ad0f.tar.gz eclipse.platform.debug-44e8825d74ca00c454ba536399f83c2e5fd3ad0f.tar.xz eclipse.platform.debug-44e8825d74ca00c454ba536399f83c2e5fd3ad0f.zip |
Bug 166219
[launching] Run Last Launched fails due to Launch Config Tree filter
11 files changed, 43 insertions, 54 deletions
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 ec74e556d..bfd603b70 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 @@ -79,7 +79,6 @@ import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationPro import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTypeFilter; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchGroupExtension; import org.eclipse.debug.internal.ui.launchConfigurations.PerspectiveManager; -import org.eclipse.debug.internal.ui.launchConfigurations.WorkingSetsFilter; import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility; import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupManager; import org.eclipse.debug.internal.ui.stringsubstitution.SelectedResourceManager; @@ -1239,9 +1238,6 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { if(DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_FILTER_LAUNCH_DELETED)) { ret &= new DeletedProjectFilter().select(null, null, config); } - if(DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_FILTER_WORKING_SETS)) { - ret &= new WorkingSetsFilter().select(null, null, config); - } if(DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_FILTER_LAUNCH_TYPES)) { try { ret &= new LaunchConfigurationTypeFilter().select(null, null, config.getType()); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/DebugLastAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/DebugLastAction.java index 510dafbf8..f55030a92 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/DebugLastAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/DebugLastAction.java @@ -12,7 +12,7 @@ package org.eclipse.debug.internal.ui.actions; import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.internal.ui.DebugUIPlugin; +import org.eclipse.debug.internal.ui.contextlaunching.LaunchingResourceManager; import org.eclipse.debug.ui.IDebugUIConstants; /** @@ -44,7 +44,7 @@ public class DebugLastAction extends RelaunchLastAction { * @see org.eclipse.debug.internal.ui.actions.RelaunchLastAction#getText() */ protected String getText() { - if(DebugUIPlugin.getDefault().getLaunchingResourceManager().isContextLaunchEnabled()) { + if(LaunchingResourceManager.isContextLaunchEnabled()) { return ActionMessages.DebugLastAction_1; } else { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ProfileLastAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ProfileLastAction.java index d8097b0ac..5b020addf 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ProfileLastAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ProfileLastAction.java @@ -12,7 +12,7 @@ package org.eclipse.debug.internal.ui.actions; import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.internal.ui.DebugUIPlugin; +import org.eclipse.debug.internal.ui.contextlaunching.LaunchingResourceManager; import org.eclipse.debug.ui.IDebugUIConstants; /** @@ -45,7 +45,7 @@ public class ProfileLastAction extends RelaunchLastAction { * @see org.eclipse.debug.internal.ui.actions.RelaunchLastAction#getText() */ protected String getText() { - if(DebugUIPlugin.getDefault().getLaunchingResourceManager().isContextLaunchEnabled()) { + if(LaunchingResourceManager.isContextLaunchEnabled()) { return ActionMessages.ProfileLastAction_1; } else { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RelaunchLastAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RelaunchLastAction.java index d41a31a8f..cc41e55d9 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RelaunchLastAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RelaunchLastAction.java @@ -20,6 +20,7 @@ import org.eclipse.debug.core.ILaunchConfigurationType; 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.contextlaunching.LaunchingResourceManager; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog; import org.eclipse.debug.ui.DebugUITools; import org.eclipse.debug.ui.ILaunchGroup; @@ -68,7 +69,7 @@ public abstract class RelaunchLastAction implements IWorkbenchWindowActionDelega * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) */ public void run(IAction action){ - if(DebugUIPlugin.getDefault().getLaunchingResourceManager().isContextLaunchEnabled()) { + if(LaunchingResourceManager.isContextLaunchEnabled()) { ILaunchGroup group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(getLaunchGroupId()); ContextRunner.getDefault().launch(group); return; @@ -151,7 +152,7 @@ public abstract class RelaunchLastAction implements IWorkbenchWindowActionDelega * Return the last launch that occurred in the workspace. */ protected ILaunchConfiguration getLastLaunch() { - return DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLastLaunch(getLaunchGroupId()); + return DebugUIPlugin.getDefault().getLaunchConfigurationManager().getFilteredLastLaunch(getLaunchGroupId()); } /** diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RunLastAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RunLastAction.java index 478b7a402..9a4e03dc0 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RunLastAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RunLastAction.java @@ -12,7 +12,7 @@ package org.eclipse.debug.internal.ui.actions; import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.internal.ui.DebugUIPlugin; +import org.eclipse.debug.internal.ui.contextlaunching.LaunchingResourceManager; import org.eclipse.debug.ui.IDebugUIConstants; /** @@ -44,7 +44,7 @@ public class RunLastAction extends RelaunchLastAction { * @see org.eclipse.debug.internal.ui.actions.RelaunchLastAction#getText() */ protected String getText() { - if(DebugUIPlugin.getDefault().getLaunchingResourceManager().isContextLaunchEnabled()) { + if(LaunchingResourceManager.isContextLaunchEnabled()) { return ActionMessages.RunLastAction_1; } else { 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 e463d7558..7ad6cd572 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 @@ -24,7 +24,6 @@ import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.DefaultLabelProvider; import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager; -import org.eclipse.debug.internal.ui.launchConfigurations.LaunchHistory; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutExtension; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutSelectionDialog; import org.eclipse.debug.internal.ui.stringsubstitution.SelectedResourceManager; @@ -85,10 +84,7 @@ public final class ContextRunner { //2. launch last if no resource ILaunchConfiguration config = null; if(group != null) { - LaunchHistory history = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchHistory(group.getIdentifier()); - if(history != null) { - config = history.getRecentLaunch(); - } + config = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getFilteredLastLaunch(group.getIdentifier()); } if(config != null) { DebugUITools.launch(config, group.getMode()); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/LaunchingResourceManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/LaunchingResourceManager.java index 25362d321..7b3b2c7ed 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/LaunchingResourceManager.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/LaunchingResourceManager.java @@ -22,7 +22,6 @@ import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; import org.eclipse.debug.internal.ui.ILaunchLabelChangedListener; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager; -import org.eclipse.debug.internal.ui.launchConfigurations.LaunchHistory; import org.eclipse.debug.internal.ui.stringsubstitution.SelectedResourceManager; import org.eclipse.debug.ui.ILaunchGroup; import org.eclipse.jface.action.CoolBarManager; @@ -85,7 +84,7 @@ public class LaunchingResourceManager implements IPropertyChangeListener, IWindo * Returns if context launching is enabled * @return if context launching is enabled */ - public boolean isContextLaunchEnabled() { + public static boolean isContextLaunchEnabled() { return DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH); } @@ -147,7 +146,7 @@ public class LaunchingResourceManager implements IPropertyChangeListener, IWindo label = getResourceLabel(SelectedResourceManager.getDefault().getSelectedResource(), group); } else { - config = getLastLaunch(group); + config = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getFilteredLastLaunch(group.getIdentifier()); if(config != null) { label = config.getName(); } @@ -170,21 +169,6 @@ public class LaunchingResourceManager implements IPropertyChangeListener, IWindo } /** - * Return the last launch in this action's launch history. - * - * @return the most recent configuration that was launched from this - * action's launch history that is not filtered from the menu - */ - protected ILaunchConfiguration getLastLaunch(ILaunchGroup group) { - LaunchConfigurationManager manager = DebugUIPlugin.getDefault().getLaunchConfigurationManager(); - ILaunchConfiguration configuration = manager.getLastLaunch(group.getIdentifier()); - if (configuration == null) { - return manager.getFilteredLastLaunch(group.getIdentifier()); - } - return configuration; - } - - /** * Returns the label for the specified resource or the empty string, never <code>null</code> * @param resource * @param group @@ -194,12 +178,9 @@ public class LaunchingResourceManager implements IPropertyChangeListener, IWindo if(resource == null) { //no resource try last launch like the runner does if(group != null) { - LaunchHistory history = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchHistory(group.getIdentifier()); - if(history != null) { - ILaunchConfiguration config = history.getRecentLaunch(); - if(config != null) { - return config.getName(); - } + ILaunchConfiguration config = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getFilteredLastLaunch(group.getIdentifier()); + if(config != null) { + return config.getName(); } } //otherwise try to determine if there is a way to launch it 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 2a2dbbc4d..79d9d7188 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 @@ -201,18 +201,19 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici * @return the given collection minus any configurations from disabled activities */ public static ILaunchConfiguration[] filterConfigs(ILaunchConfiguration[] configurations) { - IWorkbenchActivitySupport activitySupport= PlatformUI.getWorkbench().getActivitySupport(); + IWorkbenchActivitySupport activitySupport = PlatformUI.getWorkbench().getActivitySupport(); if (activitySupport == null) { return configurations; } - - List filteredConfigs= new ArrayList(); + List filteredConfigs = new ArrayList(); + ILaunchConfigurationType type = null; + LaunchConfigurationTypeContribution contribution = null; + ILaunchConfiguration configuration = null; for (int i = 0; i < configurations.length; i++) { - ILaunchConfiguration configuration = configurations[i]; - ILaunchConfigurationType type= null; + configuration = configurations[i]; try { type = configuration.getType(); - LaunchConfigurationTypeContribution contribution = new LaunchConfigurationTypeContribution(type); + contribution = new LaunchConfigurationTypeContribution(type); if (DebugUIPlugin.doLaunchConfigurationFiltering(configuration) & !WorkbenchActivityHelper.filterItem(contribution)) { filteredConfigs.add(configuration); } @@ -248,7 +249,7 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici * Performs cleanup operations when the manager is being disposed of. */ public void shutdown() { - ILaunchManager launchManager= DebugPlugin.getDefault().getLaunchManager(); + ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); launchManager.removeLaunchListener(this); if (fLaunchHistories != null) { Iterator histories = fLaunchHistories.values().iterator(); @@ -298,8 +299,10 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici /** * Returns the most recent launch for the given group, or <code>null</code> - * if none. + * if none. This method does not include any filtering for the returned launch configuration. * + * This method is exposed via DebugTools.getLastLaunch + * * @return the last launch, or <code>null</code> if none */ public ILaunchConfiguration getLastLaunch(String groupId) { @@ -716,7 +719,7 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici IPath resourcePath = resource.getFullPath(); try { List types = getApplicableConfigurationTypes(resource); - ILaunchConfiguration[] configurations = getLaunchManager().getLaunchConfigurations(); + ILaunchConfiguration[] configurations = filterConfigs(getLaunchManager().getLaunchConfigurations()); ILaunchConfiguration configuration = null; IResource[] resources = null; for(int i = 0; i < configurations.length; i++) { @@ -846,7 +849,7 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici */ public ILaunchConfiguration getMRUConfiguration(List configurations, ILaunchGroup group) { if(group != null) { - ILaunchConfiguration config = getLastLaunch(group.getIdentifier()); + ILaunchConfiguration config = getFilteredLastLaunch(group.getIdentifier()); if(configurations.contains(config)) { return config; } 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 d51431c8a..b0ed256b9 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 @@ -39,10 +39,20 @@ public class LaunchHistory implements ILaunchListener, ILaunchConfigurationListe */ private Vector fCompleteHistory = new Vector(); + /** + * The launch group this history is provided for + */ private ILaunchGroup fGroup; + + /** + * Ordered listing of the favorites of this history + */ private Vector fFavorites = new Vector(); - private static List fgLaunchHistoryInstances= new ArrayList(); + /** + * List of instances of this launch history + */ + private static List fgLaunchHistoryInstances = new ArrayList(); /** * Creates a new launch history for the given launch group diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java index b81699d64..ec1ae1ec9 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java @@ -708,7 +708,8 @@ public class DebugUITools { /** * Returns the last configuration that was launched for specified launch group or - * <code>null</code>, if there is not one. + * <code>null</code>, if there is not one. This method does not provide any form of + * filtering on the returned launch configurations. * * @param groupId the unique identifier of a launch group * @return the last launched configuration for the specified group or <code>null</code>. diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchToolbarAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchToolbarAction.java index 3021dde05..d7f41bbdf 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchToolbarAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchToolbarAction.java @@ -14,6 +14,7 @@ package org.eclipse.debug.ui.actions; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.contextlaunching.ContextRunner; +import org.eclipse.debug.internal.ui.contextlaunching.LaunchingResourceManager; import org.eclipse.debug.internal.ui.launchConfigurations.OrganizeFavoritesAction; import org.eclipse.debug.ui.DebugUITools; import org.eclipse.jface.action.IAction; @@ -74,7 +75,7 @@ public class AbstractLaunchToolbarAction extends AbstractLaunchHistoryAction { */ public void run(IAction action) { //always ignore external tools during context launching - if(DebugUIPlugin.getDefault().getLaunchingResourceManager().isContextLaunchEnabled() && + if(LaunchingResourceManager.isContextLaunchEnabled() && !getLaunchGroupIdentifier().equals("org.eclipse.ui.externaltools.launchGroup")) { //$NON-NLS-1$ ContextRunner.getDefault().launch(DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(getLaunchGroupIdentifier())); } |