Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.core.internal.resources
Class Container  view Container download Container.java

java.lang.Object
  extended byorg.eclipse.core.runtime.PlatformObject
      extended byorg.eclipse.core.internal.resources.Resource
          extended byorg.eclipse.core.internal.resources.Container
All Implemented Interfaces:
java.lang.Cloneable, org.eclipse.core.runtime.IAdaptable, org.eclipse.core.resources.IContainer, ICoreConstants, org.eclipse.core.resources.IResource, org.eclipse.core.runtime.jobs.ISchedulingRule
Direct Known Subclasses:
Folder, Project, WorkspaceRoot

public abstract class Container
extends Resource
implements org.eclipse.core.resources.IContainer


Field Summary
 
Fields inherited from class org.eclipse.core.internal.resources.Resource
path, workspace
 
Fields inherited from interface org.eclipse.core.resources.IContainer
INCLUDE_PHANTOMS, INCLUDE_TEAM_PRIVATE_MEMBERS
 
Fields inherited from interface org.eclipse.core.resources.IResource
ALLOW_MISSING_LOCAL, ALWAYS_DELETE_PROJECT_CONTENT, AVOID_NATURE_CONFIG, DEPTH_INFINITE, DEPTH_ONE, DEPTH_ZERO, FILE, FOLDER, FORCE, KEEP_HISTORY, NEVER_DELETE_PROJECT_CONTENT, NONE, NULL_STAMP, PROJECT, ROOT, SHALLOW
 
Fields inherited from interface org.eclipse.core.internal.resources.ICoreConstants
EMPTY_FILE_STATES, EMPTY_PROJECT_ARRAY, EMPTY_RESOURCE_ARRAY, FIRST_INTERNAL_ERROR, FIRST_INTERNAL_INFO, FIRST_INTERNAL_WARNING, I_NULL_SYNC_INFO, I_UNKNOWN_SYNC_INFO, K_BUILD_MAP, LAST_INTERNAL_ERROR, LAST_INTERNAL_INFO, LAST_INTERNAL_WARNING, M_CONTENT_CACHE, M_DEFAULT_CONTENT_DESCRIPTION, M_DERIVED, M_LINK, M_LOCAL_EXISTS, M_MARKERS_SNAP_DIRTY, M_NO_CONTENT_DESCRIPTION, M_OPEN, M_PHANTOM, M_SYNCINFO_SNAP_DIRTY, M_TEAM_PRIVATE_MEMBER, M_TYPE, M_TYPE_START, M_USED, MINIMUM_FILE_SEGMENT_LENGTH, MINIMUM_FOLDER_SEGMENT_LENGTH, MSG_EVENTS_BUILDING_0, MSG_EVENTS_ERRORS, MSG_RESOURCES_UPDATING, NULL_FLAG, OPERATION_FAILED, PROJECT_SEGMENT_LENGTH, WORKSPACE_TREE_VERSION_1, WORKSPACE_TREE_VERSION_2
 
Constructor Summary
protected Container(org.eclipse.core.runtime.IPath path, Workspace container)
           
 
Method Summary
 void convertToPhantom()
          Converts this resource and all its children into phantoms by modifying their resource infos in-place.
 boolean exists(org.eclipse.core.runtime.IPath childPath)
          Returns whether a resource of some type with the given path exists relative to this resource.
 org.eclipse.core.resources.IFile[] findDeletedMembersWithHistory(int depth, org.eclipse.core.runtime.IProgressMonitor monitor)
          Returns a list of recently deleted files inside this container that have one or more saved states in the local history.
 org.eclipse.core.resources.IResource findMember(org.eclipse.core.runtime.IPath childPath)
          Finds and returns the member resource identified by the given path in this container, or null if no such resource exists.
 org.eclipse.core.resources.IResource findMember(org.eclipse.core.runtime.IPath childPath, boolean phantom)
          Finds and returns the member resource identified by the given path in this container, or null if there is no such resource.
 org.eclipse.core.resources.IResource findMember(java.lang.String name)
          Finds and returns the member resource (project, folder, or file) with the given name in this container, or null if no such resource exists.
 org.eclipse.core.resources.IResource findMember(java.lang.String name, boolean phantom)
          Finds and returns the member resource (project, folder, or file) with the given name in this container, or null if there is no such resource.
protected  void fixupAfterMoveSource()
           
protected  org.eclipse.core.resources.IResource[] getChildren(Container parent, boolean phantom)
           
