org.eclipse.core.internal.resources
Class Folder

java.lang.Object
  extended by org.eclipse.core.runtime.PlatformObject
      extended by org.eclipse.core.internal.resources.Resource
          extended by org.eclipse.core.internal.resources.Container
              extended by org.eclipse.core.internal.resources.Folder
All Implemented Interfaces:
java.lang.Cloneable, ICoreConstants, IPathRequestor, IContainer, IFolder, IResource, org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.jobs.ISchedulingRule

public class Folder
extends Container
implements IFolder


Field Summary
 
Fields inherited from interface org.eclipse.core.resources.IContainer
EXCLUDE_DERIVED, INCLUDE_HIDDEN, 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, BACKGROUND_REFRESH, CHECK_ANCESTORS, DEPTH_INFINITE, DEPTH_ONE, DEPTH_ZERO, DERIVED, FILE, FOLDER, FORCE, HIDDEN, KEEP_HISTORY, NEVER_DELETE_PROJECT_CONTENT, NONE, NULL_STAMP, PROJECT, REPLACE, ROOT, SHALLOW, TEAM_PRIVATE
 
Fields inherited from interface org.eclipse.core.internal.resources.ICoreConstants
CRASH_DETECTED, EMPTY_FILE_STATES, EMPTY_PROJECT_ARRAY, EMPTY_RESOURCE_ARRAY, I_NULL_SYNC_INFO, K_BUILD_LIST, M_CHILDREN_UNKNOWN, M_CONTENT_CACHE, M_DEFAULT_CONTENT_DESCRIPTION, M_DERIVED, M_HIDDEN, 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, NULL_FLAG, PREF_VERSION, PREF_VERSION_KEY, PROJECT_SEGMENT_LENGTH, REFRESH_ON_STARTUP, WORKSPACE_TREE_VERSION_1, WORKSPACE_TREE_VERSION_2
 
Method Summary
 IFile changeToFile()
           
 void create(boolean force, boolean local, org.eclipse.core.runtime.IProgressMonitor monitor)
          Creates a new folder resource as a member of this handle's parent resource.
 void create(int updateFlags, boolean local, org.eclipse.core.runtime.IProgressMonitor monitor)
          Creates a new folder resource as a member of this handle's parent resource.
 void ensureExists(org.eclipse.core.runtime.IProgressMonitor monitor)
          Ensures that this folder exists in the workspace.
 java.lang.String getDefaultCharset(boolean checkImplicit)
          Returns the default charset for resources in this container.
 int getType()
          Returns the type of this resource.
 void internalCreate(int updateFlags, boolean local, org.eclipse.core.runtime.IProgressMonitor monitor)
           
 
Methods inherited from class org.eclipse.core.internal.resources.Container
convertToPhantom, exists, findDeletedMembersWithHistory, findMember, findMember, findMember, findMember, getDefaultCharset, getFile, getFile, getFolder, getFolder, isLocal, members, members, members, setDefaultCharset, setDefaultCharset
 
Methods inherited from class org.eclipse.core.internal.resources.Resource
accept, accept, accept, accept, checkAccessible, checkCopyRequirements, checkDoesNotExist, checkExists, checkLocal, checkValidPath, clearHistory, contains, copy, copy, copy, copy, countResources, createLink, createLink, createMarker, createProxy, delete, delete, delete, deleteMarkers, deleteResource, equals, exists, exists, findExistingResourceVariant, findMarker, findMarkers, findMaxProblemSeverity, getFileExtension, getFlags, getFullPath, getLocalManager, getLocalTimeStamp, getLocation, getLocationURI, getMarker, getModificationStamp, getName, getParent, getPersistentProperties, getPersistentProperty, getProject, getProjectRelativePath, getPropertyManager, getRawLocation, getRawLocationURI, getResourceAttributes, getResourceInfo, getSessionProperties, getSessionProperty, getStore, getTypeString, getWorkspace, hashCode, isAccessible, isConflicting, isDerived, isDerived, isHidden, isHidden, isLinked, isLinked, isLocal, isPhantom, isPhantom, isReadOnly, isSynchronized, isTeamPrivateMember, isTeamPrivateMember, isUnderLink, move, move, move, move, move, refreshLocal, requestName, requestPath, revertModificationStamp, setDerived, setHidden, setLocal, setLocalTimeStamp, setPersistentProperty, setReadOnly, setResourceAttributes, setSessionProperty, setTeamPrivateMember, synchronizing, toString, touch
 
