Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 74189 Details for
Bug 197000
[launching] Auto Launch Configuration deletion should be resource specific
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch for 3.3.1 (if needed)
197000patch (text/plain), 5.00 KB, created by
Michael Rennie
on 2007-07-19 16:37:05 EDT
(
hide
)
Description:
patch for 3.3.1 (if needed)
Filename:
MIME Type:
Creator:
Michael Rennie
Created:
2007-07-19 16:37:05 EDT
Size:
5.00 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.debug.core >Index: core/org/eclipse/debug/internal/core/LaunchManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java,v >retrieving revision 1.199 >diff -u -r1.199 LaunchManager.java >--- core/org/eclipse/debug/internal/core/LaunchManager.java 19 Jul 2007 18:15:24 -0000 1.199 >+++ core/org/eclipse/debug/internal/core/LaunchManager.java 19 Jul 2007 20:33:59 -0000 >@@ -290,6 +290,36 @@ > } > > /** >+ * Visitor for handling a resource begin deleted, and the need to check mapped configurations >+ * for auto-deletion >+ * @since 3.4 >+ */ >+ class MappedResourceVisitor implements IResourceDeltaVisitor { >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta) >+ */ >+ public boolean visit(IResourceDelta delta) throws CoreException { >+ if(delta.getKind() == IResourceDelta.REMOVED && delta.getFlags() != IResourceDelta.MOVED_TO) { >+ if (isDeleteConfigurations()) { >+ ArrayList configs = collectAssociatedLaunches(delta.getResource()); >+ if(configs.size() > 0) { >+ for(Iterator iter = configs.iterator(); iter.hasNext();) { >+ try { >+ ((ILaunchConfiguration)iter.next()).delete(); >+ } catch (CoreException e) { >+ DebugPlugin.log(e.getStatus()); >+ } >+ } >+ } >+ } >+ return false; >+ } >+ return true; >+ } >+ } >+ >+ /** > * Visitor for handling resource deltas. > */ > class LaunchManagerVisitor implements IResourceDeltaVisitor { >@@ -335,7 +365,6 @@ > if (0 != (delta.getFlags() & IResourceDelta.OPEN)) { > if (delta.getResource() instanceof IProject) { > IProject project = (IProject)delta.getResource(); >- > if (project.isOpen()) { > LaunchManager.this.projectOpened(project); > } else { >@@ -371,22 +400,6 @@ > } > } > return false; >- } else if (resource instanceof IProject) { >- if (isDeleteConfigurations()) { >- if(delta.getKind() == IResourceDelta.REMOVED && delta.getFlags() != IResourceDelta.MOVED_TO) { >- IProject project = (IProject) resource; >- ArrayList configs = collectAssociatedLaunches(project); >- if(configs.size() > 0) { >- for(Iterator iter = configs.iterator(); iter.hasNext();) { >- try { >- ((ILaunchConfiguration)iter.next()).delete(); >- } catch (CoreException e) { >- DebugPlugin.log(e.getStatus()); >- } >- } >- } >- } >- } > } > return true; > } >@@ -631,6 +644,15 @@ > private LaunchManagerVisitor fgVisitor; > > /** >+ * Visitor used to process a deleted resource, >+ * to remove mapped launch configurations in the event >+ * auto-removal of launch configurations is enabled >+ * >+ * @since 3.4 >+ */ >+ private MappedResourceVisitor fgMRVisitor; >+ >+ /** > * Whether this manager is listening for resource change events > */ > private boolean fListening = false; >@@ -1179,6 +1201,18 @@ > return fgVisitor; > } > >+ /** >+ * Returns the resource delta visitor for auto-removal of mapped launch configurations >+ * @return the resource delta visitor for auto-removal of mapped launch configurations >+ * >+ * @since 3.4 >+ */ >+ private MappedResourceVisitor getMappedResourceVisitor() { >+ if(fgMRVisitor == null) { >+ fgMRVisitor = new MappedResourceVisitor(); >+ } >+ return fgMRVisitor; >+ } > > /* (non-Javadoc) > * @see org.eclipse.debug.core.ILaunchManager#getEnvironment(org.eclipse.debug.core.ILaunchConfiguration) >@@ -2165,8 +2199,10 @@ > } > } else { > LaunchManagerVisitor visitor = getDeltaVisitor(); >+ MappedResourceVisitor v = getMappedResourceVisitor(); > try { > delta.accept(visitor); >+ delta.accept(v); > } catch (CoreException e) { > DebugPlugin.log(e.getStatus()); > } >@@ -2175,14 +2211,14 @@ > } > > /** >- * Gets the launch configuration associated with the specified project. >+ * Gets the launch configuration associated with the specified <code>IResource</code>. > * This method relies on the resource mapping existing, if no such mapping > * exists the launch configuration is ignored. > * >- * @param project the project to collect launch configurations for >+ * @param resource the resource to collect launch configurations for > * @return the list of associated launch configurations > */ >- private ArrayList collectAssociatedLaunches(IProject project) { >+ private ArrayList collectAssociatedLaunches(IResource resource) { > ArrayList list = new ArrayList(); > try { > ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(); >@@ -2192,7 +2228,8 @@ > resources = configs[i].getMappedResources(); > if(resources != null) { > for(int j = 0; j < resources.length; j++){ >- if(project.equals(resources[j].getProject())) { >+ if(resource.equals(resources[j]) || >+ resource.getFullPath().isPrefixOf(resources[j].getFullPath())) { > list.add(configs[i]); > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 197000
: 74189