protected  org.eclipse.core.resources.IResource[] getChildren(org.eclipse.core.runtime.IPath parentPath, boolean phantom)
           
 java.lang.String getDefaultCharset()
          Returns the default charset for resources in this container.
 org.eclipse.core.resources.IFile getFile(org.eclipse.core.runtime.IPath childPath)
          Returns a handle to the file identified by the given path in this container.
 org.eclipse.core.resources.IFile getFile(java.lang.String name)
           
 org.eclipse.core.resources.IFolder getFolder(org.eclipse.core.runtime.IPath childPath)
          Returns a handle to the folder identified by the given path in this container.
 org.eclipse.core.resources.IFolder getFolder(java.lang.String name)
           
 boolean isLocal(int flags, int depth)
          Note the depth parameter is intentionally ignored because this method is over-ridden by Container.isLocal().
 org.eclipse.core.resources.IResource[] members()
          Returns a list of existing member resources (projects, folders and files) in this resource, in no particular order.
 org.eclipse.core.resources.IResource[] members(boolean phantom)
          Returns a list of all member resources (projects, folders and files) in this resource, in no particular order.
 org.eclipse.core.resources.IResource[] members(int memberFlags)
          Returns a list of all member resources (projects, folders and files) in this resource, in no particular order.
 void setDefaultCharset(java.lang.String charset)
          Sets the default charset for this container.
 void setDefaultCharset(java.lang.String newCharset, org.eclipse.core.runtime.IProgressMonitor monitor)
          Sets the default charset for this container.
 
Methods inherited from class org.eclipse.core.internal.resources.Resource
accept, accept, accept, accept, assertCopyRequirements, assertLinkRequirements, assertMoveRequirements, checkAccessible, checkCopyRequirements, checkDoesNotExist, checkDoesNotExist, checkExists, checkLocal, checkMoveRequirements, checkValidPath, clearHistory, contains, copy, copy, copy, copy, countResources, createLink, createMarker, delete, delete, delete, deleteMarkers, deleteResource, equals, exists, exists, findExistingResourceVariant, findMarker, findMarkers, getFileExtension, getFlags, getFullPath, getLocalManager, getLocalTimeStamp, getLocation, getLocationURL, getMarker, getMarkerManager, getModificationStamp, getName, getParent, getPersistentProperty, getProject, getProjectRelativePath, getPropertyManager, getRawLocation, getResourceInfo, getSessionProperty, getType, getTypeString, getWorkspace, hashCode, internalSetLocal, isAccessible, isConflicting, isDerived, isDerived, isLinked, isLocal, isPhantom, isPhantom, isReadOnly, isSynchronized, isTeamPrivateMember, isTeamPrivateMember, isUnderLink, makePathAbsolute, move, move, move, move, move, refreshLocal, setDerived, setLocal, setLocalTimeStamp, setPersistentProperty, setReadOnly, setSessionProperty, setTeamPrivateMember, synchronizing, toString, touch
 
Methods inherited from class org.eclipse.core.runtime.PlatformObject
getAdapter
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.core.resources.IContainer
getDefaultCharset
 
Methods inherited from interface org.eclipse.core.resources.IResource
accept, accept, accept, accept, clearHistory, copy, copy, copy, copy, createMarker, delete, delete, deleteMarkers, equals, exists, findMarker, findMarkers, getFileExtension, getFullPath, getLocalTimeStamp, getLocation, getMarker, getModificationStamp, getName, getParent, getPersistentProperty, getProject, getProjectRelativePath, getRawLocation, getSessionProperty, getType, getWorkspace, isAccessible, isDerived, isLinked, isLocal, isPhantom, isReadOnly, isSynchronized, isTeamPrivateMember, move, move, move, move, refreshLocal, setDerived, setLocal, setLocalTimeStamp, setPersistentProperty, setReadOnly, setSessionProperty, setTeamPrivateMember, touch
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 
Methods inherited from interface org.eclipse.core.runtime.jobs.ISchedulingRule
contains, isConflicting
 

Constructor Detail

Container

protected Container(org.eclipse.core.runtime.IPath path,
                    Workspace container)
Method Detail

convertToPhantom

public void convertToPhantom()
                      throws org.eclipse.core.runtime.CoreException
Converts this resource and all its children into phantoms by modifying their resource infos in-place.

Overrides:
convertToPhantom in class Resource

exists

public boolean exists(org.eclipse.core.runtime.IPath childPath)
Description copied from interface: org.eclipse.core.resources.IContainer
Returns whether a resource of some type with the given path exists relative to this resource. The supplied path may be absolute or relative; in either case, it is interpreted as relative to this resource. Trailing separators are ignored. If the path is empty this container is checked for existence.

Specified by:
exists in interface org.eclipse.core.resources.IContainer

findMember

public org.eclipse.core.resources.IResource findMember(java.lang.String name)
Description copied from interface: org.eclipse.core.resources.IContainer
Finds and returns the member resource (project, folder, or file) with the given name in this container, or null if no such resource exists.

