|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.core.runtime.PlatformObject
org.eclipse.jdt.internal.core.JavaElement
org.eclipse.jdt.internal.core.Openable
org.eclipse.jdt.internal.core.PackageFragmentRoot
public class PackageFragmentRoot
IPackageFragmentRoot
Field Summary | |
---|---|
static java.lang.String |
NO_SOURCE_ATTACHMENT
|
Fields inherited from class org.eclipse.jdt.internal.core.JavaElement |
---|
JEM_ANNOTATION, JEM_CLASSFILE, JEM_COMPILATIONUNIT, JEM_COUNT, JEM_ESCAPE, JEM_FIELD, JEM_IMPORTDECLARATION, JEM_INITIALIZER, JEM_JAVAPROJECT, JEM_LOCALVARIABLE, JEM_METHOD, JEM_PACKAGEDECLARATION, JEM_PACKAGEFRAGMENT, JEM_PACKAGEFRAGMENTROOT, JEM_TYPE, JEM_TYPE_PARAMETER |
Fields inherited from interface 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 |
Fields inherited from interface org.eclipse.jdt.core.IJavaElement |
---|
ANNOTATION, CLASS_FILE, COMPILATION_UNIT, FIELD, IMPORT_CONTAINER, IMPORT_DECLARATION, INITIALIZER, JAVA_MODEL, JAVA_PROJECT, LOCAL_VARIABLE, METHOD, PACKAGE_DECLARATION, PACKAGE_FRAGMENT, PACKAGE_FRAGMENT_ROOT, TYPE, TYPE_PARAMETER |
Method Summary | |
---|---|
void |
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. |
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 by IResource.copy(IPath, int, IProgressMonitor)
but excluding nested source folders. |
IPackageFragment |
createPackageFragment(java.lang.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 by IResource.delete(int, IProgressMonitor) but excluding nested
source folders. |
boolean |
equals(java.lang.Object o)
Compares two objects for equality; for PackageFragmentRoot s, equality is having the
same parent, same resources, and occurrence count. |
char[][] |
fullExclusionPatternChars()
|
char[][] |
fullInclusionPatternChars()
|
java.lang.String |
getElementName()
Returns the name of this element. |
int |
getElementType()
Returns this element's kind encoded as an integer. |
IJavaElement |
getHandleFromMemento(java.lang.String token,
MementoTokenizer memento,
WorkingCopyOwner owner)
|
int |
getKind()
Returns this package fragment root's kind encoded as an integer. |
java.lang.Object[] |
getNonJavaResources()
Returns an array of non-java resources contained in the receiver. |
IPackageFragment |
getPackageFragment(java.lang.String packageName)
Returns the package fragment with the given package name. |
PackageFragment |
getPackageFragment(java.lang.String[] pkgName)
|
org.eclipse.core.runtime.IPath |
getPath()
Returns the path to the innermost resource enclosing this element. |
IClasspathEntry |
getRawClasspathEntry()
Returns the first raw classpath entry that corresponds to this package fragment root. |
org.eclipse.core.runtime.IPath |
getSourceAttachmentPath()
Returns the absolute path to the source archive attached to this package fragment root's binary archive. |
org.eclipse.core.runtime.IPath |
getSourceAttachmentRootPath()
Returns the path within this package fragment root's source archive. |
SourceMapper |
getSourceMapper()
Returns the SourceMapper facility for this element, or null if this element does not have a
SourceMapper. |
IResource |
getUnderlyingResource()
Returns the smallest underlying resource that contains this element, or null if this element is not contained
in a resource. |
boolean |
hasChildren()
Returns whether this element has one or more immediate children. |
int |
hashCode()
Returns the hash code for this Java element. |
org.eclipse.core.runtime.IPath |
internalPath()
|
boolean |
isArchive()
Returns whether this package fragment root's underlying resource is a binary archive (a JAR or zip file). |
boolean |
isExternal()
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 by IResource.move(IPath,int,IProgressMonitor)
but excluding nested source folders. |
IResource |
resource()
|
IResource |
resource(PackageFragmentRoot root)
|
void |
setSourceMapper(SourceMapper mapper)
For use by AttachSourceOperation only. |
Methods inherited from class org.eclipse.jdt.internal.core.Openable |
---|
bufferChanged, canBeRemovedFromCache, canBufferBeRemovedFromCache, exists, findRecommendedLineSeparator, getBuffer, getBufferFactory, getCorrespondingResource, getOpenable, getPackageFragmentRoot, getResource, hasUnsavedChanges, isConsistent, isOpen, isStructureKnown, makeConsistent, open, save |
Methods inherited from class org.eclipse.jdt.internal.core.JavaElement |
---|
close, findNode, getAncestor, getAttachedJavadoc, getChildren, getChildrenOfType, getClassFile, getCompilationUnit, getElementInfo, getElementInfo, getHandleFromMemento, getHandleIdentifier, getHandleMemento, getJavaModel, getJavaProject, getOpenableParent, getParent, getPrimaryElement, getPrimaryElement, getSchedulingRule, isAncestorOf, isReadOnly, newJavaModelException, newNotPresentException, readableName, resolved, toDebugString, toString, toStringInfo, toStringWithAncestors, toStringWithAncestors, unresolved |
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.jdt.core.IParent |
---|
getChildren |
Methods inherited from interface org.eclipse.jdt.core.IJavaElement |
---|
exists, getAncestor, getAttachedJavadoc, getCorrespondingResource, getHandleIdentifier, getJavaModel, getJavaProject, getOpenable, getParent, getPrimaryElement, getResource, getSchedulingRule, isReadOnly, isStructureKnown |
Methods inherited from interface org.eclipse.core.runtime.IAdaptable |
---|
getAdapter |
Methods inherited from interface org.eclipse.jdt.core.IOpenable |
---|
close, findRecommendedLineSeparator, getBuffer, hasUnsavedChanges, isConsistent, isOpen, makeConsistent, open, save |
Field Detail |
---|
public static final java.lang.String NO_SOURCE_ATTACHMENT
Method Detail |
---|
public void attachSource(org.eclipse.core.runtime.IPath sourcePath, org.eclipse.core.runtime.IPath rootPath, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException
IPackageFragmentRoot
rootPath
specifies the location
of the root within the archive or folder (empty specifies the default root
and null
specifies the root path should be detected).
Once a source archive or folder is attached to the package fragment root,
the getSource
and getSourceRange
methods become operational for binary types/members.
To detach a source archive or folder from a package fragment root, specify
null
as the source path.
attachSource
in interface IPackageFragmentRoot
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 and null
specifies
automatic detection of the root path)monitor
- the given progress monitor
JavaModelException
- if this operation fails. Reasons include:
CoreException
occurred while updating a server property
IPackageFragmentRoot
public void delete(int updateResourceFlags, int updateModelFlags, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException
IPackageFragmentRoot
IResource.delete(int, IProgressMonitor)
but excluding nested
source folders.
If NO_RESOURCE_MODIFICATION
is specified in
updateModelFlags
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 in
updateModelFlags
, update the raw classpath of this package
fragment root's project by removing the corresponding classpath entry.
If OTHER_REFERRING_PROJECTS_CLASSPATH
is specified in
updateModelFlags
, 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
(using
IResource.NONE
), the default behavior applies: the
resource is deleted (if this package fragment root is not external) and no
classpaths are updated.
delete
in interface IPackageFragmentRoot
updateResourceFlags
- bit-wise or of update resource flag constants
(IResource.FORCE
and IResource.KEEP_HISTORY
)updateModelFlags
- bit-wise or of update resource flag constants
(ORIGINATING_PROJECT_CLASSPATH
,
OTHER_REFERRING_PROJECTS_CLASSPATH
and
NO_RESOURCE_MODIFICATION
)monitor
- a progress monitor
JavaModelException
- if this root could not be deleted. Reasons
include:
CoreException
occurred while deleting the resource
or updating a classpath
IResource.delete(boolean, IProgressMonitor)
public void copy(org.eclipse.core.runtime.IPath destination, int updateResourceFlags, int updateModelFlags, IClasspathEntry sibling, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException
IPackageFragmentRoot
IResource.copy(IPath, int, IProgressMonitor)
but excluding nested source folders.
If NO_RESOURCE_MODIFICATION
is specified in
updateModelFlags
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 in
updateModelFlags
, 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. If null
is
specified, the classpath entry is added at the end of the raw classpath.
If REPLACE
is specified in updateModelFlags
,
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
(using
IResource.NONE
), the default behavior applies: the
resource is copied (if this package fragment root is not external) and the
classpath is not updated.
copy
in interface IPackageFragmentRoot
destination
- the destination pathupdateResourceFlags
- bit-wise or of update resource flag constants
(IResource.FORCE
and IResource.SHALLOW
)updateModelFlags
- bit-wise or of update resource flag constants
(DESTINATION_PROJECT_CLASSPATH
and
NO_RESOURCE_MODIFICATION
)sibling
- the classpath entry before which a copy of the classpath
entry should be inserted or null
if the classpath entry should
be inserted at the endmonitor
- a progress monitor
JavaModelException
- if this root could not be copied. Reasons
include:
CoreException
occurred while copying the
resource or updating a classpathupdateModelFlags
has been specified as DESTINATION_PROJECT_CLASSPATH
(INVALID_DESTINATION)updateModelFlags
has not been specified as REPLACE
IResource.copy(IPath, boolean, IProgressMonitor)
public IPackageFragment createPackageFragment(java.lang.String pkgName, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException
IPackageFragmentRoot
force
flag, see IFolder.create
.
createPackageFragment
in interface IPackageFragmentRoot
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
JavaModelException
- if the element could not be created. Reasons include:
CoreException
occurred while creating an underlying resource
IPackageFragmentRoot
public boolean equals(java.lang.Object o)
PackageFragmentRoot
s, equality is having the
same parent, same resources, and occurrence count.
equals
in class JavaElement
Object.equals(java.lang.Object)
public char[][] fullExclusionPatternChars()
public char[][] fullInclusionPatternChars()
public java.lang.String getElementName()
IJavaElement
getElementName
in interface IJavaElement
getElementName
in class JavaElement
IAdaptable
public int getElementType()
IJavaElement
getElementType
in interface IJavaElement
IJavaElement
IJavaElement
public IJavaElement getHandleFromMemento(java.lang.String token, MementoTokenizer memento, WorkingCopyOwner owner)
getHandleFromMemento
in class JavaElement
public int getKind() throws JavaModelException
IPackageFragmentRoot
Java-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.
getKind
in interface IPackageFragmentRoot
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.IPackageFragmentRoot
public java.lang.Object[] getNonJavaResources() throws JavaModelException
getNonJavaResources
in interface IPackageFragmentRoot
IFile
s,
IFolder
s, or IStorage
s if the
package fragment root is in archive) contained in this package
fragment root
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.IClasspathEntry.getInclusionPatterns()
,
IClasspathEntry.getExclusionPatterns()
public IPackageFragment getPackageFragment(java.lang.String packageName)
IPackageFragmentRoot
getPackageFragment
in interface IPackageFragmentRoot
packageName
- the given package name
IPackageFragmentRoot
public PackageFragment getPackageFragment(java.lang.String[] pkgName)
public org.eclipse.core.runtime.IPath getPath()
IJavaElement
getPath
in interface IJavaElement
IJavaElement
public org.eclipse.core.runtime.IPath internalPath()
public IClasspathEntry getRawClasspathEntry() throws JavaModelException
IPackageFragmentRoot
getRawClasspathEntry
in interface IPackageFragmentRoot
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.public IResource resource()
resource
in class Openable
public IResource resource(PackageFragmentRoot root)
public org.eclipse.core.runtime.IPath getSourceAttachmentPath() throws JavaModelException
IPackageFragmentRoot
getSourceAttachmentPath
in interface IPackageFragmentRoot
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
JavaModelException
- if this operation failsIPackageFragmentRoot
public void setSourceMapper(SourceMapper mapper) throws JavaModelException
AttachSourceOperation
only.
Sets the source mapper associated with this root.
JavaModelException
public org.eclipse.core.runtime.IPath getSourceAttachmentRootPath() throws JavaModelException
IPackageFragmentRoot
getSourceAttachmentRootPath
in interface IPackageFragmentRoot
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
JavaModelException
- if this operation failsIPackageFragmentRoot
public SourceMapper getSourceMapper()
JavaElement
null
if this element does not have a
SourceMapper.
getSourceMapper
in class JavaElement
JavaElement
public IResource getUnderlyingResource() throws JavaModelException
IJavaElement
null
if this element is not contained
in a resource.
getUnderlyingResource
in interface IJavaElement
getUnderlyingResource
in class Openable
null
if none
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its underlying resourceIJavaElement
public boolean hasChildren() throws JavaModelException
IParent
getChildren
is an empty array.
hasChildren
in interface IParent
hasChildren
in class JavaElement
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resourceIParent
public int hashCode()
JavaElement
hashCode
in class JavaElement
public boolean isArchive()
IPackageFragmentRoot
This is a handle-only method.
isArchive
in interface IPackageFragmentRoot
IPackageFragmentRoot
public boolean isExternal()
IPackageFragmentRoot
This is a handle-only method.
isExternal
in interface IPackageFragmentRoot
IPackageFragmentRoot
public void move(org.eclipse.core.runtime.IPath destination, int updateResourceFlags, int updateModelFlags, IClasspathEntry sibling, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException
IPackageFragmentRoot
IResource.move(IPath,int,IProgressMonitor)
but excluding nested source folders.
If NO_RESOURCE_MODIFICATION
is specified in
updateModelFlags
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 in
updateModelFlags
, 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. If null
is
specified, the classpath entry is added at the end of the raw classpath.
If ORIGINATING_PROJECT_CLASSPATH
is specified in
updateModelFlags
, update the raw classpath of this package
fragment root's project by removing the corresponding classpath entry.
If OTHER_REFERRING_PROJECTS_CLASSPATH
is specified in
updateModelFlags
, 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 in updateModelFlags
,
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
(using
IResource.NONE
), the default behavior applies: the
resource is moved (if this package fragment root is not external) and no
classpaths are updated.
move
in interface IPackageFragmentRoot
destination
- the destination pathupdateResourceFlags
- bit-wise or of update flag constants
(IResource.FORCE
, IResource.KEEP_HISTORY
and IResource.SHALLOW
)updateModelFlags
- bit-wise or of update resource flag constants
(DESTINATION_PROJECT_CLASSPATH
,
ORIGINATING_PROJECT_CLASSPATH
,
OTHER_REFERRING_PROJECTS_CLASSPATH
and
NO_RESOURCE_MODIFICATION
)sibling
- the classpath entry before which a copy of the classpath
entry should be inserted or null
if the classpath entry should
be inserted at the endmonitor
- a progress monitor
JavaModelException
- if this root could not be moved. Reasons
include:
CoreException
occurred while copying the
resource or updating a classpathupdateModelFlags
has been specified as DESTINATION_PROJECT_CLASSPATH
(INVALID_DESTINATION)updateModelFlags
has not been specified as REPLACE
IResource.move(IPath, boolean, IProgressMonitor)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |