11/*******************************************************************************
2- * Copyright (c) 2000, 2009 IBM Corporation and others.
2+ * Copyright (c) 2000, 2010 IBM Corporation and others.
33 * All rights reserved. This program and the accompanying materials
44 * are made available under the terms of the Eclipse Public License v1.0
55 * which accompanies this distribution, and is available at
@@ -238,7 +238,7 @@ public IStatus checkCopyRequirements(IPath destination, int destinationType, int
238238 checkAccessibleAndLocal (DEPTH_INFINITE );
239239
240240 IPath destinationParent = destination .removeLastSegments (1 );
241- checkValidGroupContainer (destinationParent , isLinked (), isGroup ());
241+ checkValidGroupContainer (destinationParent , isLinked (), isVirtual ());
242242
243243 Resource dest = workspace .newResource (destination , destinationType );
244244 dest .checkDoesNotExist ();
@@ -269,7 +269,7 @@ public IStatus checkCopyRequirements(IPath destination, int destinationType, int
269269 throw new ResourceException (IResourceStatus .FAILED_READ_LOCAL , getFullPath (), message , null );
270270 }
271271 URI destLocation = dest .getLocationURI ();
272- if (destLocation == null && (dest .isUnderGroup () == false )) {
272+ if (destLocation == null && (dest .isUnderVirtual () == false )) {
273273 message = NLS .bind (Messages .localstore_locationUndefined , dest .getFullPath ());
274274 throw new ResourceException (IResourceStatus .FAILED_READ_LOCAL , dest .getFullPath (), message , null );
275275 }
@@ -371,7 +371,7 @@ protected IStatus checkMoveRequirements(IPath destination, int destinationType,
371371 checkAccessibleAndLocal (DEPTH_INFINITE );
372372
373373 IPath destinationParent = destination .removeLastSegments (1 );
374- checkValidGroupContainer (destinationParent , isLinked (), isGroup ());
374+ checkValidGroupContainer (destinationParent , isLinked (), isVirtual ());
375375
376376 Resource dest = workspace .newResource (destination , destinationType );
377377
@@ -406,7 +406,7 @@ protected IStatus checkMoveRequirements(IPath destination, int destinationType,
406406 throw new ResourceException (IResourceStatus .FAILED_READ_LOCAL , getFullPath (), message , null );
407407 }
408408 URI destLocation = dest .getLocationURI ();
409- if (destLocation == null && (dest .isUnderGroup () == false )) {
409+ if (destLocation == null && (dest .isUnderVirtual () == false )) {
410410 message = NLS .bind (Messages .localstore_locationUndefined , dest .getFullPath ());
411411 throw new ResourceException (IResourceStatus .FAILED_READ_LOCAL , dest .getFullPath (), message , null );
412412 }
@@ -444,7 +444,7 @@ public void checkValidGroupContainer(IPath destination, boolean isLink, boolean
444444 String message = Messages .group_invalidParent ;
445445 ResourceInfo info = workspace .getResourceInfo (destination , false ,
446446 false );
447- if (info != null && info .isSet (M_GROUP ))
447+ if (info != null && info .isSet (M_VIRTUAL ))
448448 throw new ResourceException (new ResourceStatus (
449449 IResourceStatus .INVALID_VALUE , null , message ));
450450 }
@@ -460,7 +460,7 @@ public void checkValidGroupContainer(IPath destination, boolean isLink, boolean
460460 public void checkValidGroupContainer (Container destination , boolean isLink , boolean isGroup ) throws CoreException {
461461 if (!isLink && !isGroup ) {
462462 String message = Messages .group_invalidParent ;
463- if (destination .isGroup ())
463+ if (destination .isVirtual ())
464464 throw new ResourceException (new ResourceStatus (IResourceStatus .INVALID_VALUE , null , message ));
465465 }
466466 }
@@ -469,7 +469,7 @@ public IStatus getValidGroupContainer(IPath destination, boolean isLink, boolean
469469 if (!isLink && !isGroup ) {
470470 String message = Messages .group_invalidParent ;
471471 ResourceInfo info = workspace .getResourceInfo (destination , false , false );
472- if (info .isSet (M_GROUP ))
472+ if (info .isSet (M_VIRTUAL ))
473473 return new ResourceStatus (IResourceStatus .INVALID_VALUE , null , message );
474474 }
475475 return Status .OK_STATUS ;
@@ -667,7 +667,7 @@ public void createLink(URI localLocation, int updateFlags, IProgressMonitor moni
667667 localLocation = FileUtil .canonicalURI (localLocation );
668668 LinkDescription linkDescription = new LinkDescription (this , localLocation );
669669 if (linkDescription .isGroup ())
670- info .set (M_GROUP );
670+ info .set (M_VIRTUAL );
671671 getLocalManager ().link (this , localLocation , fileInfo );
672672 monitor .worked (Policy .opWork * 5 / 100 );
673673 //save the location in the project description
@@ -1156,7 +1156,7 @@ private String findVariant(String target, String[] list) {
11561156 protected void fixupAfterMoveSource () throws CoreException {
11571157 ResourceInfo info = getResourceInfo (true , true );
11581158 //if a linked resource is moved, we need to remove the location info from the .project
1159- if (isLinked () || isGroup ()) {
1159+ if (isLinked () || isVirtual ()) {
11601160 Project project = (Project ) getProject ();
11611161 if (project .internalGetDescription ().setLinkLocation (getProjectRelativePath (), null ))
11621162 project .writeDescription (IResource .NONE );
@@ -1220,7 +1220,7 @@ public FileSystemResourceManager getLocalManager() {
12201220 */
12211221 public long getLocalTimeStamp () {
12221222 ResourceInfo info = getResourceInfo (false , false );
1223- return (info == null || isGroup ()) ? IResource .NULL_STAMP : info .getLocalSyncInfo ();
1223+ return (info == null || isVirtual ()) ? IResource .NULL_STAMP : info .getLocalSyncInfo ();
12241224 }
12251225
12261226 /* (non-Javadoc)
@@ -1338,7 +1338,7 @@ public URI getRawLocationURI() {
13381338 * @see IResource#getResourceAttributes()
13391339 */
13401340 public ResourceAttributes getResourceAttributes () {
1341- if (!isAccessible () || isGroup ())
1341+ if (!isAccessible () || isVirtual ())
13421342 return null ;
13431343 return getLocalManager ().attributes (this );
13441344 }
@@ -1526,13 +1526,25 @@ public boolean isLinked(int options) {
15261526 return info != null && info .isSet (M_LINK );
15271527 }
15281528
1529- /*
1530- * (non-Javadoc)
1531- * @see IResource#isGroup()
1529+ /* (non-Javadoc)
1530+ * @see org.eclipse.core.resources.IResource#isVirtual()
15321531 */
1533- public boolean isGroup () {
1532+ public boolean isVirtual () {
15341533 ResourceInfo info = getResourceInfo (false , false );
1535- return info != null && info .isSet (M_GROUP );
1534+ return info != null && info .isSet (M_VIRTUAL );
1535+ }
1536+
1537+ /*
1538+ * @return whether the current resource has a parent that is virtual.
1539+ */
1540+ public boolean isUnderVirtual () {
1541+ IContainer parent = getParent ();
1542+ while (parent != null ) {
1543+ if (parent .isVirtual ())
1544+ return true ;
1545+ parent = parent .getParent ();
1546+ }
1547+ return false ;
15361548 }
15371549
15381550 /* (non-Javadoc)
@@ -2122,7 +2134,7 @@ private void broadcastPreMoveEvent(final IResource destination, int updateFlags)
21222134 case IResource .FOLDER :
21232135 if (isLinked ())
21242136 workspace .broadcastEvent (LifecycleEvent .newEvent (LifecycleEvent .PRE_LINK_MOVE , this , destination , updateFlags ));
2125- if (isGroup ())
2137+ if (isVirtual ())
21262138 workspace .broadcastEvent (LifecycleEvent .newEvent (LifecycleEvent .PRE_GROUP_MOVE , this , destination , updateFlags ));
21272139 break ;
21282140 case IResource .PROJECT :
@@ -2288,18 +2300,4 @@ public void setLinkLocation(IPath location, int updateFlags, IProgressMonitor mo
22882300 setLinkLocation (URIUtil .toURI (location .toPortableString ()), updateFlags , monitor );
22892301 }
22902302 }
2291-
2292- /*
2293- * @return whether the current resource has a parent that is a group.
2294- *
2295- */
2296- public boolean isUnderGroup () {
2297- IContainer parent = getParent ();
2298- while (parent != null ) {
2299- if (parent .isGroup ())
2300- return true ;
2301- parent = parent .getParent ();
2302- }
2303- return false ;
2304- }
23052303}
0 commit comments