N.B. Unlike the methods which traffic strictly in resource handles, this method infers the resulting resource's type from the resource existing at the calculated path in the workspace.

Specified by:
findMember in interface org.eclipse.core.resources.IContainer

findMember

public org.eclipse.core.resources.IResource findMember(java.lang.String name,
                                                       boolean phantom)
Description copied from interface: org.eclipse.core.resources.IContainer
Finds and returns the member resource (project, folder, or file) with the given name in this container, or null if there is no such resource.

If the includePhantoms argument is false, only a member resource with the given name that exists will be returned. If the includePhantoms argument is true, the method also returns a resource if the workspace is keeping track of a phantom with that name.

Note that no attempt is made to exclude team-private member resources as with members.

N.B. Unlike the methods which traffic strictly in resource handles, this method infers the resulting resource's type from the existing resource (or phantom) in the workspace.

Specified by:
findMember in interface org.eclipse.core.resources.IContainer

findMember

public org.eclipse.core.resources.IResource findMember(org.eclipse.core.runtime.IPath childPath)
Description copied from interface: org.eclipse.core.resources.IContainer
Finds and returns the member resource identified by the given path in this container, or null if no such resource exists. The supplied path may be absolute or relative; in either case, it is interpreted as relative to this resource. Trailing separators and the path's device are ignored. If the path is empty this container is returned.

Note that no attempt is made to exclude team-private member resources as with members.

N.B. Unlike the methods which traffic strictly in resource handles, this method infers the resulting resource's type from the resource existing at the calculated path in the workspace.

Specified by:
findMember in interface org.eclipse.core.resources.IContainer

findMember

public org.eclipse.core.resources.IResource findMember(org.eclipse.core.runtime.IPath childPath,
                                                       boolean phantom)
Description copied from interface: org.eclipse.core.resources.IContainer
Finds and returns the member resource identified by the given path in this container, or null if there is no such resource. The supplied path may be absolute or relative; in either case, it is interpreted as relative to this resource. Trailing separators and the path's device are ignored. If the path is empty this container is returned.

If the includePhantoms argument is false, only a resource that exists at the given path will be returned. If the includePhantoms argument is true, the method also returns a resource if the workspace is keeping track of a phantom member resource at the given path.

Note that no attempt is made to exclude team-private member resources as with members.

N.B. Unlike the methods which traffic strictly in resource handles, this method infers the resulting resource's type from the existing resource (or phantom) at the calculated path in the workspace.

Specified by:
findMember in interface org.eclipse.core.resources.IContainer

fixupAfterMoveSource

protected void fixupAfterMoveSource()
                             throws org.eclipse.core.runtime.CoreException
Overrides:
fixupAfterMoveSource in class Resource

getChildren

protected org.eclipse.core.resources.IResource[] getChildren(Container parent,
                                                             boolean phantom)

getChildren

protected org.eclipse.core.resources.IResource[] getChildren(org.eclipse.core.runtime.IPath parentPath,
                                                             boolean phantom)

getFile

public org.eclipse.core.resources.IFile getFile(java.lang.String name)

getFile

public org.eclipse.core.resources.IFile getFile(org.eclipse.core.runtime.IPath childPath)
Description copied from interface: org.eclipse.core.resources.IContainer
Returns a handle to the file identified by the given path in this container.

This is a resource handle operation; neither the resource nor the result need exist in the workspace. The validation check on the resource name/path is not done when the resource handle is constructed; rather, it is done automatically as the resource is created.

The supplied path may be absolute or relative; in either case, it is interpreted as relative to this resource and is appended to this container's full path to form the full path of the resultant resource. A trailing separator is ignored. The path of the resulting resource must have at least two segments.

Specified by:
getFile in interface org.eclipse.core.resources.IContainer

getFolder

public org.eclipse.core.resources.IFolder getFolder(java.lang.String name)

getFolder

public org.eclipse.core.resources.IFolder getFolder(org.eclipse.core.runtime.IPath childPath)
Description copied from interface: org.eclipse.core.resources.IContainer
Returns a handle to the folder identified by the given path in this container.

This is a resource handle operation; neither the resource nor the result need exist in the workspace. The validation check on the resource name/path is not done when the resource handle is constructed; rather, it is done automatically as the resource is created.

The supplied path may be absolute or relative; in either case, it is interpreted as relative to this resource and is appended to this container's full path to form the full path of the resultant resource. A trailing separator is ignored. The path of the resulting resource must have at least two segments.

Specified by:
getFolder in interface org.eclipse.core.resources.IContainer

isLocal

