public class JarPackageData extends Object
Clients may subclass.
JarWriter3
Constructor and Description |
---|
JarPackageData()
Creates a new Jar Package Data structure
|
Modifier and Type | Method and Description |
---|---|
boolean |
allowOverwrite()
Tells whether files can be overwritten without warning.
|
boolean |
areClassFilesExported()
Tells whether class files and resources are exported.
|
boolean |
areDirectoryEntriesIncluded()
Tells whether directory entries are added to the jar.
|
boolean |
areErrorsExported()
Answers if compilation units with errors are exported.
|
boolean |
areGeneratedFilesExported()
Tells whether files created by the Java builder are exported.
|
boolean |
areJavaFilesExported()
Tells whether java files and resources are exported.
|
boolean |
areOutputFoldersExported()
Tells whether all output folders for the
enclosing projects of the exported elements.
|
IJarBuilder |
createFatJarBuilder()
Creates and returns a jar builder capable of handling
files and archives.
|
IJarDescriptionReader |
createJarDescriptionReader(InputStream inputStream)
Creates and returns a JAR package data description reader
for this JAR package data object.
|
IJarDescriptionWriter |
createJarDescriptionWriter(OutputStream outputStream)
Deprecated.
Use
createJarDescriptionWriter(OutputStream, String) instead |
IJarDescriptionWriter |
createJarDescriptionWriter(OutputStream outputStream,
String encoding)
Creates and returns a JAR package data description writer
for this JAR package data object.
|
IJarExportRunnable |
createJarExportRunnable(JarPackageData[] jarPackagesData,
Shell parent)
Creates and returns a JarExportRunnable for a list of JAR package
data objects.
|
IJarExportRunnable |
createJarExportRunnable(Shell parent)
Creates and returns a JarExportRunnable.
|
JarWriter2 |
createJarWriter(Shell parent)
Deprecated.
Use
createJarWriter3(Shell) instead |
JarWriter3 |
createJarWriter3(Shell parent)
Deprecated.
use
createPlainJarBuilder() instead |
IJarBuilder |
createPlainJarBuilder()
Creates and returns a jar builder capable of handling
files but not archives.
|
boolean |
exportWarnings()
Answers if compilation units with warnings are exported.
|
IFile[] |
findClassfilesFor(IFile javaFile)
Finds the class files for the given java file
and returns them.
|
IPath |
getAbsoluteJarLocation()
Gets the absolute location of the JAR file.
|
String |
getComment()
Returns the JAR's comment.
|
IFile |
getDescriptionFile()
Gets the description file (as workspace resource).
|
IPath |
getDescriptionLocation()
Returns the location of file containing the description of a JAR.
|
Object[] |
getElements()
Returns the elements which will be exported.
|
IJarBuilder |
getJarBuilder()
Returns the jar builder which can be used to build the jar
described by this package data.
|
IPath |
getJarLocation()
Gets the location of the JAR file.
|
String |
getLaunchConfigurationName()
Get the name of the launch configuration from
which to retrieve classpath information.
|
IFile |
getManifestFile()
Gets the manifest file (as workspace resource).
|
IPath |
getManifestLocation()
Returns the location of a user-defined manifest file.
|
IType |
getManifestMainClass()
Gets the manifest's main class.
|
IManifestProvider |
getManifestProvider()
Gets the manifest provider for this JAR package.
|
String |
getManifestVersion()
Gets the manifest version.
|
IPackageFragment[] |
getPackagesToSeal()
Gets the packages which should be sealed.
|
IPackageFragment[] |
getPackagesToUnseal()
Gets the packages which should explicitly be unsealed.
|
RefactoringDescriptorProxy[] |
getRefactoringDescriptors()
Returns the refactoring descriptors to export.
|
IProject[] |
getRefactoringProjects()
Returns the projects for which refactoring information should be stored.
|
boolean |
isBuildingIfNeeded()
Answers if a build should be performed before exporting files.
|
boolean |
isCompressed()
Tells whether the JAR is compressed or not.
|
boolean |
isDeprecationAware()
Is the JAR package deprecation aware?
|
boolean |
isDescriptionSaved()
Tells whether a description of this JAR package must be saved
to a file by a JAR description writer during the export operation.
|
boolean |
isExportStructuralOnly()
Is the JAR export wizard only exporting refactorings causing structural
changes?
|
boolean |
isJarSealed()
Answers whether the JAR itself is sealed.
|
boolean |
isMainClassValid(IRunnableContext context)
Tells whether the specified manifest main class is valid.
|
boolean |
isManifestAccessible()
Tells whether a manifest is available.
|
boolean |
isManifestGenerated()
Tells whether the manifest file must be generated.
|
boolean |
isManifestReused()
Tells whether a previously generated manifest should be reused.
|
boolean |
isManifestSaved()
Tells whether the manifest file must be saved to the
specified file during the export operation.
|
boolean |
isRefactoringAware()
Is the JAR package refactoring aware?
|
boolean |
isValid()
Tells whether this JAR package data can be used to generate
a valid JAR.
|
boolean |
logErrors()
Deprecated.
will be removed in final 2.0
|
boolean |
logWarnings()
Deprecated.
will be removed in final 2.0
|
void |
setBuildIfNeeded(boolean buildIfNeeded)
Sets if a build should be performed before exporting files.
|
void |
setComment(String comment)
Sets the JAR's comment.
|
void |
setCompress(boolean state)
Set whether the JAR is compressed or not.
|
void |
setDeprecationAware(boolean aware)
Determines whether the jar package is deprecation aware.
|
void |
setDescriptionLocation(IPath descriptionLocation)
Set the location of the JAR description file.
|
void |
setElements(Object[] elements)
Set the elements which will be exported.
|
void |
setExportClassFiles(boolean state)
Sets option to export class files and resources.
|
void |
setExportErrors(boolean exportErrors)
Sets if compilation units with errors are exported.
|
void |
setExportJavaFiles(boolean state)
Sets the option to export Java source and resources.
|
void |
setExportOutputFolders(boolean state)
Sets option to export all output folders for the
enclosing projects of the exported elements.
|
void |
setExportStructuralOnly(boolean structural)
Determines whether the jar packager exports only refactorings causing
structural changes.
|
void |
setExportWarnings(boolean exportWarnings)
Sets if compilation units with warnings are exported.
|
void |
setGenerateManifest(boolean state)
Set whether a manifest must be generated or not.
|
void |
setIncludeDirectoryEntries(boolean includeDirectoryEntries)
Sets the option to include directory entries into the jar.
|
void |
setJarBuilder(IJarBuilder jarBuilder)
Set the jar builder to use to build the jar.
|
void |
setJarLocation(IPath jarLocation)
Sets the JAR file location.
|
void |
setLaunchConfigurationName(String name)
Set the name of the launch configuration form which
to retrieve classpath information.
|
void |
setLogErrors(boolean logErrors)
Deprecated.
will be removed in final 2.0
|
void |
setLogWarnings(boolean logWarnings)
Deprecated.
will be removed in final 2.0
|
void |
setManifestLocation(IPath manifestLocation)
Sets the location of a user-defined manifest file.
|
void |
setManifestMainClass(IType manifestMainClass)
Set the manifest's main class.
|
void |
setManifestProvider(IManifestProvider manifestProvider)
Sets the manifest provider.
|
void |
setManifestVersion(String manifestVersion)
Sets the manifest version.
|
void |
setOverwrite(boolean state)
Sets whether files can be overwritten without warning.
|
void |
setPackagesToSeal(IPackageFragment[] packagesToSeal)
Sets the packages which should be sealed.
|
void |
setPackagesToUnseal(IPackageFragment[] packagesToUnseal)
Set the packages which should explicitly be unsealed.
|
void |
setRefactoringAware(boolean aware)
Determines whether the jar package is refactoring aware.
|
void |
setRefactoringDescriptors(RefactoringDescriptorProxy[] descriptors)
Sets the refactoring descriptors to export.
|
void |
setRefactoringProjects(IProject[] projects)
Sets the projects for which refactoring information should be stored.
|
void |
setReuseManifest(boolean state)
Sets whether a previously generated manifest should be reused.
|
void |
setSaveDescription(boolean state)
Set whether a description of this JAR package must be saved
to a file by a JAR description writer during the export operation.
|
void |
setSaveManifest(boolean state)
Sets whether the manifest file must be saved during export
operation or not.
|
void |
setSealJar(boolean sealJar)
Sets whether the JAR itself is sealed.
|
void |
setUsesManifest(boolean state)
Sets whether a manifest must be included in the JAR.
|
void |
setUseSourceFolderHierarchy(boolean state)
Set the option to export the source folder hierarchy.
|
boolean |
usesManifest()
Answers whether a manifest must be included in the JAR.
|
boolean |
useSourceFolderHierarchy()
Tells whether the source folder hierarchy is used.
|
public boolean isCompressed()
true
if the JAR is compressedpublic void setCompress(boolean state)
state
- a boolean indicating the new statepublic boolean allowOverwrite()
true
if files can be overwritten without warningpublic void setOverwrite(boolean state)
state
- a boolean indicating the new statepublic boolean areClassFilesExported()
true
if class files and resources are exportedpublic void setExportClassFiles(boolean state)
state
- a boolean indicating the new statepublic boolean areOutputFoldersExported()
true
if output folder are exportedpublic void setExportOutputFolders(boolean state)
state
- a boolean indicating the new statepublic boolean areGeneratedFilesExported()
true
if output folder are exportedpublic boolean areJavaFilesExported()
true
if java files and resources are exportedpublic void setExportJavaFiles(boolean state)
state
- the new statepublic boolean useSourceFolderHierarchy()
Using the source folder hierarchy only makes sense if java files are but class files aren't exported.
true
if source folder hierarchy is usedpublic void setUseSourceFolderHierarchy(boolean state)
state
- the new statepublic IPath getAbsoluteJarLocation()
public IPath getJarLocation()
public void setJarLocation(IPath jarLocation)
jarLocation
- a path denoting the location of the JAR filepublic boolean isManifestGenerated()
true
if the manifest has to be generatedpublic void setGenerateManifest(boolean state)
state
- the new statepublic boolean isManifestSaved()
true
if the manifest must be savedgetManifestLocation()
public void setSaveManifest(boolean state)
state
- the new stategetManifestLocation()
public boolean isManifestReused()
true
if the generated manifest will be reused when regenerating this JAR,
false
if the manifest has to be regeneratedpublic void setReuseManifest(boolean state)
state
- the new statepublic IPath getManifestLocation()
null
if none is specifiedpublic void setManifestLocation(IPath manifestLocation)
manifestLocation
- the path of the user-define manifest locationpublic IFile getManifestFile()
public String getManifestVersion()
public void setManifestVersion(String manifestVersion)
manifestVersion
- the string which contains the manifest versionpublic boolean usesManifest()
true
if a manifest has to be includedpublic void setUsesManifest(boolean state)
state
- the new statepublic IManifestProvider getManifestProvider()
public void setManifestProvider(IManifestProvider manifestProvider)
manifestProvider
- the ManifestProvider to setpublic boolean isJarSealed()
This option should only be considered when the manifest file is generated.
true
if the JAR must be sealedisManifestGenerated()
public void setSealJar(boolean sealJar)
This option should only be considered when the manifest file is generated.
sealJar
- true
if the JAR must be sealedisManifestGenerated()
public void setPackagesToSeal(IPackageFragment[] packagesToSeal)
This should only be used if the JAR itself is not sealed.
packagesToSeal
- an array of IPackageFragment
to sealpublic IPackageFragment[] getPackagesToSeal()
This should only be used if the JAR itself is not sealed.
IPackageFragment
public IPackageFragment[] getPackagesToUnseal()
This should only be used if the JAR itself is sealed.
IPackageFragment
public void setPackagesToUnseal(IPackageFragment[] packagesToUnseal)
This should only be used if the JAR itself is sealed.
packagesToUnseal
- an array of IPackageFragment
public boolean isDescriptionSaved()
The JAR writer defines the format of the file.
true
if this JAR package will be savedgetDescriptionLocation()
public void setSaveDescription(boolean state)
The format is defined by the client who implements the reader/writer pair.
state
- a boolean containing the new stategetDescriptionLocation()
,
IJarDescriptionWriter
public IPath getDescriptionLocation()
null
if none is specifiedpublic void setDescriptionLocation(IPath descriptionLocation)
descriptionLocation
- the path of locationpublic IFile getDescriptionFile()
public IType getManifestMainClass()
null
if none is specifiedpublic void setManifestMainClass(IType manifestMainClass)
manifestMainClass
- the type with the main class for the manifest filepublic Object[] getElements()
IFile
and not containers.public void setElements(Object[] elements)
IFile
.
and not containers.elements
- an array with leaf objectspublic String getComment()
null
if the JAR does not contain a commentpublic void setComment(String comment)
comment
- a string or null
if the JAR does not contain a comment@Deprecated public boolean logErrors()
The export operation decides where and how the errors are logged.
true
if errors are logged@Deprecated public void setLogErrors(boolean logErrors)
The export operation decides where and how the errors are logged.
logErrors
- true
if errors are logged@Deprecated public boolean logWarnings()
The export operation decides where and how the warnings are logged.
true
if warnings are logged@Deprecated public void setLogWarnings(boolean logWarnings)
The export operation decides where and how the warnings are logged.
logWarnings
- true
if warnings are loggedpublic boolean areErrorsExported()
true
if CUs with errors should be exportedpublic void setExportErrors(boolean exportErrors)
exportErrors
- true
if CUs with errors should be exportedpublic boolean exportWarnings()
true
if CUs with warnings should be exportedpublic void setExportWarnings(boolean exportWarnings)
exportWarnings
- true
if CUs with warnings should be exportedpublic boolean isBuildingIfNeeded()
public void setBuildIfNeeded(boolean buildIfNeeded)
buildIfNeeded
- a boolean telling if a build should be performedpublic IFile[] findClassfilesFor(IFile javaFile) throws CoreException
This is a hook for subclasses which want to implement a different strategy for finding the class files. The default strategy is to query the class files for the source file name attribute. If this attribute is missing then all class files in the corresponding output folder are exported.
A CoreException can be thrown if an error occurs during this
operation. The CoreException
will not stop the export
process but adds the status object to the status of the
export runnable.
javaFile
- a .java filenull
to used the default strategyCoreException
- if find failed, e.g. I/O error or resource out of syncIJarExportRunnable.getStatus()
@Deprecated public JarWriter2 createJarWriter(Shell parent) throws CoreException
createJarWriter3(Shell)
insteadparent
- the shell used to display question dialogs,
or null
if "false/no/cancel" is the answer
and no dialog should be shownCoreException
- if an unexpected exception happensJarWriter2
@Deprecated public JarWriter3 createJarWriter3(Shell parent) throws CoreException
createPlainJarBuilder()
insteadparent
- the shell used to display question dialogs,
or null
if "false/no/cancel" is the answer
and no dialog should be shownCoreException
- if an unexpected exception happensJarWriter3
public IJarBuilder createPlainJarBuilder()
public IJarBuilder createFatJarBuilder()
public IJarExportRunnable createJarExportRunnable(Shell parent)
parent
- the parent for the dialog,
or null
if no questions should be asked and
no checks for unsaved files should be made.public IJarExportRunnable createJarExportRunnable(JarPackageData[] jarPackagesData, Shell parent)
jarPackagesData
- an array with JAR package data objectsparent
- the parent for the dialog,
or null
if no dialog should be presentedIJarExportRunnable
@Deprecated public IJarDescriptionWriter createJarDescriptionWriter(OutputStream outputStream)
createJarDescriptionWriter(OutputStream, String)
insteadIt is the client's responsibility to close this writer.
outputStream
- the output stream to write topublic IJarDescriptionWriter createJarDescriptionWriter(OutputStream outputStream, String encoding)
It is the client's responsibility to close this writer.
outputStream
- the output stream to write toencoding
- the encoding to usepublic IJarDescriptionReader createJarDescriptionReader(InputStream inputStream)
It is the client's responsibility to close this reader.
inputStream
- the input stream to read frompublic boolean isValid()
true
if the JAR Package info is validpublic boolean isManifestAccessible()
true
if the manifest is generated or the provided one is accessiblepublic boolean isMainClassValid(IRunnableContext context)
context
- the IRunnableContext
true
if a main class is specified and validpublic boolean areDirectoryEntriesIncluded()
true
if directory entries are to be includedpublic void setIncludeDirectoryEntries(boolean includeDirectoryEntries)
includeDirectoryEntries
- true
to include
directory entries false
otherwisepublic IProject[] getRefactoringProjects()
This information is used for JAR export.
public boolean isExportStructuralOnly()
This information is used for JAR export.
true
if exporting structural changes only,
false
otherwisepublic boolean isRefactoringAware()
This information is used both in JAR export and import
true
if it is refactoring aware,
false
otherwisepublic boolean isDeprecationAware()
This information is used in JAR export.
true
if it is deprecation aware,
false
otherwisepublic void setRefactoringProjects(IProject[] projects)
This information is used for JAR export.
projects
- the projects for which refactoring information should be
storedpublic void setRefactoringAware(boolean aware)
This information is used both in JAR export and import.
aware
- true
if it is refactoring aware,
false
otherwisepublic void setDeprecationAware(boolean aware)
This information is used in JAR export.
aware
- true
if it is deprecation aware,
false
otherwisepublic void setRefactoringDescriptors(RefactoringDescriptorProxy[] descriptors)
This information is used in JAR export.
descriptors
- the refactoring descriptorspublic RefactoringDescriptorProxy[] getRefactoringDescriptors()
This information is used in JAR export.
public void setExportStructuralOnly(boolean structural)
This information is used for JAR export.
structural
- true
if it exports only refactorings causing
structural changes, false
otherwisepublic IJarBuilder getJarBuilder()
public void setJarBuilder(IJarBuilder jarBuilder)
jarBuilder
- the builder to usepublic String getLaunchConfigurationName()
public void setLaunchConfigurationName(String name)
name
- name of the launch configuration
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.