class JarPackageFragment extends PackageFragment
IPackageFragmentnames, NO_CLASSFILES, NO_COMPILATION_UNITSJEM_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, NO_ELEMENTS, NO_INFO, parentDEFAULT_PACKAGE_NAMEANNOTATION, 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_PARAMETEREXTENSION_class, EXTENSION_CLASS, EXTENSION_java, EXTENSION_JAVA, SUFFIX_class, SUFFIX_CLASS, SUFFIX_java, SUFFIX_JAVA, SUFFIX_STRING_class, SUFFIX_STRING_CLASS, SUFFIX_STRING_java, SUFFIX_STRING_JAVA| Modifier | Constructor and Description |
|---|---|
protected |
JarPackageFragment(PackageFragmentRoot root,
String[] names)
Constructs a package fragment that is contained within a jar or a zip.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
buildStructure(OpenableElementInfo info,
IProgressMonitor pm,
Map newElements,
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).
|
boolean |
containsJavaResources()
Returns true if this fragment contains at least one java resource.
|
ICompilationUnit |
createCompilationUnit(String cuName,
String contents,
boolean force,
IProgressMonitor monitor)
Creates and returns a compilation unit in this package fragment
with the specified name and contents.
|
protected Object |
createElementInfo() |
IClassFile[] |
getClassFiles()
Returns a the collection of class files in this - a folder package fragment which has a root
that has its kind set to
IPackageFragmentRoot.K_Source does not
recognize class files. |
ICompilationUnit[] |
getCompilationUnits()
A jar package fragment never contains compilation units.
|
IResource |
getCorrespondingResource()
A package fragment in a jar has no corresponding resource.
|
Object[] |
getNonJavaResources()
Returns an array of non-java resources contained in the receiver.
|
boolean |
isReadOnly()
Jars and jar entries are all read only
|
protected Object[] |
storedNonJavaResources() |
copy, delete, equals, exists, getAttachedJavadoc, getClassFile, getCompilationUnit, getCompilationUnits, getElementName, getElementType, getHandleFromMemento, getHandleMementoDelimiter, getKind, getPath, getUnderlyingResource, hasChildren, hashCode, hasSubpackages, isDefaultPackage, move, rename, resource, toStringChildren, toStringInfo, validateExistencebufferChanged, canBeRemovedFromCache, canBufferBeRemovedFromCache, closeBuffer, closing, codeComplete, codeSelect, findRecommendedLineSeparator, generateInfos, getBuffer, getBufferFactory, getBufferManager, getOpenable, getPackageFragmentRoot, getResource, hasBuffer, hasUnsavedChanges, isConsistent, isOpen, isSourceElement, isStructureKnown, makeConsistent, open, openAncestors, openBuffer, resource, resourceExists, saveclose, escapeMementoName, findNode, getAncestor, getChildren, getChildrenOfType, getClassFile, getCompilationUnit, getElementInfo, getElementInfo, getHandleFromMemento, getHandleIdentifier, getHandleMemento, getHandleMemento, getIndexOf, getJavadocBaseLocation, getJavaModel, getJavaProject, getLibraryJavadocLocation, getOpenableParent, getParent, getPrimaryElement, getPrimaryElement, getSchedulingRule, getSourceElementAt, getSourceMapper, getURLContents, isAncestorOf, newDoesNotExistStatus, newJavaModelException, newNotPresentException, openWhenClosed, readableName, resolved, tabString, toDebugString, toString, toString, toStringAncestors, toStringInfo, toStringName, toStringWithAncestors, toStringWithAncestors, unresolvedgetAdapterclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetChildrengetAncestor, getHandleIdentifier, getJavaModel, getJavaProject, getOpenable, getParent, getPrimaryElement, getResource, getSchedulingRule, isStructureKnowngetAdapterclose, findRecommendedLineSeparator, getBuffer, hasUnsavedChanges, isConsistent, isOpen, makeConsistent, open, saveprotected JarPackageFragment(PackageFragmentRoot root, String[] names)
protected boolean buildStructure(OpenableElementInfo info, IProgressMonitor pm, Map newElements, IResource underlyingResource) throws JavaModelException
OpenablebuildStructure in class PackageFragmentJavaModelExceptionOpenablepublic boolean containsJavaResources() throws JavaModelException
containsJavaResources in interface IPackageFragmentcontainsJavaResources in class PackageFragmentJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.public ICompilationUnit createCompilationUnit(String cuName, String contents, boolean force, IProgressMonitor monitor) throws JavaModelException
IPackageFragmentIt is possible that a compilation unit with the same name already exists in this
package fragment.
The value of the force parameter effects the resolution of
such a conflict:
true - in this case the compilation is created with the new contentsfalse - in this case a JavaModelException is throwncreateCompilationUnit in interface IPackageFragmentcreateCompilationUnit in class PackageFragmentcuName - the given namecontents - the given contentsforce - specify how to handle conflict is the same name already existsmonitor - the given progress monitorJavaModelException - if the element could not be created. Reasons include:
CoreException occurred while creating an underlying resource
null (INVALID_CONTENTS)
IPackageFragmentprotected Object createElementInfo()
createElementInfo in class PackageFragmentJavaElementpublic IClassFile[] getClassFiles() throws JavaModelException
PackageFragmentIPackageFragmentRoot.K_Source does not
recognize class files.getClassFiles in interface IPackageFragmentgetClassFiles in class PackageFragmentJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.IPackageFragmentpublic ICompilationUnit[] getCompilationUnits()
getCompilationUnits in interface IPackageFragmentgetCompilationUnits in class PackageFragmentIPackageFragmentpublic IResource getCorrespondingResource()
getCorrespondingResource in interface IJavaElementgetCorrespondingResource in class Openablenull if noneIJavaElementpublic Object[] getNonJavaResources() throws JavaModelException
getNonJavaResources in interface IPackageFragmentgetNonJavaResources in class PackageFragmentIFiles,
IFolders, or IStorages if the
package fragment is in an archive) contained in this package
fragmentJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.IClasspathEntry.getInclusionPatterns(),
IClasspathEntry.getExclusionPatterns()public boolean isReadOnly()
isReadOnly in interface IJavaElementisReadOnly in class JavaElementtrue if this element is read-onlyIJavaElementprotected Object[] storedNonJavaResources() throws JavaModelException
JavaModelException