diff options
Diffstat (limited to 'org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java')
-rw-r--r-- | org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java index bf07cc948..b7d6bed90 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java @@ -34,6 +34,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.ListIterator; import java.util.Map; import java.util.Properties; import java.util.Set; @@ -1107,7 +1108,21 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe */ public synchronized void verifyImportedLaunchConfigurations() { try { - verifyConfigurations(findLocalLaunchConfigurations(), fLaunchConfigurationIndex); + //maintain consistency, we cannot have a local configuration that is the same as a shared one. + List shared = getSharedLaunchConfigurationNames(); + List local = findLocalLaunchConfigurations(); + ILaunchConfiguration config = null; + for(ListIterator iter = local.listIterator(); iter.hasNext();) { + config = (ILaunchConfiguration) iter.next(); + if(shared.contains(config.getName())) { + iter.remove(); + config.delete(); + } + } + verifyConfigurations(local, fLaunchConfigurationIndex); + } + catch(CoreException ce) { + DebugPlugin.log(ce); } finally { hookResourceChangeListener(); @@ -1665,6 +1680,24 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe } /** + * Returns a collection of configuration names that are shared in the workspace + * @return collection of shared launch configuration names + * @since 3.4.0 + */ + protected synchronized List getSharedLaunchConfigurationNames() { + Iterator iter = getAllLaunchConfigurations().iterator(); + List configs = new ArrayList(); + ILaunchConfiguration config = null; + while (iter.hasNext()) { + config = (ILaunchConfiguration)iter.next(); + if (!config.isLocal()) { + configs.add(config.getName()); + } + } + return configs; + } + + /** * Returns the launch configurations mapping to the specified resource * @param resource the resource to collect mapped launch configurations for * @return a list of launch configurations if found or an empty list, never null |