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 125669 Details for
Bug 264878
Implement groups using a linked resource with special location
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
patch.txt (text/plain), 55.75 KB, created by
John Arthorne
on 2009-02-13 13:29:51 EST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
John Arthorne
Created:
2009-02-13 13:29:51 EST
Size:
55.75 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.core.resources >Index: src/org/eclipse/core/internal/localstore/DeleteVisitor.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/DeleteVisitor.java,v >retrieving revision 1.37 >diff -u -r1.37 DeleteVisitor.java >--- src/org/eclipse/core/internal/localstore/DeleteVisitor.java 28 Mar 2007 22:02:19 -0000 1.37 >+++ src/org/eclipse/core/internal/localstore/DeleteVisitor.java 13 Feb 2009 18:25:33 -0000 >@@ -105,7 +105,7 @@ > private void recursiveKeepHistory(IHistoryStore store, UnifiedTreeNode node) { > final IResource target = node.getResource(); > //we don't delete linked content, so no need to keep history >- if (target.isLinked() || node.isSymbolicLink()) >+ if (target.isLinked() || target.isGroup() || node.isSymbolicLink()) > return; > if (node.isFolder()) { > monitor.subTask(NLS.bind(Messages.localstore_deleting, target.getFullPath())); >Index: src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java,v >retrieving revision 1.117 >diff -u -r1.117 FileSystemResourceManager.java >--- src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java 2 Jan 2009 15:59:16 -0000 1.117 >+++ src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java 13 Feb 2009 18:25:33 -0000 >@@ -12,14 +12,11 @@ > *******************************************************************************/ > package org.eclipse.core.internal.localstore; > >-import java.net.URISyntaxException; >- >-import org.eclipse.core.filesystem.URIUtil; >- > import java.io.*; > import java.net.URI; > import java.util.*; > import org.eclipse.core.filesystem.*; >+import org.eclipse.core.filesystem.URIUtil; > import org.eclipse.core.internal.resources.*; > import org.eclipse.core.internal.resources.File; > import org.eclipse.core.internal.utils.*; >@@ -159,8 +156,7 @@ > //replace the path in the list with the appropriate resource type > IResource resource = resourceFor((IPath) result.get(i), files); > >- if (resource == null || (((memberFlags & IContainer.INCLUDE_HIDDEN) == 0) && resource.isHidden(IResource.CHECK_ANCESTORS)) >- || (((memberFlags & IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS) == 0) && resource.isTeamPrivateMember(IResource.CHECK_ANCESTORS))) >+ if (resource == null || (((memberFlags & IContainer.INCLUDE_HIDDEN) == 0) && resource.isHidden(IResource.CHECK_ANCESTORS)) || (((memberFlags & IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS) == 0) && resource.isTeamPrivateMember(IResource.CHECK_ANCESTORS))) > resource = null; > > result.set(i, resource); >@@ -426,12 +422,9 @@ > if (root != null && root.isValid()) > return root; > if (info.isSet(ICoreConstants.M_GROUP)) { >- ProjectDescription description = ((Project) target.getProject()) >- .internalGetDescription(); >+ ProjectDescription description = ((Project) target.getProject()).internalGetDescription(); > if (description != null) { >- setLocation(target, info, description >- .getGroupLocationURI(target >- .getProjectRelativePath())); >+ setLocation(target, info, description.getGroupLocationURI(target.getProjectRelativePath())); > return info.getFileStoreRoot(); > } > return info.getFileStoreRoot(); >@@ -622,23 +615,6 @@ > updateLocalSync(info, lastModified); > } > >- public void group(Resource target) { >- URI virtualLocation; >- try { >- virtualLocation = FileUtil.canonicalURI(new URI("group")); //$NON-NLS-1$ >- IFileStore store = initializeStore(target, virtualLocation); >- ResourceInfo info = target.getResourceInfo(false, true); >- long lastModified = store.fetchInfo().getLastModified(); >- if (lastModified == 0) >- info.clearModificationStamp(); >- updateLocalSync(info, lastModified); >- } catch (URISyntaxException e) { >- // can't happen >- } catch (CoreException e) { >- // can't happen >- } >- } >- > /** > * Returns the resolved, absolute file system location of the given resource. > * Returns null if the location could not be resolved. >@@ -933,10 +909,7 @@ > if (localSyncInfo == I_NULL_SYNC_INFO) > info.clear(M_LOCAL_EXISTS); > else { >- if (!info.isSet(M_GROUP)) >- info.set(M_LOCAL_EXISTS); >- else >- info.clear(M_LOCAL_EXISTS); >+ info.set(M_LOCAL_EXISTS); > } > } > >Index: src/org/eclipse/core/internal/localstore/CopyVisitor.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/CopyVisitor.java,v >retrieving revision 1.48 >diff -u -r1.48 CopyVisitor.java >--- src/org/eclipse/core/internal/localstore/CopyVisitor.java 29 Jan 2009 21:12:29 -0000 1.48 >+++ src/org/eclipse/core/internal/localstore/CopyVisitor.java 13 Feb 2009 18:25:33 -0000 >@@ -59,7 +59,7 @@ > private FileSystemResourceManager localManager; > > public CopyVisitor(IResource rootSource, IResource destination, int updateFlags, IProgressMonitor monitor) { >- this.localManager = ((Resource)rootSource).getLocalManager(); >+ this.localManager = ((Resource) rootSource).getLocalManager(); > this.rootDestination = destination; > this.updateFlags = updateFlags; > this.isDeep = (updateFlags & IResource.SHALLOW) == 0; >@@ -80,21 +80,20 @@ > > protected boolean copyContents(UnifiedTreeNode node, Resource source, Resource destination) { > try { >+ if (source.isGroup()) { >+ ((Folder) destination).createGroup(updateFlags & IResource.ALLOW_MISSING_LOCAL, null); >+ return true; >+ } > if ((!isDeep || source.isUnderGroup()) && source.isLinked()) { > URI sourceLocationURI = getWorkspace().transferVariableDefinition(source, destination, source.getRawLocationURI()); > destination.createLink(sourceLocationURI, updateFlags & IResource.ALLOW_MISSING_LOCAL, null); > return false; > } >- if (source.isGroup()) { >- ((Folder) destination).createGroup(updateFlags >- & IResource.ALLOW_MISSING_LOCAL, null); >- return true; >- } > // update filters in project descriptions > if (source.hasFilters()) { > Project sourceProject = (Project) source.getProject(); >- LinkedList/*<FilterDescription>*/ originalDescriptions = sourceProject.internalGetDescription().getFilter(source.getProjectRelativePath()); >- LinkedList/*<FilterDescription>*/ filterDescriptions = FilterDescription.copy(originalDescriptions, destination.getProjectRelativePath()); >+ LinkedList/*<FilterDescription>*/originalDescriptions = sourceProject.internalGetDescription().getFilter(source.getProjectRelativePath()); >+ LinkedList/*<FilterDescription>*/filterDescriptions = FilterDescription.copy(originalDescriptions, destination.getProjectRelativePath()); > Project project = (Project) destination.getProject(); > project.internalGetDescription().setFilters(destination.getProjectRelativePath(), filterDescriptions); > project.writeDescription(updateFlags); >@@ -129,7 +128,7 @@ > > protected Resource getDestinationResource(Resource source, IPath suffix) { > if (suffix.segmentCount() == 0) >- return (Resource)rootDestination; >+ return (Resource) rootDestination; > IPath destinationPath = rootDestination.getFullPath().append(suffix); > return getWorkspace().newResource(destinationPath, source.getType()); > } >Index: src/org/eclipse/core/internal/resources/Project.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Project.java,v >retrieving revision 1.154 >diff -u -r1.154 Project.java >--- src/org/eclipse/core/internal/resources/Project.java 2 Jan 2009 15:59:16 -0000 1.154 >+++ src/org/eclipse/core/internal/resources/Project.java 13 Feb 2009 18:25:33 -0000 >@@ -31,7 +31,7 @@ > super(path, container); > pathVariableManager = new ProjectPathVariableManager(this); > } >- >+ > protected void assertCreateRequirements(IProjectDescription description) throws CoreException { > checkDoesNotExist(); > checkDescription(this, description, false); >@@ -230,29 +230,29 @@ > public void create(IProgressMonitor monitor) throws CoreException { > create(null, monitor); > } >- >+ > /* (non-Javadoc) > * @see IProject#create(IProjectDescription, IProgressMonitor) > */ > public void create(IProjectDescription description, IProgressMonitor monitor) throws CoreException { > create(description, IResource.NONE, monitor); > } >- >+ > /* (non-Javadoc) > * @see IProject#create(IProjectDescription, IProgressMonitor) > */ >- public void create(IProjectDescription description, int updateFlags, IProgressMonitor monitor) throws CoreException { >+ public void create(IProjectDescription description, int updateFlags, IProgressMonitor monitor) throws CoreException { > monitor = Policy.monitorFor(monitor); > try { > monitor.beginTask(Messages.resources_create, Policy.totalWork); > checkValidPath(path, PROJECT, false); > final ISchedulingRule rule = workspace.getRuleFactory().createRule(this); > try { >- workspace.prepareOperation(rule, monitor); >+ workspace.prepareOperation(rule, monitor); > if (description == null) { > description = new ProjectDescription(); > description.setName(getName()); >- } >+ } > assertCreateRequirements(description); > workspace.broadcastEvent(LifecycleEvent.newEvent(LifecycleEvent.PRE_PROJECT_CREATE, this)); > workspace.beginOperation(true); >@@ -329,7 +329,7 @@ > clearHistory(null); > } > >- protected void fixupAfterMoveSource() throws CoreException { >+ protected void fixupAfterMoveSource() throws CoreException { > workspace.deleteResource(this); > // check if we deleted a preferences file > ProjectPreferences.deleted(this); >@@ -739,7 +739,7 @@ > public boolean isLinked(int options) { > return false;//projects are never linked > } >- >+ > public boolean isGroup() { > return false;// projects are never groups > } >@@ -898,7 +898,7 @@ > // the M_USED flag is used to indicate the difference between opening a project > // for the first time and opening it from a previous close (restoring it from disk) > boolean used = info.isSet(M_USED); >- boolean minorIssuesDuringRestore = false; >+ boolean minorIssuesDuringRestore = false; > if (used) { > minorIssuesDuringRestore = workspace.getSaveManager().restore(this, Policy.subMonitorFor(monitor, Policy.opWork * 20 / 100)); > } else { >@@ -953,7 +953,6 @@ > */ > public IStatus reconcileLinksAndGroups(ProjectDescription newDescription) { > String msg = Messages.links_errorLinkReconcile; >- HashMap newGroups = newDescription.getGroups(); > HashMap newLinks = newDescription.getLinks(); > MultiStatus status = new MultiStatus(ResourcesPlugin.PI_RESOURCES, IResourceStatus.OPERATION_FAILED, msg, null); > //walk over old linked resources and remove those that are no longer defined >@@ -981,53 +980,19 @@ > } > } > } >- HashMap oldGroups = oldDescription.getGroups(); >- if (oldGroups != null) { >- for (Iterator it = oldGroups.values().iterator(); it.hasNext();) { >- GroupDescription oldGroup = (GroupDescription) it.next(); >- Resource oldGroupResource = (Resource) findMember(oldGroup >- .getProjectRelativePath()); >- if (oldGroupResource == null || !oldGroupResource.isGroup()) >- continue; >- GroupDescription newGroup = null; >- if (newGroups != null) >- newGroup = (GroupDescription) newGroups.get(oldGroup >- .getProjectRelativePath()); >- // if the new group is missing then remove old group >- if (newGroup == null) { >- try { >- oldGroupResource.delete(IResource.NONE, null); >- // refresh the resource, because removing a group >- // can reveal a previously hidden resource in parent >- oldGroupResource.refreshLocal( >- IResource.DEPTH_INFINITE, null); >- } catch (CoreException e) { >- status.merge(e.getStatus()); >- } >- } >- } >- } > } > // walk over new links and groups and create if necessary > // Recreate them in order of the higher up in the tree hierarchy first, > // so we don't have to create intermediate directories that would turn > // out > // to be groups or link folders. >- if (newLinks == null && newGroups == null) >+ if (newLinks == null) > return status; > //sort links to avoid creating nested links before their parents > TreeSet newLinksAndGroups = new TreeSet(new Comparator() { > public int compare(Object arg0, Object arg1) { >- int numberOfSegments0; >- if (arg0 instanceof LinkDescription) >- numberOfSegments0 = ((LinkDescription) arg0).getProjectRelativePath().segmentCount(); >- else >- numberOfSegments0 = ((GroupDescription) arg0).getProjectRelativePath().segmentCount(); >- int numberOfSegments1; >- if (arg1 instanceof LinkDescription) >- numberOfSegments1 = ((LinkDescription) arg1).getProjectRelativePath().segmentCount(); >- else >- numberOfSegments1 = ((GroupDescription) arg1).getProjectRelativePath().segmentCount(); >+ int numberOfSegments0 = ((LinkDescription) arg0).getProjectRelativePath().segmentCount(); >+ int numberOfSegments1 = ((LinkDescription) arg1).getProjectRelativePath().segmentCount(); > if (numberOfSegments0 != numberOfSegments1) > return numberOfSegments0 - numberOfSegments1; > else if (arg0.equals(arg1)) >@@ -1039,38 +1004,21 @@ > }); > if (newLinks != null) > newLinksAndGroups.addAll(newLinks.values()); >- if (newGroups != null) >- newLinksAndGroups.addAll(newGroups.values()); > > for (Iterator it = newLinksAndGroups.iterator(); it.hasNext();) { > Object description = it.next(); >- if (description instanceof LinkDescription) { >- LinkDescription newLink = (LinkDescription) description; >- try { >- Resource toLink = workspace.newResource(getFullPath().append(newLink.getProjectRelativePath()), newLink.getType()); >- IContainer parent = toLink.getParent(); >- if (parent != null && !parent.exists() && parent.getType() == FOLDER) >- ((Folder) parent).ensureExists(Policy.monitorFor(null)); >- toLink.createLink(newLink.getLocationURI(), IResource.REPLACE | IResource.ALLOW_MISSING_LOCAL, >- null); >- } catch (CoreException e) { >- status.merge(e.getStatus()); >- } >- } else { >- GroupDescription newGroup = (GroupDescription) description; >- try { >- Resource toGroup = workspace.newResource(getFullPath() >- .append(newGroup.getProjectRelativePath()), >- IResource.FOLDER); >- IContainer parent = toGroup.getParent(); >- if (parent != null && !parent.exists() >- && parent.getType() == FOLDER) >- ((Folder) parent).ensureExists(Policy.monitorFor(null)); >- ((Folder) toGroup).createGroup(IResource.REPLACE >- | IResource.ALLOW_MISSING_LOCAL, null); >- } catch (CoreException e) { >- status.merge(e.getStatus()); >- } >+ LinkDescription newLink = (LinkDescription) description; >+ try { >+ Resource toLink = workspace.newResource(getFullPath().append(newLink.getProjectRelativePath()), newLink.getType()); >+ IContainer parent = toLink.getParent(); >+ if (parent != null && !parent.exists() && parent.getType() == FOLDER) >+ ((Folder) parent).ensureExists(Policy.monitorFor(null)); >+ if (newLink.isGroup()) >+ ((Folder) toLink).createGroup(IResource.REPLACE | IResource.ALLOW_MISSING_LOCAL, null); >+ else >+ toLink.createLink(newLink.getLocationURI(), IResource.REPLACE | IResource.ALLOW_MISSING_LOCAL, null); >+ } catch (CoreException e) { >+ status.merge(e.getStatus()); > } > } > return status; >@@ -1090,7 +1038,7 @@ > if ((updateFlags & IResource.AVOID_NATURE_CONFIG) != 0) > rule = workspace.getRuleFactory().modifyRule(this); > else >- rule = workspace.getRoot(); >+ rule = workspace.getRoot(); > try { > //need to use root rule because nature configuration calls third party code > workspace.prepareOperation(rule, monitor); >Index: src/org/eclipse/core/internal/resources/Workspace.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Workspace.java,v >retrieving revision 1.223 >diff -u -r1.223 Workspace.java >--- src/org/eclipse/core/internal/resources/Workspace.java 29 Jan 2009 22:16:56 -0000 1.223 >+++ src/org/eclipse/core/internal/resources/Workspace.java 13 Feb 2009 18:25:34 -0000 >@@ -768,24 +768,6 @@ > newInfo.setFileStoreRoot(null); > } > >- // update group locations in project descriptions >- if (source.isGroup()) { >- GroupDescription groupDescription; >- newInfo.set(ICoreConstants.M_GROUP); >- groupDescription = new GroupDescription(destinationResource); >- if (moveResources && !movingProject) { >- if (((Project) source.getProject()) >- .internalGetDescription() >- .setGroupLocation(source.getProjectRelativePath(), null)) >- ((Project) source.getProject()).writeDescription(updateFlags); >- } >- Project project = (Project) destinationResource.getProject(); >- project.internalGetDescription().setGroupLocation( >- destinationResource.getProjectRelativePath(), >- groupDescription); >- project.writeDescription(updateFlags); >- } >- > // update filters in project descriptions > if (source.hasFilters() && source.getProject().exists()) { > Project sourceProject = (Project) source.getProject(); >Index: src/org/eclipse/core/internal/resources/GroupDescription.java >=================================================================== >RCS file: src/org/eclipse/core/internal/resources/GroupDescription.java >diff -N src/org/eclipse/core/internal/resources/GroupDescription.java >--- src/org/eclipse/core/internal/resources/GroupDescription.java 20 Jan 2009 14:47:27 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,81 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2007 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- *******************************************************************************/ >-package org.eclipse.core.internal.resources; >- >-import org.eclipse.core.runtime.IPath; >- >-import org.eclipse.core.resources.IResource; >-import org.eclipse.core.runtime.*; >- >-/** >- * Object for describing the characteristics of linked resources that are stored >- * in the project description. >- */ >-public class GroupDescription implements Comparable { >- >- /** >- * The project relative path. >- */ >- private IPath path; >- >- public GroupDescription() { >- this.path = Path.EMPTY; >- } >- >- public GroupDescription(IResource linkedResource) { >- super(); >- Assert.isNotNull(linkedResource); >- this.path = linkedResource.getProjectRelativePath(); >- } >- >- public boolean equals(Object o) { >- if (!(o.getClass() == GroupDescription.class)) >- return false; >- GroupDescription other = (GroupDescription) o; >- return path.equals(other.path); >- } >- >- /** >- * Returns the project relative path of the group. >- * >- * @return the project relative path of the group. >- */ >- public IPath getProjectRelativePath() { >- return path; >- } >- >- public int hashCode() { >- return path.hashCode(); >- } >- >- public void setPath(IPath path) { >- this.path = path; >- } >- >- /** >- * Compare group descriptions in a way that sorts them topologically by path. >- */ >- public int compareTo(Object o) { >- GroupDescription that = (GroupDescription) o; >- IPath path1 = this.getProjectRelativePath(); >- IPath path2 = that.getProjectRelativePath(); >- int count1 = path1.segmentCount(); >- int compare = count1 - path2.segmentCount(); >- if (compare != 0) >- return compare; >- for (int i = 0; i < count1; i++) { >- compare = path1.segment(i).compareTo(path2.segment(i)); >- if (compare != 0) >- return compare; >- } >- return 0; >- } >-} >Index: src/org/eclipse/core/internal/resources/Container.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Container.java,v >retrieving revision 1.47 >diff -u -r1.47 Container.java >--- src/org/eclipse/core/internal/resources/Container.java 2 Jan 2009 15:59:16 -0000 1.47 >+++ src/org/eclipse/core/internal/resources/Container.java 13 Feb 2009 18:25:33 -0000 >@@ -157,22 +157,6 @@ > return true; > } > >- public boolean isLocalOrGroup(int flags, int depth) { >- if (!super.isLocalOrGroup(flags, depth)) >- return false; >- if (depth == DEPTH_ZERO) >- return true; >- if (depth == DEPTH_ONE) >- depth = DEPTH_ZERO; >- // get the children via the workspace since we know that this >- // resource exists (it is local). >- IResource[] children = getChildren(IResource.NONE); >- for (int i = 0; i < children.length; i++) >- if (!((Resource) children[i]).isLocalOrGroup(depth)) >- return false; >- return true; >- } >- > /* (non-Javadoc) > * @see IContainer#members() > */ >Index: src/org/eclipse/core/internal/resources/Folder.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Folder.java,v >retrieving revision 1.45 >diff -u -r1.45 Folder.java >--- src/org/eclipse/core/internal/resources/Folder.java 2 Jan 2009 15:59:16 -0000 1.45 >+++ src/org/eclipse/core/internal/resources/Folder.java 13 Feb 2009 18:25:33 -0000 >@@ -11,8 +11,6 @@ > *******************************************************************************/ > package org.eclipse.core.internal.resources; > >-import org.eclipse.core.internal.events.LifecycleEvent; >- > import java.net.URI; > import org.eclipse.core.filesystem.IFileInfo; > import org.eclipse.core.filesystem.IFileStore; >@@ -128,56 +126,8 @@ > * @see org.eclipse.core.resources.IFolder#createGroup(int, > * IProgressMonitor) > */ >- public void createGroup(int updateFlags, IProgressMonitor monitor) >- throws CoreException { >- monitor = Policy.monitorFor(monitor); >- try { >- String message = NLS.bind(Messages.group_creating, getFullPath()); >- monitor.beginTask(message, Policy.totalWork); >- Policy.checkCanceled(monitor); >- checkValidPath(path, FOLDER, true); >- final ISchedulingRule rule = workspace.getRuleFactory().createRule( >- this); >- try { >- workspace.prepareOperation(rule, monitor); >- workspace.broadcastEvent(LifecycleEvent.newEvent( >- LifecycleEvent.PRE_GROUP_CREATE, this)); >- workspace.beginOperation(true); >- // replace existing resource, if applicable >- if ((updateFlags & REPLACE) != 0) { >- IResource existing = workspace.getRoot().findMember( >- getFullPath()); >- if (existing != null) >- workspace.deleteResource(existing); >- } >- ResourceInfo info = workspace.createResource(this, false); >- info.set(M_GROUP); >- getLocalManager().group(this); >- monitor.worked(Policy.opWork * 5 / 100); >- // save the location in the project description >- Project project = (Project) getProject(); >- if (project.internalGetDescription().setGroupLocation( >- getProjectRelativePath(), new GroupDescription(this))) >- project.writeDescription(IResource.NONE); >- monitor.worked(Policy.opWork * 5 / 100); >- >- // refresh to discover any new resources below this group >- // location >- if (getType() != IResource.FILE) >- refreshLocal(DEPTH_INFINITE, Policy.subMonitorFor(monitor, >- Policy.opWork * 90 / 100)); >- else >- monitor.worked(Policy.opWork * 90 / 100); >- } catch (OperationCanceledException e) { >- workspace.getWorkManager().operationCanceled(); >- throw e; >- } finally { >- workspace.endOperation(rule, true, Policy.subMonitorFor( >- monitor, Policy.endOpWork)); >- } >- } finally { >- monitor.done(); >- } >+ public void createGroup(int updateFlags, IProgressMonitor monitor) throws CoreException { >+ createLink(LinkDescription.GROUP_LOCATION, updateFlags, monitor); > } > > /** >Index: src/org/eclipse/core/internal/resources/Resource.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Resource.java,v >retrieving revision 1.168 >diff -u -r1.168 Resource.java >--- src/org/eclipse/core/internal/resources/Resource.java 2 Jan 2009 15:59:16 -0000 1.168 >+++ src/org/eclipse/core/internal/resources/Resource.java 13 Feb 2009 18:25:34 -0000 >@@ -244,7 +244,7 @@ > checkValidPath(destination, destinationType, false); > > ResourceInfo info; >- checkAccessibleAndLocalOrGroup(DEPTH_INFINITE); >+ checkAccessibleAndLocal(DEPTH_INFINITE); > > IPath destinationParent = destination.removeLastSegments(1); > checkValidGroupContainer(destinationParent, isLinked(), isGroup()); >@@ -349,22 +349,6 @@ > } > > /** >- * Checks that this resource is Accessible && (local to the given depth || is a group). >- * >- * @exception CoreException >- * if this resource is not local >- */ >- protected void checkAccessibleAndLocalOrGroup(int depth) throws CoreException { >- ResourceInfo info = getResourceInfo(false, false); >- int flags = getFlags(info); >- checkAccessible(flags); >- if (!isLocalOrGroup(flags, depth)) { >- String message = NLS.bind(Messages.resources_mustBeLocal, getFullPath()); >- throw new ResourceException(IResourceStatus.RESOURCE_NOT_LOCAL, getFullPath(), message, null); >- } >- } >- >- /** > * This method reports errors in two different ways. It can throw a > * CoreException or log a status. CoreExceptions are used according > * to the specification of the move method. Programming errors, that >@@ -393,7 +377,7 @@ > checkValidPath(destination, destinationType, false); > > ResourceInfo info; >- checkAccessibleAndLocalOrGroup(DEPTH_INFINITE); >+ checkAccessibleAndLocal(DEPTH_INFINITE); > > IPath destinationParent = destination.removeLastSegments(1); > checkValidGroupContainer(destinationParent, isLinked(), isGroup()); >@@ -683,11 +667,14 @@ > info.set(M_HIDDEN); > info.set(M_LINK); > localLocation = FileUtil.canonicalURI(localLocation); >+ LinkDescription linkDescription = new LinkDescription(this, localLocation); >+ if (linkDescription.isGroup()) >+ info.set(M_GROUP); > getLocalManager().link(this, localLocation, fileInfo); > monitor.worked(Policy.opWork * 5 / 100); > //save the location in the project description > Project project = (Project) getProject(); >- boolean changed = project.internalGetDescription().setLinkLocation(getProjectRelativePath(), new LinkDescription(this, localLocation)); >+ boolean changed = project.internalGetDescription().setLinkLocation(getProjectRelativePath(), linkDescription); > if (changed) > project.writeDescription(IResource.NONE); > monitor.worked(Policy.opWork * 5 / 100); >@@ -956,16 +943,11 @@ > getMarkerManager().removeMarkers(this, IResource.DEPTH_INFINITE); > // if this is a linked resource or contains linked resources , remove their entries from the project description > List links = findLinks(); >- List groups = findGroups(); > //pre-delete notification to internal infrastructure > if (links != null) > for (Iterator it = links.iterator(); it.hasNext();) > workspace.broadcastEvent(LifecycleEvent.newEvent(LifecycleEvent.PRE_LINK_DELETE, (IResource) it.next())); > >- if (groups != null) >- for (Iterator it = groups.iterator(); it.hasNext();) >- workspace.broadcastEvent(LifecycleEvent.newEvent(LifecycleEvent.PRE_GROUP_DELETE, (IResource) it.next())); >- > // check if we deleted a preferences file > ProjectPreferences.deleted(this); > >@@ -1004,21 +986,6 @@ > } > } > >- if ((groups != null) && (groups.size() > 0)) { >- Project project = (Project) getProject(); >- ProjectDescription description = project.internalGetDescription(); >- if (description != null) { >- description.setGroupLocation(getProjectRelativePath(), null); >- boolean wasChanged = false; >- for (Iterator it = groups.iterator(); it.hasNext();) >- wasChanged |= description.setGroupLocation(((IResource) it.next()).getProjectRelativePath(), null); >- if (wasChanged) { >- project.internalSetDescription(description, true); >- project.writeDescription(IResource.FORCE); >- } >- } >- } >- > // Delete properties after the resource is deleted from the tree. See bug 84584. > CoreException err = null; > try { >@@ -1058,30 +1025,6 @@ > } > > /* >- * Returns a list of all linked resources at or below this resource, or null if there >- * are no links. >- */ >- private List findGroups() { >- Project project = (Project) getProject(); >- ProjectDescription description = project.internalGetDescription(); >- HashMap groupMap = description.getGroups(); >- if (groupMap == null) >- return null; >- List groups = null; >- IPath myPath = getProjectRelativePath(); >- for (Iterator it = groupMap.values().iterator(); it.hasNext();) { >- GroupDescription group = (GroupDescription) it.next(); >- IPath groupPath = group.getProjectRelativePath(); >- if (myPath.isPrefixOf(groupPath)) { >- if (groups == null) >- groups = new ArrayList(); >- groups.add(workspace.newResource(project.getFullPath().append(groupPath), IResource.FOLDER)); >- } >- } >- return groups; >- } >- >- /* > * Returns a list of all filtered resources at or below this resource, or null if there > * are no links. > */ >@@ -1202,20 +1145,12 @@ > protected void fixupAfterMoveSource() throws CoreException { > ResourceInfo info = getResourceInfo(true, true); > //if a linked resource is moved, we need to remove the location info from the .project >- if (isLinked()) { >+ if (isLinked() || isGroup()) { > Project project = (Project) getProject(); > if (project.internalGetDescription().setLinkLocation(getProjectRelativePath(), null)) > project.writeDescription(IResource.NONE); > } > >- // if a group resource is moved, we need to remove the location info >- // from the .project >- if (isGroup()) { >- Project project = (Project) getProject(); >- if (project.internalGetDescription().setGroupLocation(getProjectRelativePath(), null)) >- project.writeDescription(IResource.NONE); >- } >- > List filters = findFilters(); > if ((filters != null) && (filters.size() > 0)) { > // delete resource filters >@@ -1614,10 +1549,6 @@ > return isLocal(getFlags(info), depth); > } > >- protected boolean isLocalOrGroup(int depth) { >- ResourceInfo info = getResourceInfo(false, false); >- return isLocalOrGroup(getFlags(info), depth); >- } > /** > * Note the depth parameter is intentionally ignored because > * this method is over-ridden by Container.isLocal(). >@@ -1627,11 +1558,6 @@ > return flags != NULL_FLAG && ResourceInfo.isSet(flags, M_LOCAL_EXISTS); > } > >- protected boolean isLocalOrGroup(int flags, int depth) { >- return flags != NULL_FLAG && ResourceInfo.isSet(flags, M_LOCAL_EXISTS) >- || isGroup(); >- } >- > /** > * Returns whether a resource should be included in a traversal > * based on the provided member flags. >Index: src/org/eclipse/core/internal/resources/LinkDescription.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/LinkDescription.java,v >retrieving revision 1.16 >diff -u -r1.16 LinkDescription.java >--- src/org/eclipse/core/internal/resources/LinkDescription.java 2 Jan 2009 15:59:16 -0000 1.16 >+++ src/org/eclipse/core/internal/resources/LinkDescription.java 13 Feb 2009 18:25:33 -0000 >@@ -12,6 +12,7 @@ > package org.eclipse.core.internal.resources; > > import java.net.URI; >+import java.net.URISyntaxException; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.*; > >@@ -20,6 +21,15 @@ > * in the project description. > */ > public class LinkDescription implements Comparable { >+ public static final URI GROUP_LOCATION = getGroupLocation(); >+ private static URI getGroupLocation() { >+ try { >+ return new URI("group:/group"); //$NON-NLS-1$ >+ } catch (URISyntaxException e) { >+ //cannot happen >+ return null; >+ } >+ } > > private URI localLocation; > >@@ -28,7 +38,7 @@ > */ > private IPath path; > /** >- * The resource type (IResource.FILE or IResoruce.FOLDER) >+ * The resource type (IResource.FILE or IResource.FOLDER) > */ > private int type; > >@@ -50,7 +60,7 @@ > if (!(o.getClass() == LinkDescription.class)) > return false; > LinkDescription other = (LinkDescription) o; >- return localLocation.equals(other.localLocation) && type == other.type; >+ return localLocation.equals(other.localLocation) && path.equals(other.path) && type == other.type; > } > > public URI getLocationURI() { >@@ -68,9 +78,13 @@ > public int getType() { > return type; > } >+ >+ public boolean isGroup() { >+ return localLocation.equals(GROUP_LOCATION); >+ } > > public int hashCode() { >- return type + localLocation.hashCode(); >+ return type + path.hashCode() + localLocation.hashCode(); > } > > public void setLocationURI(URI location) { >Index: src/org/eclipse/core/internal/resources/ProjectDescriptionReader.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ProjectDescriptionReader.java,v >retrieving revision 1.38 >diff -u -r1.38 ProjectDescriptionReader.java >--- src/org/eclipse/core/internal/resources/ProjectDescriptionReader.java 2 Jan 2009 15:59:16 -0000 1.38 >+++ src/org/eclipse/core/internal/resources/ProjectDescriptionReader.java 13 Feb 2009 18:25:33 -0000 >@@ -58,9 +58,6 @@ > protected static final int S_FILTER_PATH = 25; > protected static final int S_FILTER_TYPE = 26; > protected static final int S_FILTERED_RESOURCES = 27; >- protected static final int S_GROUP_RESOURCES = 28; >- protected static final int S_GROUP = 29; >- protected static final int S_GROUP_PATH = 30; > protected static final int S_VARIABLE_LIST = 31; > protected static final int S_VARIABLE = 32; > protected static final int S_VARIABLE_NAME = 33; >@@ -316,9 +313,6 @@ > case S_LINKED_RESOURCES : > endLinkedResourcesElement(elementName); > break; >- case S_GROUP : >- endGroupElement(elementName); >- break; > case S_VARIABLE : > endVariableElement(elementName); > break; >@@ -328,9 +322,6 @@ > case S_FILTERED_RESOURCES : > endFilteredResourcesElement(elementName); > break; >- case S_GROUP_RESOURCES : >- endGroupResourcesElement(elementName); >- break; > case S_VARIABLE_LIST : > endVariableListElement(elementName); > break; >@@ -398,9 +389,6 @@ > case S_FILTER_ARGUMENTS: > endFilterArguments(elementName); > break; >- case S_GROUP_PATH : >- endGroupPath(elementName); >- break; > case S_VARIABLE_NAME : > endVariableName(elementName); > break; >@@ -441,20 +429,6 @@ > * End this group of group resources and add them to the project > * description. > */ >- private void endGroupResourcesElement(String elementName) { >- if (elementName.equals(GROUP_RESOURCES)) { >- HashMap groupResources = (HashMap) objectStack.pop(); >- state = S_PROJECT_DESC; >- if (groupResources.isEmpty()) >- return; >- projectDescription.setGroupDescriptions(groupResources); >- } >- } >- >- /** >- * End this group of group resources and add them to the project >- * description. >- */ > private void endVariableListElement(String elementName) { > if (elementName.equals(VARIABLE_LIST)) { > HashMap variableList = (HashMap) objectStack.pop(); >@@ -553,28 +527,6 @@ > } > > /** >- * End a single group resource and add it to the HashMap. >- */ >- private void endGroupElement(String elementName) { >- if (elementName.equals(GROUP)) { >- state = S_GROUP_RESOURCES; >- // Pop off the link description >- GroupDescription group = (GroupDescription) objectStack.pop(); >- // Make sure that you have something reasonable >- IPath path = group.getProjectRelativePath(); >- if ((path == null) || path.segmentCount() == 0) { >- parseProblem(NLS.bind(Messages.projRead_emptyGroupName, >- elementName)); >- return; >- } >- >- // The HashMap of group resources is the next thing on the stack >- ((HashMap) objectStack.peek()).put(group.getProjectRelativePath(), >- group); >- } >- } >- >- /** > * For backwards compatibility, link locations in the local file system are represented > * in the project description under the "location" tag. > * @param elementName >@@ -699,23 +651,6 @@ > state = S_FILTER; > } > } >- >- private void endGroupPath(String elementName) { >- if (elementName.equals(NAME)) { >- IPath newPath = new Path(charBuffer.toString()); >- // objectStack has a GroupDescription on it. Set the name >- // on this GroupDescription. >- IPath oldPath = ((GroupDescription) objectStack.peek()) >- .getProjectRelativePath(); >- if (oldPath.segmentCount() != 0) { >- parseProblem(NLS.bind(Messages.projRead_badGroupName, oldPath, >- newPath)); >- } else { >- ((GroupDescription) objectStack.peek()).setPath(newPath); >- } >- state = S_GROUP; >- } >- } > > private void endVariableName(String elementName) { > if (elementName.equals(NAME)) { >@@ -871,12 +806,6 @@ > state = S_FILTERED_RESOURCES; > return; > } >- if (elementName.equals(GROUP_RESOURCES)) { >- // Push a HashMap to collect all the groups. >- objectStack.push(new HashMap()); >- state = S_GROUP_RESOURCES; >- return; >- } > if (elementName.equals(VARIABLE_LIST)) { > // Push a HashMap to collect all the variables. > objectStack.push(new HashMap()); >@@ -1007,14 +936,6 @@ > objectStack.push(new LinkDescription()); > } > break; >- case S_GROUP_RESOURCES: >- if (elementName.equals(GROUP)) { >- state = S_GROUP; >- // Push place holders for the name, type and location of >- // this link. >- objectStack.push(new GroupDescription()); >- } >- break; > case S_VARIABLE_LIST: > if (elementName.equals(VARIABLE)) { > state = S_VARIABLE; >@@ -1053,11 +974,6 @@ > state = S_FILTER_ARGUMENTS; > } > break; >- case S_GROUP: >- if (elementName.equals(NAME)) { >- state = S_GROUP_PATH; >- } >- break; > case S_VARIABLE: > if (elementName.equals(NAME)) { > state = S_VARIABLE_NAME; >Index: src/org/eclipse/core/internal/resources/ProjectDescription.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ProjectDescription.java,v >retrieving revision 1.44 >diff -u -r1.44 ProjectDescription.java >--- src/org/eclipse/core/internal/resources/ProjectDescription.java 2 Jan 2009 15:59:16 -0000 1.44 >+++ src/org/eclipse/core/internal/resources/ProjectDescription.java 13 Feb 2009 18:25:33 -0000 >@@ -12,13 +12,8 @@ > *******************************************************************************/ > package org.eclipse.core.internal.resources; > >-import java.net.URISyntaxException; >- >-import java.util.LinkedList; >- > import java.net.URI; >-import java.util.Arrays; >-import java.util.HashMap; >+import java.util.*; > import org.eclipse.core.filesystem.URIUtil; > import org.eclipse.core.internal.events.BuildCommand; > import org.eclipse.core.internal.utils.FileUtil; >@@ -59,12 +54,6 @@ > protected HashMap filterDescriptions = null; > > /** >- * Map of (IPath -> GroupDescription) pairs for each group resource in this >- * project, where IPath is the project relative path of the resource. >- */ >- protected HashMap groupDescriptions = null; >- >- /** > * Map of (String -> VariableDescription) pairs for each variable in this > * project, where String is the name of the variable. > */ >@@ -84,7 +73,6 @@ > //don't want the clone to have access to our internal link locations table or builders > clone.linkDescriptions = null; > clone.filterDescriptions = null; >- clone.groupDescriptions = null; > if (variableDescriptions != null) > clone.variableDescriptions = (HashMap) variableDescriptions.clone(); > clone.buildSpec = getBuildSpec(true); >@@ -219,16 +207,6 @@ > } > > /** >- * Returns the map of group descriptions (IPath (project relative path) -> >- * GroupDescription). Since this method is only used internally, it never >- * creates a copy. Returns null if the project does not have any group >- * resources. >- */ >- public HashMap getGroups() { >- return groupDescriptions; >- } >- >- /** > * Returns the map of variable descriptions (String (variable name) -> > * VariableDescription). Since this method is only used internally, it never > * creates a copy. Returns null if the project does not have any variables. >@@ -329,12 +307,6 @@ > if ((filterDescriptions != null) && !filterDescriptions.equals(otherFilters)) > return true; > >- HashMap otherGroups = description.getGroups(); >- if ((groupDescriptions == null) && (otherGroups != null)) >- return true; >- if ((groupDescriptions != null) && !groupDescriptions.equals(otherGroups)) >- return true; >- > HashMap otherVariables = description.getVariables(); > if ((variableDescriptions == null) && (otherVariables != null)) > return true; >@@ -410,15 +382,6 @@ > } > > /** >- * Sets the map of group descriptions (String name -> GroupDescription). >- * Since this method is only used internally, it never creates a copy. May >- * pass null if this project does not have any linked resources >- */ >- public void setGroupDescriptions(HashMap groupDescriptions) { >- this.groupDescriptions = groupDescriptions; >- } >- >- /** > * Sets the map of variable descriptions (String name -> > * VariableDescription). Since this method is only used internally, it never > * creates a copy. May pass null if this project does not have any variables >@@ -500,44 +463,6 @@ > } > > /** >- * Sets the description of a group. Setting to a description of null will >- * remove the group from the project description. >- * @return <code>true</code> if the description was actually changed, >- * <code>false</code> otherwise. >- * @since 3.5 >- */ >- public boolean setGroupLocation(IPath path, GroupDescription description) { >- HashMap tempMap = groupDescriptions; >- if (description != null) { >- // addition or modification >- if (tempMap == null) >- tempMap = new HashMap(10); >- else >- // copy on write to protect against concurrent read >- tempMap = (HashMap) tempMap.clone(); >- Object oldValue = tempMap.put(path, description); >- if (oldValue!=null && description.equals(oldValue)) { >- //not actually changed anything >- return false; >- } >- groupDescriptions = tempMap; >- } else { >- // removal >- if (tempMap == null) >- return false; >- // copy on write to protect against concurrent access >- HashMap newMap = (HashMap) tempMap.clone(); >- Object oldValue = newMap.remove(path); >- if (oldValue == null) { >- //not actually changed anything >- return false; >- } >- groupDescriptions = newMap.size() == 0 ? null : newMap; >- } >- return true; >- } >- >- /** > * Sets the description of a variable. Setting to a description of null will > * remove the variable from the project description. > * @return <code>true</code> if the description was actually changed, >@@ -644,11 +569,6 @@ > } > > public URI getGroupLocationURI(IPath projectRelativePath) { >- try { >- return new URI("group"); //$NON-NLS-1$ >- } catch (URISyntaxException e) { >- // can not happend >- } >- return null; >+ return LinkDescription.GROUP_LOCATION; > } > } >Index: src/org/eclipse/core/internal/resources/ModelObjectWriter.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ModelObjectWriter.java,v >retrieving revision 1.32 >diff -u -r1.32 ModelObjectWriter.java >--- src/org/eclipse/core/internal/resources/ModelObjectWriter.java 20 Jan 2009 14:47:27 -0000 1.32 >+++ src/org/eclipse/core/internal/resources/ModelObjectWriter.java 13 Feb 2009 18:25:33 -0000 >@@ -105,14 +105,6 @@ > writer.endTag(FILTER); > } > >- protected void write(GroupDescription description, XMLWriter writer) { >- writer.startTag(GROUP, null); >- if (description != null) { >- writer.printSimpleTag(NAME, description.getProjectRelativePath()); >- } >- writer.endTag(GROUP); >- } >- > protected void write(VariableDescription description, XMLWriter writer) { > writer.startTag(VARIABLE, null); > if (description != null) { >@@ -188,10 +180,6 @@ > write((FilterDescription) obj, writer); > return; > } >- if (obj instanceof GroupDescription) { >- write((GroupDescription) obj, writer); >- return; >- } > if (obj instanceof VariableDescription) { > write((VariableDescription) obj, writer); > return; >@@ -226,12 +214,6 @@ > Collections.sort(sorted); > write(FILTERED_RESOURCES, sorted, writer); > } >- HashMap groups = description.getGroups(); >- if (groups != null) { >- List sorted = new ArrayList(groups.values()); >- Collections.sort(sorted); >- write(GROUP_RESOURCES, sorted, writer); >- } > HashMap variables = description.getVariables(); > if (variables != null) { > List sorted = new ArrayList(variables.values()); >Index: src/org/eclipse/core/internal/resources/ResourceTree.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ResourceTree.java,v >retrieving revision 1.78 >diff -u -r1.78 ResourceTree.java >--- src/org/eclipse/core/internal/resources/ResourceTree.java 2 Jan 2009 15:59:16 -0000 1.78 >+++ src/org/eclipse/core/internal/resources/ResourceTree.java 13 Feb 2009 18:25:34 -0000 >@@ -697,8 +697,6 @@ > ((ProjectDescription) destDescription).setLinkDescriptions(destination.internalGetDescription().getLinks()); > // moving filters may have modified the description in memory > ((ProjectDescription) destDescription).setFilterDescriptions(destination.internalGetDescription().getFilters()); >- // moving group resources may have modified the description in memory >- ((ProjectDescription) destDescription).setGroupDescriptions(destination.internalGetDescription().getGroups()); > // moving variables may have modified the description in memory > ((ProjectDescription) destDescription).setVariableDescriptions(destination.internalGetDescription().getVariables()); > destination.internalSetDescription(destDescription, true); >Index: src/org/eclipse/core/internal/resources/IModelObjectConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/IModelObjectConstants.java,v >retrieving revision 1.19 >diff -u -r1.19 IModelObjectConstants.java >--- src/org/eclipse/core/internal/resources/IModelObjectConstants.java 2 Jan 2009 15:59:16 -0000 1.19 >+++ src/org/eclipse/core/internal/resources/IModelObjectConstants.java 13 Feb 2009 18:25:33 -0000 >@@ -49,8 +49,6 @@ > public static final String LINK = "link"; //$NON-NLS-1$ > public static final String FILTERED_RESOURCES = "filteredResources"; //$NON-NLS-1$ > public static final String FILTER = "filter"; //$NON-NLS-1$ >- public static final String GROUP_RESOURCES = "groupResources"; //$NON-NLS-1$ >- public static final String GROUP = "group"; //$NON-NLS-1$ > public static final String VARIABLE = "variable"; //$NON-NLS-1$ > public static final String VARIABLE_LIST = "variableList"; //$NON-NLS-1$ > } >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.resources/bundles/org.eclipse.core.resources/plugin.xml,v >retrieving revision 1.81 >diff -u -r1.81 plugin.xml >--- plugin.xml 2 Jan 2009 15:59:16 -0000 1.81 >+++ plugin.xml 13 Feb 2009 18:25:33 -0000 >@@ -221,4 +221,13 @@ > name="PARENT"> > </variableProvider> > </extension> >+ <extension >+ point="org.eclipse.core.filesystem.filesystems"> >+ <filesystem >+ scheme="group"> >+ <run >+ class="org.eclipse.core.internal.resources.GroupFileSystem"> >+ </run> >+ </filesystem> >+ </extension> > </plugin> >Index: src/org/eclipse/core/internal/resources/GroupFileSystem.java >=================================================================== >RCS file: src/org/eclipse/core/internal/resources/GroupFileSystem.java >diff -N src/org/eclipse/core/internal/resources/GroupFileSystem.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/resources/GroupFileSystem.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,31 @@ >+/******************************************************************************* >+ * Copyright (c) 2009 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.core.internal.resources; >+ >+import java.net.URI; >+import org.eclipse.core.filesystem.IFileStore; >+ >+import org.eclipse.core.filesystem.provider.FileSystem; >+ >+/** >+ * A file system for resource groups >+ */ >+public class GroupFileSystem extends FileSystem { >+ >+ public GroupFileSystem() { >+ super(); >+ } >+ >+ public IFileStore getStore(URI uri) { >+ return new GroupFileStore(uri); >+ } >+ >+} >Index: src/org/eclipse/core/internal/resources/GroupFileStore.java >=================================================================== >RCS file: src/org/eclipse/core/internal/resources/GroupFileStore.java >diff -N src/org/eclipse/core/internal/resources/GroupFileStore.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/resources/GroupFileStore.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,73 @@ >+/******************************************************************************* >+ * Copyright (c) 2009 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.core.internal.resources; >+ >+import org.eclipse.core.runtime.CoreException; >+ >+import java.io.InputStream; >+import java.net.URI; >+import org.eclipse.core.filesystem.*; >+import org.eclipse.core.filesystem.provider.FileInfo; >+import org.eclipse.core.filesystem.provider.FileStore; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.Path; >+ >+/** >+ * A file store representing a group. A group always exists and has no children. >+ */ >+public class GroupFileStore extends FileStore { >+ private final URI location; >+ >+ public GroupFileStore(URI location) { >+ this.location = location; >+ } >+ >+ public String[] childNames(int options, IProgressMonitor monitor) { >+ return FileStore.EMPTY_STRING_ARRAY; >+ } >+ >+ public IFileInfo fetchInfo(int options, IProgressMonitor monitor) { >+ FileInfo result = new FileInfo(); >+ result.setDirectory(true); >+ result.setExists(true); >+ result.setLastModified(1);//last modified of zero indicates non-existence >+ return result; >+ } >+ >+ public void delete(int options, IProgressMonitor monitor) { >+ //nothing to do - groups don't exist in any physical file system >+ } >+ >+ public IFileStore getChild(String name) { >+ return EFS.getNullFileSystem().getStore(new Path(name)); >+ } >+ >+ public String getName() { >+ return "group"; //$NON-NLS-1$ >+ } >+ >+ public IFileStore getParent() { >+ return null; >+ } >+ >+ public void move(IFileStore destination, int options, IProgressMonitor monitor) throws CoreException { >+ destination.mkdir(EFS.NONE, monitor); >+ } >+ >+ public InputStream openInputStream(int options, IProgressMonitor monitor) { >+ return null; >+ } >+ >+ public URI toURI() { >+ return location; >+ } >+ >+} >#P org.eclipse.core.tests.resources >Index: src/org/eclipse/core/tests/resources/AllTests.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/AllTests.java,v >retrieving revision 1.25 >diff -u -r1.25 AllTests.java >--- src/org/eclipse/core/tests/resources/AllTests.java 2 Jan 2009 16:02:23 -0000 1.25 >+++ src/org/eclipse/core/tests/resources/AllTests.java 13 Feb 2009 18:25:37 -0000 >@@ -27,6 +27,7 @@ > suite.addTest(CharsetTest.suite()); > suite.addTest(ContentDescriptionManagerTest.suite()); > suite.addTest(FilteredResourceTest.suite()); >+ suite.addTest(GroupResourceTest.suite()); > suite.addTest(HiddenResourceTest.suite()); > suite.addTest(IFileTest.suite()); > suite.addTest(IFolderTest.suite()); >@@ -42,7 +43,6 @@ > suite.addTest(IWorkspaceTest.suite()); > suite.addTest(LinkedResourceTest.suite()); > suite.addTest(LinkedResourceWithPathVariableTest.suite()); >- suite.addTest(GroupResourceTest.suite()); > suite.addTest(MarkerSetTest.suite()); > suite.addTest(MarkerTest.suite()); > suite.addTest(NatureTest.suite()); >Index: src/org/eclipse/core/tests/resources/GroupResourceTest.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/GroupResourceTest.java,v >retrieving revision 1.1 >diff -u -r1.1 GroupResourceTest.java >--- src/org/eclipse/core/tests/resources/GroupResourceTest.java 2 Jan 2009 16:02:23 -0000 1.1 >+++ src/org/eclipse/core/tests/resources/GroupResourceTest.java 13 Feb 2009 18:25:37 -0000 >@@ -433,7 +433,7 @@ > assertDoesNotExistInWorkspace("2.0", destination); > > try { >- existingProject.move(destination.getFullPath(), IResource.NONE, >+ existingProject.move(destination.getFullPath(), IResource.SHALLOW, > getMonitor()); > } catch (CoreException e) { > fail("2.1", e); >@@ -552,6 +552,31 @@ > assertTrue("2.1", group.isGroup()); > assertTrue("2.1", !child.isGroup()); > } >+ >+ public void testIsLocal() { >+ // create a group >+ IFolder group = nonExisting_GROUP_InExistingProject; >+ try { >+ create(group, true); >+ } catch (CoreException e) { >+ fail("1.99", e); >+ } >+ assertTrue("1.0", group.isLocal(IResource.DEPTH_INFINITE)); >+ assertTrue("1.1", group.getParent().isLocal(IResource.DEPTH_INFINITE)); >+ } >+ >+ >+ public void testIsSynchronized() { >+ // create a group >+ IFolder group = nonExisting_GROUP_InExistingProject; >+ try { >+ create(group, true); >+ } catch (CoreException e) { >+ fail("1.99", e); >+ } >+ assertTrue("1.0", group.isSynchronized(IResource.DEPTH_INFINITE)); >+ assertTrue("1.1", group.getParent().isSynchronized(IResource.DEPTH_INFINITE)); >+ } > > /** > * Specific testing of group within links.
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 264878
: 125669