Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Rennie2007-09-10 16:36:40 +0000
committerMichael Rennie2007-09-10 16:36:40 +0000
commitc11ceeaa1767d34cb70f58053f93d39cb793cfc3 (patch)
treef70521b0ddf8b003cbfbb0171201a554e870ed46 /org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchHistory.java
parent22e0f5592344202ac5bb934702df5dded3e4ab49 (diff)
downloadeclipse.platform.debug-c11ceeaa1767d34cb70f58053f93d39cb793cfc3.tar.gz
eclipse.platform.debug-c11ceeaa1767d34cb70f58053f93d39cb793cfc3.tar.xz
eclipse.platform.debug-c11ceeaa1767d34cb70f58053f93d39cb793cfc3.zip
Bug 198785 Remove launch from Run/Debug drop down
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchHistory.java')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchHistory.java48
1 files changed, 48 insertions, 0 deletions
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 12785d485..9187b13fe 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
@@ -345,6 +345,32 @@ public class LaunchHistory implements ILaunchListener, ILaunchConfigurationListe
}
/**
+ * This method checks if the specified <code>ILaunchConfiguration</code> is a favorite of the launch group
+ * with the specified id
+ * @param configuration
+ * @param launchgroup
+ * @return true if the configuration is a favorite of the launch group with the given id, false otherwise
+ * @throws CoreException
+ *
+ * @since 3.4
+ */
+ protected boolean isFavorite(ILaunchConfiguration configuration, String launchgroup) throws CoreException {
+ List favoriteGroups = configuration.getAttribute(IDebugUIConstants.ATTR_FAVORITE_GROUPS, (List)null);
+ if (favoriteGroups == null) {
+ // check deprecated attributes for backwards compatibility
+ if (launchgroup.equals(IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP)) {
+ return configuration.getAttribute(IDebugUIConstants.ATTR_DEBUG_FAVORITE, false);
+ } else if (launchgroup.equals(IDebugUIConstants.ID_RUN_LAUNCH_GROUP)) {
+ return configuration.getAttribute(IDebugUIConstants.ATTR_RUN_FAVORITE, false);
+ }
+ }
+ else if (favoriteGroups.contains(getLaunchGroup().getIdentifier())) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
* Adds the given config to the favorites list if it is a favorite, and
* returns whether the config was added to the favorites list.
*
@@ -401,6 +427,28 @@ public class LaunchHistory implements ILaunchListener, ILaunchConfigurationListe
}
/**
+ * This method removes the specified <code>ILaunchConfiguration</code> from this launch history (if present)
+ * If the launch configuration does not exist in the history nothing is changed. If the configuration does exist
+ * in the history and was removed all history listeners are notified.
+ * @param configuration the configuration to remove
+ *
+ * @since 3.4
+ */
+ public synchronized void removeFromHistory(ILaunchConfiguration configuration) {
+ try {
+ boolean removed = fCompleteHistory.remove(configuration);
+ if(isFavorite(configuration, getLaunchGroup().getIdentifier())) {
+ removed |= fFavorites.remove(configuration);
+ }
+ if(removed) {
+ setSaved(false);
+ fireLaunchHistoryChanged();
+ }
+ }
+ catch(CoreException ce) {}
+ }
+
+ /**
* @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationChanged(org.eclipse.debug.core.ILaunchConfiguration)
*/
public void launchConfigurationChanged(ILaunchConfiguration configuration) {

Back to the top