Methods inherited from class org.eclipse.core.runtime.PlatformObject
getAdapter
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.core.resources.IFolder
createLink, createLink, delete, getFile, getFolder, move
 
Methods inherited from interface org.eclipse.core.resources.IContainer
exists, findDeletedMembersWithHistory, findMember, findMember, findMember, findMember, getDefaultCharset, getFile, getFolder, members, members, members, setDefaultCharset, setDefaultCharset
 
Methods inherited from interface org.eclipse.core.resources.IResource
accept, accept, accept, accept, clearHistory, copy, copy, copy, copy, createMarker, createProxy, delete, delete, deleteMarkers, equals, exists, findMarker, findMarkers, findMaxProblemSeverity, getFileExtension, getFullPath, getLocalTimeStamp, getLocation, getLocationURI, getMarker, getModificationStamp, getName, getParent, getPersistentProperties, getPersistentProperty, getProject, getProjectRelativePath, getRawLocation, getRawLocationURI, getResourceAttributes, getSessionProperties, getSessionProperty, getWorkspace, isAccessible, isDerived, isDerived, isHidden, isHidden, isLinked, isLinked, isLocal, isPhantom, isReadOnly, isSynchronized, isTeamPrivateMember, isTeamPrivateMember, move, move, move, move, refreshLocal, revertModificationStamp, setDerived, setHidden, setLocal, setLocalTimeStamp, setPersistentProperty, setReadOnly, setResourceAttributes, 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
 

Method Detail

changeToFile

public IFile changeToFile()
                   throws org.eclipse.core.runtime.CoreException
Throws:
org.eclipse.core.runtime.CoreException

create

public void create(int updateFlags,
                   boolean local,
                   org.eclipse.core.runtime.IProgressMonitor monitor)
            throws org.eclipse.core.runtime.CoreException
Description copied from interface: IFolder
Creates a new folder resource as a member of this handle's parent resource.

The FORCE update flag controls how this method deals with cases where the workspace is not completely in sync with the local file system. If FORCE is not specified, the method will only attempt to create a directory in the local file system if there isn't one already. This option ensures there is no unintended data loss; it is the recommended setting. However, if FORCE is specified, this method will be deemed a success even if there already is a corresponding directory.

The IResource.DERIVED update flag indicates that this resource should immediately be set as a derived resource. Specifying this flag is equivalent to atomically calling IResource.setDerived(boolean) with a value of true immediately after creating the resource.

The IResource.TEAM_PRIVATE update flag indicates that this resource should immediately be set as a team private resource. Specifying this flag is equivalent to atomically calling IResource.setTeamPrivateMember(boolean) with a value of true immediately after creating the resource.

The IResource.HIDDEN update flag indicates that this resource should immediately be set as a hidden resource. Specifying this flag is equivalent to atomically calling IResource.setHidden(boolean) with a value of true immediately after creating the resource.

Update flags other than those listed above are ignored.

This method synchronizes this resource with the local file system.

This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that the folder has been added to its parent.

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

