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 115544 Details for
Bug 229633
Better Support for Linked Resources: Need for Virtual folders and project level variable relative path resolution.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
A patch for the AliasManager that fixes concurrency exceptions. Note that this applies to stock 3.4 as well, not only the changes suggested by this bug.
AliasManager_patch.txt (text/plain), 7.07 KB, created by
Serge Beauchamp
on 2008-10-20 06:40:22 EDT
(
hide
)
Description:
A patch for the AliasManager that fixes concurrency exceptions. Note that this applies to stock 3.4 as well, not only the changes suggested by this bug.
Filename:
MIME Type:
Creator:
Serge Beauchamp
Created:
2008-10-20 06:40:22 EDT
Size:
7.07 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.core.resources >Index: src/org/eclipse/core/internal/resources/AliasManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/AliasManager.java,v >retrieving revision 1.41 >diff -u -r1.41 AliasManager.java >--- src/org/eclipse/core/internal/resources/AliasManager.java 3 Jun 2008 12:34:51 -0000 1.41 >+++ src/org/eclipse/core/internal/resources/AliasManager.java 20 Oct 2008 10:27:50 -0000 >@@ -94,13 +94,15 @@ > break; > } > if (aliasPath != null) >- if (aliasType == IResource.FILE) { >- aliases.add(workspace.getRoot().getFile(aliasPath)); >- } else { >- if (aliasPath.segmentCount() == 1) >- aliases.add(workspace.getRoot().getProject(aliasPath.lastSegment())); >- else >- aliases.add(workspace.getRoot().getFolder(aliasPath)); >+ synchronized(aliases) { >+ if (aliasType == IResource.FILE) { >+ aliases.add(workspace.getRoot().getFile(aliasPath)); >+ } else { >+ if (aliasPath.segmentCount() == 1) >+ aliases.add(workspace.getRoot().getProject(aliasPath.lastSegment())); >+ else >+ aliases.add(workspace.getRoot().getFolder(aliasPath)); >+ } > } > } > >@@ -369,13 +371,15 @@ > * Builds the table of aliased projects from scratch. > */ > private void buildAliasedProjectsSet() { >- aliasedProjects.clear(); >- //if there are no resources in non-default locations then there can't be any aliased projects >- if (nonDefaultResourceCount <= 0) >- return; >- //for every resource that overlaps another, marked its project as aliased >- addToCollection.setCollection(aliasedProjects); >- locationsMap.overLappingResourcesDo(addToCollection); >+ synchronized(aliasedProjects) { >+ aliasedProjects.clear(); >+ //if there are no resources in non-default locations then there can't be any aliased projects >+ if (nonDefaultResourceCount <= 0) >+ return; >+ //for every resource that overlaps another, marked its project as aliased >+ addToCollection.setCollection(aliasedProjects); >+ locationsMap.overLappingResourcesDo(addToCollection); >+ } > } > > /** >@@ -423,12 +427,14 @@ > if (hasNoAliases(resource)) > return null; > >- aliases.clear(); >- internalComputeAliases(resource, location); >- int size = aliases.size(); >- if (size == 0) >- return null; >- return (IResource[]) aliases.toArray(new IResource[size]); >+ synchronized(aliases) { >+ aliases.clear(); >+ internalComputeAliases(resource, location); >+ int size = aliases.size(); >+ if (size == 0) >+ return null; >+ return (IResource[]) aliases.toArray(new IResource[size]); >+ } > } > > /** >@@ -442,22 +448,25 @@ > //get the normal aliases (resources rooted in parent locations) > internalComputeAliases(resource, location); > //get all resources rooted below this resource's location >- addToCollection.setCollection(aliases); >- locationsMap.matchingPrefixDo(location, addToCollection); >- //if this is a project, get all resources rooted below links in this project >- if (resource.getType() == IResource.PROJECT) { >- try { >- IResource[] members = ((IProject) resource).members(); >- final FileSystemResourceManager localManager = workspace.getFileSystemManager(); >- for (int i = 0; i < members.length; i++) { >- if (members[i].isLinked()) { >- IFileStore linkLocation = localManager.getStore(members[i]); >- if (linkLocation != null) >- locationsMap.matchingPrefixDo(linkLocation, addToCollection); >+ synchronized(aliases) { >+ addToCollection.setCollection(aliases); >+ >+ locationsMap.matchingPrefixDo(location, addToCollection); >+ //if this is a project, get all resources rooted below links in this project >+ if (resource.getType() == IResource.PROJECT) { >+ try { >+ IResource[] members = ((IProject) resource).members(); >+ final FileSystemResourceManager localManager = workspace.getFileSystemManager(); >+ for (int i = 0; i < members.length; i++) { >+ if (members[i].isLinked()) { >+ IFileStore linkLocation = localManager.getStore(members[i]); >+ if (linkLocation != null) >+ locationsMap.matchingPrefixDo(linkLocation, addToCollection); >+ } > } >+ } catch (CoreException e) { >+ //skip inaccessible projects > } >- } catch (CoreException e) { >- //skip inaccessible projects > } > } > } >@@ -565,14 +574,16 @@ > //check if we're in an aliased project or workspace before updating structure changes. In the > //deletion case, we need to know if the resource was in an aliased project *before* deletion. > IProject project = resource.getProject(); >- boolean noAliases = !aliasedProjects.contains(project); >- >- //now update any structure changes and check again if an update is needed >- if (hasStructureChanges()) { >- updateStructureChanges(); >- noAliases &= nonDefaultResourceCount <= 0 || !aliasedProjects.contains(project); >+ synchronized (aliasedProjects) { >+ boolean noAliases = !aliasedProjects.contains(project); >+ >+ //now update any structure changes and check again if an update is needed >+ if (hasStructureChanges()) { >+ updateStructureChanges(); >+ noAliases &= nonDefaultResourceCount <= 0 || !aliasedProjects.contains(project); >+ } >+ return noAliases; > } >- return noAliases; > } > > /** >@@ -656,23 +667,25 @@ > public void updateAliases(IResource resource, IFileStore location, int depth, IProgressMonitor monitor) throws CoreException { > if (hasNoAliases(resource)) > return; >- aliases.clear(); >- if (depth == IResource.DEPTH_ZERO) >- internalComputeAliases(resource, location); >- else >- computeDeepAliases(resource, location); >- if (aliases.size() == 0) >- return; >- FileSystemResourceManager localManager = workspace.getFileSystemManager(); >- for (Iterator it = aliases.iterator(); it.hasNext();) { >- IResource alias = (IResource) it.next(); >- monitor.subTask(NLS.bind(Messages.links_updatingDuplicate, alias.getFullPath())); >- if (alias.getType() == IResource.PROJECT) { >- if (checkDeletion((Project) alias, location)) >- continue; >- //project did not require deletion, so fall through below and refresh it >+ synchronized(aliases) { >+ aliases.clear(); >+ if (depth == IResource.DEPTH_ZERO) >+ internalComputeAliases(resource, location); >+ else >+ computeDeepAliases(resource, location); >+ if (aliases.size() == 0) >+ return; >+ FileSystemResourceManager localManager = workspace.getFileSystemManager(); >+ for (Iterator it = aliases.iterator(); it.hasNext();) { >+ IResource alias = (IResource) it.next(); >+ monitor.subTask(NLS.bind(Messages.links_updatingDuplicate, alias.getFullPath())); >+ if (alias.getType() == IResource.PROJECT) { >+ if (checkDeletion((Project) alias, location)) >+ continue; >+ //project did not require deletion, so fall through below and refresh it >+ } >+ localManager.refresh(alias, IResource.DEPTH_INFINITE, false, null); > } >- localManager.refresh(alias, IResource.DEPTH_INFINITE, false, null); > } > } >
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 229633
:
98169
|
98403
|
111561
|
111564
|
111596
|
111692
|
112305
|
115153
|
115154
|
115486
|
115544
|
115724
|
116049
|
116054