Class PackageFragmentRoot
- All Implemented Interfaces:
IBufferChangedListener
,IJavaElement
,IOpenable
,IPackageFragmentRoot
,IParent
,org.eclipse.core.runtime.IAdaptable
- Direct Known Subclasses:
ExternalPackageFragmentRoot
,JarPackageFragmentRoot
- See Also:
IPackageFragmentRoot
-
Field Summary
Modifier and TypeFieldDescriptionprotected static char
The delimiter between the source path and root path in the attachment server property.static String
protected org.eclipse.core.resources.IResource
The resource associated with this root (null for external jar)Fields inherited from class org.aspectj.org.eclipse.jdt.internal.core.JavaElement
JEM_ANNOTATION, JEM_CLASSFILE, JEM_COMPILATIONUNIT, JEM_COUNT, JEM_DELIMITER_ESCAPE, JEM_ESCAPE, JEM_FIELD, JEM_IMPORTDECLARATION, JEM_INITIALIZER, JEM_JAVAPROJECT, JEM_LAMBDA_EXPRESSION, JEM_LAMBDA_METHOD, JEM_LOCALVARIABLE, JEM_METHOD, JEM_MODULAR_CLASSFILE, JEM_MODULE, JEM_PACKAGEDECLARATION, JEM_PACKAGEFRAGMENT, JEM_PACKAGEFRAGMENTROOT, JEM_STRING, JEM_TYPE, JEM_TYPE_PARAMETER, NO_ELEMENTS, NO_INFO, NO_STRINGS
Fields inherited from interface org.aspectj.org.eclipse.jdt.core.IJavaElement
ANNOTATION, CLASS_FILE, COMPILATION_UNIT, FIELD, IMPORT_CONTAINER, IMPORT_DECLARATION, INITIALIZER, JAVA_MODEL, JAVA_MODULE, JAVA_PROJECT, LOCAL_VARIABLE, METHOD, PACKAGE_DECLARATION, PACKAGE_FRAGMENT, PACKAGE_FRAGMENT_ROOT, TYPE, TYPE_PARAMETER
Fields inherited from interface org.aspectj.org.eclipse.jdt.core.IPackageFragmentRoot
DEFAULT_PACKAGEROOT_PATH, DESTINATION_PROJECT_CLASSPATH, K_BINARY, K_SOURCE, NO_RESOURCE_MODIFICATION, ORIGINATING_PROJECT_CLASSPATH, OTHER_REFERRING_PROJECTS_CLASSPATH, REPLACE
-
Constructor Summary
ModifierConstructorDescriptionprotected
PackageFragmentRoot(org.eclipse.core.resources.IResource resource, JavaProject project)
Constructs a package fragment root which is the root of the java package directory hierarchy. -
Method Summary
Modifier and TypeMethodDescriptionvoid
attachSource(org.eclipse.core.runtime.IPath sourcePath, org.eclipse.core.runtime.IPath rootPath, org.eclipse.core.runtime.IProgressMonitor monitor)
Attaches the source archive identified by the given absolute path to this binary package fragment root.protected boolean
buildStructure(OpenableElementInfo info, org.eclipse.core.runtime.IProgressMonitor pm, Map newElements, org.eclipse.core.resources.IResource underlyingResource)
Builds this element's structure and properties in the given info object, based on this element's current contents (reuse buffer contents if this element has an open buffer, or resource contents if this element does not have an open buffer).protected boolean
computeChildren(OpenableElementInfo info, org.eclipse.core.resources.IResource underlyingResource)
Compute the package fragment children of this package fragment root.protected void
computeFolderChildren(org.eclipse.core.resources.IContainer folder, boolean isIncluded, String[] pkgName, ArrayList vChildren, char[][] inclusionPatterns, char[][] exclusionPatterns)
Starting at this folder, create package fragments and add the fragments that are not excluded to the collection of children.void
copy(org.eclipse.core.runtime.IPath destination, int updateResourceFlags, int updateModelFlags, IClasspathEntry sibling, org.eclipse.core.runtime.IProgressMonitor monitor)
Copies the resource of this package fragment root to the destination path as specified byIResource.copy(IPath, int, IProgressMonitor)
but excluding nested source folders.protected Object
Returns a new element info for this element.createPackageFragment(String pkgName, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor)
Creates and returns a package fragment in this root with the given dot-separated package name.void
delete(int updateResourceFlags, int updateModelFlags, org.eclipse.core.runtime.IProgressMonitor monitor)
Deletes the resource of this package fragment root as specified byIResource.delete(int, IProgressMonitor)
but excluding nested source folders.protected int
determineKind(org.eclipse.core.resources.IResource underlyingResource)
Returns the root's kind - K_SOURCE or K_BINARY, defaults to K_SOURCE if it is not on the classpath.boolean
Compares two objects for equality; forPackageFragmentRoot
s, equality is having the same parent, same resources, and occurrence count.char[][]
char[][]
getClassFilePath(String classname)
Returns the relative path within an archive for the given class file name.Returns the name of this element.int
Returns this element's kind encoded as an integer.getHandleFromMemento(String token, MementoTokenizer memento, WorkingCopyOwner owner)
protected void
getHandleMemento(StringBuffer buff)
protected char
Returns thechar
that marks the start of this handles contribution to a memento.int
getKind()
Returns this package fragment root's kind encoded as an integer.Convenience lookup, though currently only JarPackageFragmentRoot is searched for a manifest.Returns theIModuleDescription
that this package fragment root contains.Object[]
Returns an array of non-java resources contained in the receiver.getPackageFragment(String packageName)
Returns the package fragment with the given package name.getPackageFragment(String[] pkgName)
getPackageFragment(String[] pkgName, String mod)
protected String
getPackageName(org.eclipse.core.resources.IFolder folder)
Returns the package name for the given folder (which is a decendent of this root).org.eclipse.core.runtime.IPath
getPath()
Returns the path to the innermost resource enclosing this element.Returns the first raw classpath entry that corresponds to this package fragment root.Returns the first resolved classpath entry that corresponds to this package fragment root.org.eclipse.core.runtime.IPath
Returns the absolute path to the source archive attached to this package fragment root's binary archive.org.eclipse.core.runtime.IPath
Returns the path within this package fragment root's source archive.Returns the SourceMapper facility for this element, ornull
if this element does not have a SourceMapper.org.eclipse.core.resources.IResource
Returns the smallest underlying resource that contains this element, ornull
if this element is not contained in a resource.boolean
Returns whether this element has one or more immediate children.boolean
hasCompilationUnit(String qualifiedPackageName, String moduleName)
int
hashCode()
Returns the hash code for this Java element.boolean
org.eclipse.core.runtime.IPath
boolean
Returns whether this package fragment root's underlying resource is a binary archive (a JAR or zip file).protected boolean
boolean
Returns whether this package fragment root is external to the workbench (that is, a local file), and has no underlying resource.void
move(org.eclipse.core.runtime.IPath destination, int updateResourceFlags, int updateModelFlags, IClasspathEntry sibling, org.eclipse.core.runtime.IProgressMonitor monitor)
Moves the resource of this package fragment root to the destination path as specified byIResource.move(IPath,int,IProgressMonitor)
but excluding nested source folders.org.eclipse.core.resources.IResource
resource()
org.eclipse.core.resources.IResource
resource(PackageFragmentRoot root)
void
setSourceMapper(SourceMapper mapper)
For use byAttachSourceOperation
only.protected void
toStringInfo(int tab, StringBuffer buffer, Object info, boolean showResolvedInfo)
Debugging purposesprotected org.eclipse.core.runtime.IStatus
validateExistence(org.eclipse.core.resources.IResource underlyingResource)
protected org.eclipse.core.runtime.IStatus
protected void
verifyAttachSource(org.eclipse.core.runtime.IPath sourcePath)
Possible failures: ELEMENT_NOT_PRESENT - the root supplied to the operation does not exist INVALID_ELEMENT_TYPES - the root is not of kind K_BINARY RELATIVE_PATH - the path supplied to this operation must be an absolute pathMethods inherited from class org.aspectj.org.eclipse.jdt.internal.core.Openable
bufferChanged, canBeRemovedFromCache, canBufferBeRemovedFromCache, closeBuffer, closing, codeComplete, codeSelect, exists, findRecommendedLineSeparator, generateInfos, getBuffer, getBufferFactory, getBufferManager, getCorrespondingResource, getOpenable, getPackageFragmentRoot, getResource, hasBuffer, hasUnsavedChanges, ignoreErrorStatus, isConsistent, isOpen, isSourceElement, isStructureKnown, makeConsistent, open, openAncestors, openBuffer, resourceExists, save
Methods inherited from class org.aspectj.org.eclipse.jdt.internal.core.JavaElement
appendEscapedDelimiter, close, escapeMementoName, findNode, getAncestor, getAttachedJavadoc, getChildren, getChildrenOfType, getClassFile, getCompilationUnit, getElementInfo, getElementInfo, getHandleFromMemento, getHandleIdentifier, getHandleMemento, getJavadocBaseLocation, getJavaModel, getJavaProject, getLibraryJavadocLocation, getOpenableParent, getParent, getPrimaryElement, getPrimaryElement, getSchedulingRule, getSourceElementAt, getURLContents, isAncestorOf, isReadOnly, newDoesNotExistStatus, newJavaModelException, newNotPresentException, openWhenClosed, readableName, resolved, setParent, tabString, toDebugString, toString, toString, toStringAncestors, toStringChildren, toStringInfo, toStringName, toStringWithAncestors, toStringWithAncestors, unresolved, validateAndCache
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.runtime.IAdaptable
getAdapter
Methods inherited from interface org.aspectj.org.eclipse.jdt.core.IJavaElement
exists, getAncestor, getAttachedJavadoc, getCorrespondingResource, getHandleIdentifier, getJavaModel, getJavaProject, getOpenable, getParent, getPrimaryElement, getResource, getSchedulingRule, isReadOnly, isStructureKnown
Methods inherited from interface org.aspectj.org.eclipse.jdt.core.IOpenable
close, findRecommendedLineSeparator, getBuffer, hasUnsavedChanges, isConsistent, isOpen, makeConsistent, open, save
Methods inherited from interface org.aspectj.org.eclipse.jdt.core.IParent
getChildren
-
Field Details
-
ATTACHMENT_PROPERTY_DELIMITER
protected static final char ATTACHMENT_PROPERTY_DELIMITERThe delimiter between the source path and root path in the attachment server property.- See Also:
- Constant Field Values
-
NO_SOURCE_ATTACHMENT
- See Also:
- Constant Field Values
-
resource
protected org.eclipse.core.resources.IResource resourceThe resource associated with this root (null for external jar)
-
-
Constructor Details
-
PackageFragmentRoot
Constructs a package fragment root which is the root of the java package directory hierarchy.
-
-
Method Details
-
attachSource
public void attachSource(org.eclipse.core.runtime.IPath sourcePath, org.eclipse.core.runtime.IPath rootPath, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelExceptionDescription copied from interface:IPackageFragmentRoot
Attaches the source archive identified by the given absolute path to this binary package fragment root.rootPath
specifies the location of the root within the archive or folder (empty specifies the default root andnull
specifies the root path should be detected). Once a source archive or folder is attached to the package fragment root, thegetSource
andgetSourceRange
methods become operational for binary types/members. To detach a source archive or folder from a package fragment root, specifynull
as the source path.- Specified by:
attachSource
in interfaceIPackageFragmentRoot
- Parameters:
sourcePath
- the given absolute path to the source archive or folderrootPath
- specifies the location of the root within the archive (empty specifies the default root andnull
specifies automatic detection of the root path)monitor
- the given progress monitor- Throws:
JavaModelException
- if this operation fails. Reasons include:- This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- A
CoreException
occurred while updating a server property - This package fragment root is not of kind binary (INVALID_ELEMENT_TYPES)
- The path provided is not absolute (RELATIVE_PATH)
- See Also:
IPackageFragmentRoot
-
buildStructure
protected boolean buildStructure(OpenableElementInfo info, org.eclipse.core.runtime.IProgressMonitor pm, Map newElements, org.eclipse.core.resources.IResource underlyingResource) throws JavaModelExceptionDescription copied from class:Openable
Builds this element's structure and properties in the given info object, based on this element's current contents (reuse buffer contents if this element has an open buffer, or resource contents if this element does not have an open buffer). Children are placed in the given newElements table (note, this element has already been placed in the newElements table). Returns true if successful, or false if an error is encountered while determining the structure of this element.- Specified by:
buildStructure
in classOpenable
- Throws:
JavaModelException
- See Also:
Openable
-
delete
public void delete(int updateResourceFlags, int updateModelFlags, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelExceptionDescription copied from interface:IPackageFragmentRoot
Deletes the resource of this package fragment root as specified byIResource.delete(int, IProgressMonitor)
but excluding nested source folders.If
NO_RESOURCE_MODIFICATION
is specified inupdateModelFlags
or if this package fragment root is external, this operation doesn't delete the resource.updateResourceFlags
is then ignored.If
ORIGINATING_PROJECT_CLASSPATH
is specified inupdateModelFlags
, update the raw classpath of this package fragment root's project by removing the corresponding classpath entry.If
OTHER_REFERRING_PROJECTS_CLASSPATH
is specified inupdateModelFlags
, update the raw classpaths of all other Java projects referring to this root's resource by removing the corresponding classpath entries.If no flags is specified in
updateModelFlags
(usingIResource.NONE
), the default behavior applies: the resource is deleted (if this package fragment root is not external) and no classpaths are updated.- Specified by:
delete
in interfaceIPackageFragmentRoot
- Parameters:
updateResourceFlags
- bit-wise or of update resource flag constants (IResource.FORCE
andIResource.KEEP_HISTORY
)updateModelFlags
- bit-wise or of update resource flag constants (ORIGINATING_PROJECT_CLASSPATH
,OTHER_REFERRING_PROJECTS_CLASSPATH
andNO_RESOURCE_MODIFICATION
)monitor
- a progress monitor- Throws:
JavaModelException
- if this root could not be deleted. Reasons include:- This root does not exist (ELEMENT_DOES_NOT_EXIST)
- A
CoreException
occurred while deleting the resource or updating a classpath
- See Also:
IResource.delete(boolean, IProgressMonitor)
-
computeChildren
protected boolean computeChildren(OpenableElementInfo info, org.eclipse.core.resources.IResource underlyingResource) throws JavaModelExceptionCompute the package fragment children of this package fragment root.- Throws:
JavaModelException
- The resource associated with this package fragment root does not exist
-
computeFolderChildren
protected void computeFolderChildren(org.eclipse.core.resources.IContainer folder, boolean isIncluded, String[] pkgName, ArrayList vChildren, char[][] inclusionPatterns, char[][] exclusionPatterns) throws JavaModelExceptionStarting at this folder, create package fragments and add the fragments that are not excluded to the collection of children.- Throws:
JavaModelException
- The resource associated with this package fragment does not exist
-
copy
public void copy(org.eclipse.core.runtime.IPath destination, int updateResourceFlags, int updateModelFlags, IClasspathEntry sibling, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelExceptionDescription copied from interface:IPackageFragmentRoot
Copies the resource of this package fragment root to the destination path as specified byIResource.copy(IPath, int, IProgressMonitor)
but excluding nested source folders.If
NO_RESOURCE_MODIFICATION
is specified inupdateModelFlags
or if this package fragment root is external, this operation doesn't copy the resource.updateResourceFlags
is then ignored.If
DESTINATION_PROJECT_CLASSPATH
is specified inupdateModelFlags
, updates the classpath of the destination's project (if it is a Java project). If a non-null
sibling is specified, a copy of this root's classpath entry is inserted before the sibling on the destination project's raw classpath. Ifnull
is specified, the classpath entry is added at the end of the raw classpath.If
REPLACE
is specified inupdateModelFlags
, overwrites the resource at the destination path if any. If the same classpath entry already exists on the destination project's raw classpath, then the sibling is ignored and the new classpath entry replaces the existing one.If no flags is specified in
updateModelFlags
(usingIResource.NONE
), the default behavior applies: the resource is copied (if this package fragment root is not external) and the classpath is not updated.- Specified by:
copy
in interfaceIPackageFragmentRoot
- Parameters:
destination
- the destination pathupdateResourceFlags
- bit-wise or of update resource flag constants (IResource.FORCE
andIResource.SHALLOW
)updateModelFlags
- bit-wise or of update resource flag constants (DESTINATION_PROJECT_CLASSPATH
andNO_RESOURCE_MODIFICATION
)sibling
- the classpath entry before which a copy of the classpath entry should be inserted ornull
if the classpath entry should be inserted at the endmonitor
- a progress monitor- Throws:
JavaModelException
- if this root could not be copied. Reasons include:- This root does not exist (ELEMENT_DOES_NOT_EXIST)
- A
CoreException
occurred while copying the resource or updating a classpath -
The destination is not inside an existing project and
updateModelFlags
has been specified asDESTINATION_PROJECT_CLASSPATH
(INVALID_DESTINATION) - The sibling is not a classpath entry on the destination project's raw classpath (INVALID_SIBLING)
- The same classpath entry already exists on the destination project's
classpath (NAME_COLLISION) and
updateModelFlags
has not been specified asREPLACE
- See Also:
IResource.copy(IPath, boolean, IProgressMonitor)
-
createElementInfo
Returns a new element info for this element.- Overrides:
createElementInfo
in classOpenable
-
createPackageFragment
public IPackageFragment createPackageFragment(String pkgName, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelExceptionDescription copied from interface:IPackageFragmentRoot
Creates and returns a package fragment in this root with the given dot-separated package name. An empty string specifies the default package. This has the side effect of creating all package fragments that are a prefix of the new package fragment which do not exist yet. If the package fragment already exists, this has no effect. For a description of theforce
flag, seeIFolder.create
.- Specified by:
createPackageFragment
in interfaceIPackageFragmentRoot
- Parameters:
pkgName
- the given dot-separated package nameforce
- a flag controlling how to deal with resources that are not in sync with the local file systemmonitor
- the given progress monitor- Returns:
- a package fragment in this root with the given dot-separated package name
- Throws:
JavaModelException
- if the element could not be created. Reasons include:- This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- A
CoreException
occurred while creating an underlying resource - This package fragment root is read only (READ_ONLY)
- The name is not a valid package name (INVALID_NAME)
- See Also:
IPackageFragmentRoot
-
determineKind
protected int determineKind(org.eclipse.core.resources.IResource underlyingResource) throws JavaModelExceptionReturns the root's kind - K_SOURCE or K_BINARY, defaults to K_SOURCE if it is not on the classpath.- Throws:
JavaModelException
- if the project and root do not exist.
-
equals
Compares two objects for equality; forPackageFragmentRoot
s, equality is having the same parent, same resources, and occurrence count.- Overrides:
equals
in classJavaElement
- See Also:
Object.equals(java.lang.Object)
-
fullExclusionPatternChars
public char[][] fullExclusionPatternChars() -
fullInclusionPatternChars
public char[][] fullInclusionPatternChars() -
getElementName
Description copied from interface:IJavaElement
Returns the name of this element. This is a handle-only method.- Specified by:
getElementName
in interfaceIJavaElement
- Overrides:
getElementName
in classJavaElement
- Returns:
- the element name
- See Also:
IAdaptable
-
getElementType
public int getElementType()Description copied from interface:IJavaElement
Returns this element's kind encoded as an integer. This is a handle-only method.- Specified by:
getElementType
in interfaceIJavaElement
- Returns:
- the kind of element; one of the constants declared in
IJavaElement
- See Also:
IJavaElement
-
getHandleMementoDelimiter
protected char getHandleMementoDelimiter()Description copied from class:JavaElement
Returns thechar
that marks the start of this handles contribution to a memento.- Specified by:
getHandleMementoDelimiter
in classJavaElement
- See Also:
JavaElement.getHandleMemento()
-
getHandleFromMemento
public IJavaElement getHandleFromMemento(String token, MementoTokenizer memento, WorkingCopyOwner owner)- Specified by:
getHandleFromMemento
in classJavaElement
-
getHandleMemento
- Overrides:
getHandleMemento
in classJavaElement
- See Also:
JavaElement.getHandleMemento(StringBuffer)
-
getKind
Description copied from interface:IPackageFragmentRoot
Returns this package fragment root's kind encoded as an integer. A package fragment root can contain source files (i.e. files with one of theJava-like extensions
, or.class
files, but not both. If the underlying folder or archive contains other kinds of files, they are ignored. In particular,.class
files are ignored under a source package fragment root, and source files are ignored under a binary package fragment root.- Specified by:
getKind
in interfaceIPackageFragmentRoot
- Returns:
- this package fragment root's kind encoded as an integer
- Throws:
JavaModelException
- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
IPackageFragmentRoot
-
getNonJavaResources
Returns an array of non-java resources contained in the receiver.- Specified by:
getNonJavaResources
in interfaceIPackageFragmentRoot
- Returns:
- an array of non-Java resources (
IFile
s,IFolder
s, orIStorage
s if the package fragment root is in archive) contained in this package fragment root - Throws:
JavaModelException
- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
IClasspathEntry.getInclusionPatterns()
,IClasspathEntry.getExclusionPatterns()
-
getPackageFragment
Description copied from interface:IPackageFragmentRoot
Returns the package fragment with the given package name. An empty string indicates the default package. This is a handle-only operation. The package fragment may or may not exist.- Specified by:
getPackageFragment
in interfaceIPackageFragmentRoot
- Parameters:
packageName
- the given package name- Returns:
- the package fragment with the given package name
- See Also:
IPackageFragmentRoot
-
getPackageFragment
-
getPackageFragment
-
getPackageName
Returns the package name for the given folder (which is a decendent of this root). -
getPath
public org.eclipse.core.runtime.IPath getPath()Description copied from interface:IJavaElement
Returns the path to the innermost resource enclosing this element. If this element is not included in an external library, the path returned is the full, absolute path to the underlying resource, relative to the workbench. If this element is included in an external library, the path returned is the absolute path to the archive or to the folder in the file system. This is a handle-only method.- Specified by:
getPath
in interfaceIJavaElement
- Returns:
- the path to the innermost resource enclosing this element
- See Also:
IJavaElement
-
internalPath
public org.eclipse.core.runtime.IPath internalPath() -
getRawClasspathEntry
Description copied from interface:IPackageFragmentRoot
Returns the first raw classpath entry that corresponds to this package fragment root. A raw classpath entry corresponds to a package fragment root if once resolved this entry's path is equal to the root's path.- Specified by:
getRawClasspathEntry
in interfaceIPackageFragmentRoot
- Returns:
- the first raw classpath entry that corresponds to this package fragment root
- Throws:
JavaModelException
- if this element does not exist or if an exception occurs while accessing its corresponding resource.
-
getResolvedClasspathEntry
Description copied from interface:IPackageFragmentRoot
Returns the first resolved classpath entry that corresponds to this package fragment root. A resolved classpath entry is said to correspond to a root if the path of the resolved entry is equal to the root's path.- Specified by:
getResolvedClasspathEntry
in interfaceIPackageFragmentRoot
- Returns:
- the first resolved classpath entry that corresponds to this package fragment root
- Throws:
JavaModelException
- if this element does not exist or if an exception occurs while accessing its corresponding resource.
-
resource
public org.eclipse.core.resources.IResource resource() -
resource
-
getSourceAttachmentPath
Description copied from interface:IPackageFragmentRoot
Returns the absolute path to the source archive attached to this package fragment root's binary archive.- Specified by:
getSourceAttachmentPath
in interfaceIPackageFragmentRoot
- Returns:
- the absolute path to the corresponding source archive,
or
null
if this package fragment root's binary archive has no corresponding source archive, or if this package fragment root is not a binary archive - Throws:
JavaModelException
- if this operation fails- See Also:
IPackageFragmentRoot
-
setSourceMapper
For use byAttachSourceOperation
only. Sets the source mapper associated with this root.- Throws:
JavaModelException
-
getSourceAttachmentRootPath
Description copied from interface:IPackageFragmentRoot
Returns the path within this package fragment root's source archive. An empty path indicates that packages are located at the root of the source archive.- Specified by:
getSourceAttachmentRootPath
in interfaceIPackageFragmentRoot
- Returns:
- the path within the corresponding source archive,
or
null
if this package fragment root's binary archive has no corresponding source archive, or if this package fragment root is not a binary archive - Throws:
JavaModelException
- if this operation fails- See Also:
IPackageFragmentRoot
-
getSourceMapper
Description copied from class:JavaElement
Returns the SourceMapper facility for this element, ornull
if this element does not have a SourceMapper.- Overrides:
getSourceMapper
in classJavaElement
- See Also:
JavaElement
-
getUnderlyingResource
Description copied from interface:IJavaElement
Returns the smallest underlying resource that contains this element, ornull
if this element is not contained in a resource.- Specified by:
getUnderlyingResource
in interfaceIJavaElement
- Overrides:
getUnderlyingResource
in classOpenable
- Returns:
- the underlying resource, or
null
if none - Throws:
JavaModelException
- if this element does not exist or if an exception occurs while accessing its underlying resource- See Also:
IJavaElement
-
hasChildren
Description copied from interface:IParent
Returns whether this element has one or more immediate children. This is a convenience method, and may be more efficient than testing whethergetChildren
is an empty array.- Specified by:
hasChildren
in interfaceIParent
- Overrides:
hasChildren
in classJavaElement
- Returns:
- true if the immediate children of this element, false otherwise
- Throws:
JavaModelException
- if this element does not exist or if an exception occurs while accessing its corresponding resource- See Also:
IParent
-
hashCode
public int hashCode()Description copied from class:JavaElement
Returns the hash code for this Java element. By default, the hash code for an element is a combination of its name and parent's hash code. Elements with other requirements must override this method.- Overrides:
hashCode
in classJavaElement
-
ignoreOptionalProblems
public boolean ignoreOptionalProblems() -
isArchive
public boolean isArchive()Description copied from interface:IPackageFragmentRoot
Returns whether this package fragment root's underlying resource is a binary archive (a JAR or zip file).This is a handle-only method.
- Specified by:
isArchive
in interfaceIPackageFragmentRoot
- Returns:
- true if this package fragment root's underlying resource is a binary archive, false otherwise
- See Also:
IPackageFragmentRoot
-
isExternal
public boolean isExternal()Description copied from interface:IPackageFragmentRoot
Returns whether this package fragment root is external to the workbench (that is, a local file), and has no underlying resource.This is a handle-only method.
- Specified by:
isExternal
in interfaceIPackageFragmentRoot
- Returns:
- true if this package fragment root is external to the workbench (that is, a local file), and has no underlying resource, false otherwise
- See Also:
IPackageFragmentRoot
-
validateOnClasspath
protected org.eclipse.core.runtime.IStatus validateOnClasspath() -
move
public void move(org.eclipse.core.runtime.IPath destination, int updateResourceFlags, int updateModelFlags, IClasspathEntry sibling, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelExceptionDescription copied from interface:IPackageFragmentRoot
Moves the resource of this package fragment root to the destination path as specified byIResource.move(IPath,int,IProgressMonitor)
but excluding nested source folders.If
NO_RESOURCE_MODIFICATION
is specified inupdateModelFlags
or if this package fragment root is external, this operation doesn't move the resource.updateResourceFlags
is then ignored.If
DESTINATION_PROJECT_CLASSPATH
is specified inupdateModelFlags
, updates the classpath of the destination's project (if it is a Java project). If a non-null
sibling is specified, a copy of this root's classpath entry is inserted before the sibling on the destination project's raw classpath. Ifnull
is specified, the classpath entry is added at the end of the raw classpath.If
ORIGINATING_PROJECT_CLASSPATH
is specified inupdateModelFlags
, update the raw classpath of this package fragment root's project by removing the corresponding classpath entry.If
OTHER_REFERRING_PROJECTS_CLASSPATH
is specified inupdateModelFlags
, update the raw classpaths of all other Java projects referring to this root's resource by removing the corresponding classpath entries.If
REPLACE
is specified inupdateModelFlags
, overwrites the resource at the destination path if any. If the same classpath entry already exists on the destination project's raw classpath, then the sibling is ignored and the new classpath entry replaces the existing one.If no flags is specified in
updateModelFlags
(usingIResource.NONE
), the default behavior applies: the resource is moved (if this package fragment root is not external) and no classpaths are updated.- Specified by:
move
in interfaceIPackageFragmentRoot
- Parameters:
destination
- the destination pathupdateResourceFlags
- bit-wise or of update flag constants (IResource.FORCE
,IResource.KEEP_HISTORY
andIResource.SHALLOW
)updateModelFlags
- bit-wise or of update resource flag constants (DESTINATION_PROJECT_CLASSPATH
,ORIGINATING_PROJECT_CLASSPATH
,OTHER_REFERRING_PROJECTS_CLASSPATH
andNO_RESOURCE_MODIFICATION
)sibling
- the classpath entry before which a copy of the classpath entry should be inserted ornull
if the classpath entry should be inserted at the endmonitor
- a progress monitor- Throws:
JavaModelException
- if this root could not be moved. Reasons include:- This root does not exist (ELEMENT_DOES_NOT_EXIST)
- A
CoreException
occurred while copying the resource or updating a classpath -
The destination is not inside an existing project and
updateModelFlags
has been specified asDESTINATION_PROJECT_CLASSPATH
(INVALID_DESTINATION) - The sibling is not a classpath entry on the destination project's raw classpath (INVALID_SIBLING)
- The same classpath entry already exists on the destination project's
classpath (NAME_COLLISION) and
updateModelFlags
has not been specified asREPLACE
- See Also:
IResource.move(IPath, boolean, IProgressMonitor)
-
toStringInfo
Description copied from class:JavaElement
Debugging purposes- Overrides:
toStringInfo
in classJavaElement
showResolvedInfo
- TODO
-
validateExistence
protected org.eclipse.core.runtime.IStatus validateExistence(org.eclipse.core.resources.IResource underlyingResource)- Specified by:
validateExistence
in classOpenable
-
verifyAttachSource
protected void verifyAttachSource(org.eclipse.core.runtime.IPath sourcePath) throws JavaModelExceptionPossible failures:- ELEMENT_NOT_PRESENT - the root supplied to the operation does not exist
- INVALID_ELEMENT_TYPES - the root is not of kind K_BINARY
- RELATIVE_PATH - the path supplied to this operation must be an absolute path
- Throws:
JavaModelException
-
getClassFilePath
Returns the relative path within an archive for the given class file name. In certain kind of archives, such as a JMOD file, class files are stored in a nested folder, as opposed to directly under the root. It is the responsibility of such package fragment roots to provide the custom behavior.- Parameters:
classname
-- Returns:
- the relative path for the class file within the archive
-
getModuleDescription
Description copied from interface:IPackageFragmentRoot
Returns theIModuleDescription
that this package fragment root contains. Returnsnull
if the root doesn't contain any named module or if the project compiler compliance is 1.8 or lower. If present the module descriptor is found as a child of the package fragment representing the default package. Note that only one of the source package fragment roots in a Java Project can legally contain a module descriptor.- Specified by:
getModuleDescription
in interfaceIPackageFragmentRoot
- Returns:
- the
IModuleDescription
this root contains.
-
getAutomaticModuleDescription
- Throws:
JavaModelException
-
hasCompilationUnit
-
getManifest
Convenience lookup, though currently only JarPackageFragmentRoot is searched for a manifest. -
isComplianceJava9OrHigher
protected boolean isComplianceJava9OrHigher()
-