Specified by:
create in interface IFolder
Parameters:
updateFlags - bit-wise or of update flag constants (IResource.FORCE, IResource.DERIVED, and IResource.TEAM_PRIVATE)
local - a flag controlling whether or not the folder will be local after the creation
monitor - a progress monitor, or null if progress reporting is not desired
Throws:
org.eclipse.core.runtime.CoreException - if this method fails. Reasons include:
  • This resource already exists in the workspace.
  • The workspace contains a resource of a different type at the same path as this resource.
  • The parent of this resource does not exist.
  • The parent of this resource is a project that is not open.
  • The parent contains a resource of a different type at the same path as this resource.
  • The name of this resource is not valid (according to IWorkspace.validateName).
  • The corresponding location in the local file system is occupied by a file (as opposed to a directory).
  • The corresponding location in the local file system is occupied by a folder and FORCE is not specified.
  • Resource changes are disallowed during certain types of resource change event notification. See IResourceChangeEvent for more details.
See Also:
IResourceRuleFactory.createRule(IResource)

create

public void create(boolean force,
                   boolean local,
                   org.eclipse.core.runtime.IProgressMonitor monitor)
            throws org.eclipse.core.runtime.CoreException
Description copied from interface: IFolder
Creates a new folder resource as a member of this handle's parent resource.

This is a convenience method, fully equivalent to:

   create((force ? FORCE : IResource.NONE), local, monitor);
 

This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that the folder has been added to its parent.

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

Specified by:
create in interface IFolder
Parameters:
force - a flag controlling how to deal with resources that are not in sync with the local file system
local - a flag controlling whether or not the folder will be local after the creation
monitor - a progress monitor, or null if progress reporting is not desired
Throws:
org.eclipse.core.runtime.CoreException - if this method fails. Reasons include:
  • This resource already exists in the workspace.
  • The workspace contains a resource of a different type at the same path as this resource.
  • The parent of this resource does not exist.
  • The parent of this resource is a project that is not open.
  • The parent contains a resource of a different type at the same path as this resource.
  • The name of this resource is not valid (according to IWorkspace.validateName).
  • The corresponding location in the local file system is occupied by a file (as opposed to a directory).
  • The corresponding location in the local file system is occupied by a folder and force is false.
  • Resource changes are disallowed during certain types of resource change event notification. See IResourceChangeEvent for more details.
See Also:
IFolder.create(int,boolean,IProgressMonitor)

ensureExists

public void ensureExists(org.eclipse.core.runtime.IProgressMonitor monitor)
                  throws org.eclipse.core.runtime.CoreException
Ensures that this folder exists in the workspace. This is similar in concept to mkdirs but it does not work on projects. If this folder is created, it will be marked as being local.

Throws:
org.eclipse.core.runtime.CoreException

getDefaultCharset

public java.lang.String getDefaultCharset(boolean checkImplicit)
Description copied from interface: IContainer
Returns the default charset for resources in this container.

If checkImplicit is false, this method will return the charset defined by calling #setDefaultCharset, provided this container exists, or null otherwise.

If checkImplicit is true, this method uses the following algorithm to determine the charset to be returned:

  1. the one explicitly set by calling #setDefaultCharset (with a non-null argument) on this container, if any, and this container exists, or
  2. the parent's default charset, if this container has a parent (is not the workspace root), or
  3. the charset returned by ResourcesPlugin#getEncoding.

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 IContainer
Returns:
the name of the default charset encoding for this container, or null
See Also:
IFile.getCharset()

getType

public int getType()
Description copied from interface: IResource
Returns the type of this resource. The returned value will be one of FILE, FOLDER, PROJECT, ROOT.

This is a resource handle operation; the resource need not exist in the workspace.

Specified by:
getType in interface IResource
Specified by:
getType in class Resource
Returns:
the type of this resource
See Also:
IResource.FILE, IResource.FOLDER, IResource.PROJECT, IResource.ROOT

internalCreate

public void internalCreate(int updateFlags,
                           boolean local,
                           org.eclipse.core.runtime.IProgressMonitor monitor)
                    throws org.eclipse.core.runtime.CoreException
Throws:
org.eclipse.core.runtime.CoreException