public boolean isLocal(int flags,
                       int depth)
Description copied from class: Resource
Note the depth parameter is intentionally ignored because this method is over-ridden by Container.isLocal().

Overrides:
isLocal in class Resource

members

public org.eclipse.core.resources.IResource[] members()
                                               throws org.eclipse.core.runtime.CoreException
Description copied from interface: org.eclipse.core.resources.IContainer
Returns a list of existing member resources (projects, folders and files) in this resource, in no particular order.

This is a convenience method, fully equivalent to members(IResource.NONE). Team-private member resources are not included in the result.

Note that the members of a project or folder are the files and folders immediately contained within it. The members of the workspace root are the projects in the workspace.

Specified by:
members in interface org.eclipse.core.resources.IContainer

members

public org.eclipse.core.resources.IResource[] members(boolean phantom)
                                               throws org.eclipse.core.runtime.CoreException
Description copied from interface: org.eclipse.core.resources.IContainer
Returns a list of all member resources (projects, folders and files) in this resource, in no particular order.

This is a convenience method, fully equivalent to:

   members(includePhantoms ? INCLUDE_PHANTOMS : IResource.NONE);
 
Team-private member resources are not included in the result.

Specified by:
members in interface org.eclipse.core.resources.IContainer

members

public org.eclipse.core.resources.IResource[] members(int memberFlags)
                                               throws org.eclipse.core.runtime.CoreException
Description copied from interface: org.eclipse.core.resources.IContainer
Returns a list of all member resources (projects, folders and files) in this resource, in no particular order.

If the INCLUDE_PHANTOMS flag is not specified in the member flags (recommended), only member resources that exist will be returned. If the INCLUDE_PHANTOMS flag is specified, the result will also include any phantom member resources the workspace is keeping track of.

If the INCLUDE_TEAM_PRIVATE_MEMBERS flag is specified in the member flags, team private members will be included along with the others. If the INCLUDE_TEAM_PRIVATE_MEMBERS flag is not specified (recommended), the result will omit any team private member resources.

Specified by:
members in interface org.eclipse.core.resources.IContainer

getDefaultCharset

public java.lang.String getDefaultCharset()
                                   throws org.eclipse.core.runtime.CoreException
Description copied from interface: org.eclipse.core.resources.IContainer
Returns the default charset for resources in this container.

This is a convenience method, fully equivalent to:

   getDefaultCharset(true);
 

Note that this method does not check whether the result is a supported charset name. Callers should be prepared to handle UnsupportedEncodingException where this charset is used.

Specified by:
getDefaultCharset in interface org.eclipse.core.resources.IContainer

findDeletedMembersWithHistory

public org.eclipse.core.resources.IFile[] findDeletedMembersWithHistory(int depth,
                                                                        org.eclipse.core.runtime.IProgressMonitor monitor)
                                                                 throws org.eclipse.core.runtime.CoreException
Description copied from interface: org.eclipse.core.resources.IContainer
Returns a list of recently deleted files inside this container that have one or more saved states in the local history. The depth parameter determines how deep inside the container to look. This resource may or may not exist in the workspace.

When applied to an existing project resource, this method returns recently deleted files with saved states in that project. Note that local history is maintained with each individual project, and gets discarded when a project is deleted from the workspace. If applied to a deleted project, this method returns the empty list.

When applied to the workspace root resource (depth infinity), this method returns all recently deleted files with saved states in all existing projects.

When applied to a folder (or project) resource (depth one), this method returns all recently deleted member files with saved states.

When applied to a folder resource (depth zero), this method returns an empty list unless there was a recently deleted file with saved states at the same path as the folder.

This method is long-running; progress and cancellation are provided by the given progress monitor.

Specified by:
findDeletedMembersWithHistory in interface org.eclipse.core.resources.IContainer

setDefaultCharset

public void setDefaultCharset(java.lang.String charset)
                       throws org.eclipse.core.runtime.CoreException
Description copied from interface: org.eclipse.core.resources.IContainer
Sets the default charset for this container. Passing a value of null will remove the default charset setting for this resource.

Specified by:
setDefaultCharset in interface org.eclipse.core.resources.IContainer

setDefaultCharset

public void setDefaultCharset(java.lang.String newCharset,
                              org.eclipse.core.runtime.IProgressMonitor monitor)
                       throws org.eclipse.core.runtime.CoreException
Description copied from interface: org.eclipse.core.resources.IContainer
Sets the default charset for this container. Passing a value of null will remove the default charset setting for this resource.

This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that the encoding of affected resources has been changed.

This method is long-running; progress and cancellation are provided by the given progress monitor.

Specified by:
setDefaultCharset in interface org.eclipse.core.resources.IContainer