|
Eclipse JDT 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A package fragment root contains a set of package fragments.
It corresponds to an underlying resource which is either a folder,
JAR, or zip. In the case of a folder, all descendant folders represent
package fragments. For a given child folder representing a package fragment,
the corresponding package name is composed of the folder names between the folder
for this root and the child folder representing the package, separated by '.'.
In the case of a JAR or zip, the contents of the archive dictates
the set of package fragments in an analogous manner.
Package fragment roots need to be opened before they can be navigated or manipulated.
The children are of type IPackageFragment
, and are in no particular order.
This interface is not intended to be implemented by clients.
Field Summary | |
static String |
DEFAULT_PACKAGEROOT_PATH
Empty root path |
static int |
K_BINARY
Kind constant for a binary path root. |
static int |
K_SOURCE
Kind constant for a source path root. |
Fields inherited from interface org.eclipse.jdt.core.IJavaElement |
CLASS_FILE, COMPILATION_UNIT, FIELD, IMPORT_CONTAINER, IMPORT_DECLARATION, INITIALIZER, JAVA_MODEL, JAVA_PROJECT, METHOD, PACKAGE_DECLARATION, PACKAGE_FRAGMENT, PACKAGE_FRAGMENT_ROOT, TYPE |
Method Summary | |
void |
attachSource(IPath archivePath,
IPath rootPath,
IProgressMonitor monitor)
Attaches the source archive identified by the given absolute path to this JAR package fragment root. |
IPackageFragment |
createPackageFragment(String name,
boolean force,
IProgressMonitor monitor)
Creates and returns a package fragment in this root with the given dot-separated package name. |
int |
getKind()
Returns this package fragment root's kind encoded as an integer. |
Object[] |
getNonJavaResources()
Returns an array of non-Java resources contained in this package fragment root. |
IPackageFragment |
getPackageFragment(String packageName)
Returns the package fragment with the given package name. |
IClasspathEntry |
getRawClasspathEntry()
Returns the first raw classpath entry that corresponds to this package fragment root. |
IPath |
getSourceAttachmentPath()
Returns the absolute path to the source archive attached to this package fragment root's binary archive. |
IPath |
getSourceAttachmentRootPath()
Returns the path within this package fragment root's source archive. |
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. |
Methods inherited from interface org.eclipse.jdt.core.IParent |
getChildren, hasChildren |
Methods inherited from interface org.eclipse.jdt.core.IJavaElement |
exists, getAncestor, getCorrespondingResource, getElementName, getElementType, getHandleIdentifier, getJavaModel, getJavaProject, getOpenable, getParent, getPath, getResource, getUnderlyingResource, isReadOnly, isStructureKnown |
Methods inherited from interface org.eclipse.core.runtime.IAdaptable |
getAdapter |
Methods inherited from interface org.eclipse.jdt.core.IOpenable |
close, getBuffer, hasUnsavedChanges, isConsistent, isOpen, makeConsistent, open, save |
Field Detail |
public static final int K_SOURCE
public static final int K_BINARY
public static final String DEFAULT_PACKAGEROOT_PATH
Method Detail |
public void attachSource(IPath archivePath, IPath rootPath, IProgressMonitor monitor) throws JavaModelException
rootPath
specifies the location
of the root within the archive (null
or empty specifies the default root).
Once a source archive is attached to the JAR,
the getSource
and getSourceRange
methods become operational for binary types/members.
To detach a source archive from a JAR, specify null
as the
archivePath.
archivePath
- the given absolute path to this JAR package fragment rootrootPath
- specifies the location of the root within the archive (null
or empty specifies the default root)monitor
- the given progress monitor
JavaModelException
- if this operation fails. Reasons include:
CoreException
occurred while updating a server property
public IPackageFragment createPackageFragment(String name, boolean force, IProgressMonitor monitor) throws JavaModelException
force
flag, see IFolder.create
.
name
- 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
IFolder.create(boolean, boolean, org.eclipse.core.runtime.IProgressMonitor)
public int getKind() throws JavaModelException
.java
source files,
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 .java
files are ignored under a binary package fragment root.
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.K_SOURCE
,
K_BINARY
public Object[] getNonJavaResources() throws JavaModelException
JavaModelException
public IPackageFragment getPackageFragment(String packageName)
packageName
- the given package name
public IClasspathEntry getRawClasspathEntry() throws JavaModelException
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.public IPath getSourceAttachmentPath() throws JavaModelException
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 failspublic IPath getSourceAttachmentRootPath() throws JavaModelException
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 failspublic boolean isArchive()
public boolean isExternal()
|
Eclipse JDT 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |