1 11 package org.eclipse.core.internal.resources; 12 13 import org.eclipse.core.internal.watson.IPathRequestor; 14 import org.eclipse.core.resources.*; 15 import org.eclipse.core.runtime.IPath; 16 import org.eclipse.core.runtime.QualifiedName; 17 18 22 public class ResourceProxy implements IResourceProxy, ICoreConstants { 23 protected final Workspace workspace = (Workspace) ResourcesPlugin.getWorkspace(); 24 protected IPathRequestor requestor; 25 protected ResourceInfo info; 26 27 protected IPath fullPath; 29 protected IResource resource; 30 31 34 public long getModificationStamp() { 35 return info.getModificationStamp(); 36 } 37 38 public String getName() { 39 return requestor.requestName(); 40 } 41 42 public Object getSessionProperty(QualifiedName key) { 43 return info.getSessionProperty(key); 44 } 45 46 public int getType() { 47 return info.getType(); 48 } 49 50 53 public boolean isAccessible() { 54 int flags = info.getFlags(); 55 if (info.getType() == IResource.PROJECT) 56 return flags != NULL_FLAG && ResourceInfo.isSet(flags, M_OPEN); 57 return flags != NULL_FLAG; 58 } 59 60 63 public boolean isDerived() { 64 int flags = info.getFlags(); 65 return flags != NULL_FLAG && ResourceInfo.isSet(flags, M_DERIVED); 66 } 67 68 71 public boolean isLinked() { 72 int flags = info.getFlags(); 73 return flags != NULL_FLAG && ResourceInfo.isSet(flags, M_LINK); 74 } 75 76 79 public boolean isPhantom() { 80 int flags = info.getFlags(); 81 return flags != NULL_FLAG && ResourceInfo.isSet(flags, M_PHANTOM); 82 } 83 84 87 public boolean isTeamPrivateMember() { 88 int flags = info.getFlags(); 89 return flags != NULL_FLAG && ResourceInfo.isSet(flags, M_TEAM_PRIVATE_MEMBER); 90 } 91 92 95 public IPath requestFullPath() { 96 if (fullPath == null) 97 fullPath = requestor.requestPath(); 98 return fullPath; 99 } 100 101 104 public IResource requestResource() { 105 if (resource == null) 106 resource = workspace.newResource(requestFullPath(), info.getType()); 107 return resource; 108 } 109 110 protected void reset() { 111 fullPath = null; 112 resource = null; 113 } 114 } 115 | Popular Tags |