|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.umd.cs.findbugs.Project
public class Project
A project in the GUI. This consists of some number of Jar files to analyze for bugs, and optionally
Nested Class Summary | |
---|---|
private static class |
Project.WorkList
Worklist for finding implicit classpath entries. |
private static class |
Project.WorkListItem
Worklist item for finding implicit classpath entries. |
Field Summary | |
---|---|
private static java.lang.String |
AUX_CLASSPATH_ENTRIES_KEY
|
private static java.lang.String |
AUX_CLASSPATH_ENTRY_ELEMENT_NAME
|
private java.util.LinkedList<java.lang.String> |
auxClasspathEntryList
The list of auxiliary classpath entries. |
private static boolean |
DEBUG
|
private static boolean |
FILE_IGNORE_CASE
Hack for whether files are case insensitive. |
private java.util.LinkedList<java.lang.String> |
fileList
The list of project files. |
private static java.lang.String |
FILENAME_ATTRIBUTE_NAME
|
private boolean |
isModified
Flag to indicate that this Project has been modified. |
private static java.lang.String |
JAR_ELEMENT_NAME
|
private static java.lang.String |
JAR_FILES_KEY
|
private static java.lang.String |
OPTIONS_KEY
|
private java.util.Map<java.lang.String,java.lang.Boolean> |
optionsMap
Options. |
private java.lang.String |
projectFileName
Project filename. |
static java.lang.String |
RELATIVE_PATHS
|
private static java.lang.String |
SRC_DIR_ELEMENT_NAME
|
private static java.lang.String |
SRC_DIRS_KEY
|
private java.util.LinkedList<java.lang.String> |
srcDirList
The list of source directories. |
static java.lang.String |
UNNAMED_PROJECT
Constant used to name anonymous projects. |
Constructor Summary | |
---|---|
Project()
Create an anonymous project. |
Method Summary | |
---|---|
boolean |
addAuxClasspathEntry(java.lang.String auxClasspathEntry)
Add an auxiliary classpath entry |
boolean |
addFile(java.lang.String fileName)
Add a file to the project. |
boolean |
addSourceDir(java.lang.String dirName)
Add a source directory to the project. |
private boolean |
addToListInternal(java.util.List<java.lang.String> list,
java.lang.String value)
Add a value to given list, making the Project modified if the value is not already present in the list. |
private java.lang.String |
convertToAbsolute(java.lang.String fileName)
Converts a relative path to an absolute path if possible. |
private java.lang.String |
convertToRelative(java.lang.String srcFile,
java.lang.String base)
Converts a full path to a relative path if possible |
Project |
duplicate()
Return an exact copy of this Project. |
java.lang.String |
getAuxClasspathEntry(int n)
Get the n'th auxiliary classpath entry. |
java.util.List<java.lang.String> |
getAuxClasspathEntryList()
Return the list of aux classpath entries. |
java.lang.String |
getFile(int num)
Get the given file in the list of project files. |
java.lang.String[] |
getFileArray()
Get project files as an array of Strings. |
int |
getFileCount()
Get the number of files in the project. |
java.util.List<java.lang.String> |
getFileList()
Get the list of files, directories, and zip files in the project. |
java.util.List<java.lang.String> |
getImplicitClasspathEntryList()
Return the list of implicit classpath entries. |
private static java.lang.String |
getLine(java.io.BufferedReader reader)
Read a line from a BufferedReader, ignoring blank lines and comments. |
int |
getNumAuxClasspathEntries()
Get the number of auxiliary classpath entries. |
int |
getNumSourceDirs()
Get the number of source directories in the project. |
boolean |
getOption(java.lang.String option)
Retrieve the Options value. |
java.lang.String |
getProjectFileName()
Get the project filename. |
java.lang.String |
getSourceDir(int num)
Get the given source directory. |
java.lang.String[] |
getSourceDirArray()
Get source dirs as an array of Strings. |
java.util.List<java.lang.String> |
getSourceDirList()
Get the source dir list. |
boolean |
isModified()
Return whether or not this Project has unsaved modifications. |
private static java.lang.String |
makeAbsoluteCWD(java.lang.String fileName)
Make the given filename absolute relative to the current working directory. |
private void |
makeListAbsoluteProject(java.util.List<java.lang.String> list)
Make the given list of pathnames absolute relative to the absolute path of the project file. |
private void |
parseOption(java.lang.String option)
Parse one line in the [Options] section. |
private void |
processComponentJar(java.net.URL jarFileURL,
Project.WorkList workList,
java.util.List<java.lang.String> implicitClasspath)
Examine the manifest of a single zip/jar file for implicit classapth entries. |
void |
read(java.lang.String inputFile)
Read the project from an input file. |
void |
removeAuxClasspathEntry(int n)
Remove the n'th auxiliary classpath entry. |
void |
removeFile(int num)
Remove file at the given index in the list of project files |
void |
removeSourceDir(int num)
Remove source directory at given index. |
void |
setModified(boolean isModified)
Set whether or not this Project has unsaved modifications. |
void |
setProjectFileName(java.lang.String projectFileName)
Set the project filename. |
java.lang.String |
toString()
Convert to a string in a nice (displayable) format. |
static java.lang.String |
transformFilename(java.lang.String fileName)
Transform a user-entered filename into a proper filename, by adding the ".fb" file extension if it isn't already present. |
void |
write(java.lang.String outputFile,
boolean useRelativePaths,
java.lang.String relativeBase)
Save the project to an output file. |
void |
writeXML(XMLOutput xmlOutput)
Write this object to given XMLOutput. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final boolean DEBUG
private java.lang.String projectFileName
private java.util.Map<java.lang.String,java.lang.Boolean> optionsMap
private java.util.LinkedList<java.lang.String> fileList
private java.util.LinkedList<java.lang.String> srcDirList
private java.util.LinkedList<java.lang.String> auxClasspathEntryList
private boolean isModified
public static final java.lang.String UNNAMED_PROJECT
private static final java.lang.String OPTIONS_KEY
private static final java.lang.String JAR_FILES_KEY
private static final java.lang.String SRC_DIRS_KEY
private static final java.lang.String AUX_CLASSPATH_ENTRIES_KEY
public static final java.lang.String RELATIVE_PATHS
private static final java.lang.String JAR_ELEMENT_NAME
private static final java.lang.String AUX_CLASSPATH_ENTRY_ELEMENT_NAME
private static final java.lang.String SRC_DIR_ELEMENT_NAME
private static final java.lang.String FILENAME_ATTRIBUTE_NAME
private static final boolean FILE_IGNORE_CASE
Constructor Detail |
---|
public Project()
Method Detail |
---|
public Project duplicate()
public boolean isModified()
public void setModified(boolean isModified)
public java.lang.String getProjectFileName()
public void setProjectFileName(java.lang.String projectFileName)
projectFileName
- the new filenamepublic boolean addFile(java.lang.String fileName)
fileName
- the file to add
public boolean addSourceDir(java.lang.String dirName)
dirName
- the directory to add
public boolean getOption(java.lang.String option)
option
- the name of option to get
public int getFileCount()
public java.lang.String getFile(int num)
num
- the number of the file in the list of project files
public void removeFile(int num)
num
- index of the file to remove in the list of project filespublic java.util.List<java.lang.String> getFileList()
public int getNumSourceDirs()
public java.lang.String getSourceDir(int num)
num
- the number of the source directory
public void removeSourceDir(int num)
num
- index of the source directory to removepublic java.lang.String[] getFileArray()
public java.lang.String[] getSourceDirArray()
public java.util.List<java.lang.String> getSourceDirList()
public boolean addAuxClasspathEntry(java.lang.String auxClasspathEntry)
auxClasspathEntry
- the entry
public int getNumAuxClasspathEntries()
public java.lang.String getAuxClasspathEntry(int n)
public void removeAuxClasspathEntry(int n)
public java.util.List<java.lang.String> getAuxClasspathEntryList()
public java.util.List<java.lang.String> getImplicitClasspathEntryList()
"Class-Path"
attribute
of the manifest of the any jar file that is part of this project
or by the "Class-Path"
attribute of any directly or
indirectly referenced jar. The referenced jar files that exist
are the list of implicit classpath entries.
private void processComponentJar(java.net.URL jarFileURL, Project.WorkList workList, java.util.List<java.lang.String> implicitClasspath)
jarFileURL
- URL of the zip/jar fileworkList
- worklist of zip/jar files to examineimplicitClasspath
- list of implicit classpath entries foundpublic void write(java.lang.String outputFile, boolean useRelativePaths, java.lang.String relativeBase) throws java.io.IOException
outputFile
- name of output fileuseRelativePaths
- true if the project should be written
using only relative pathsrelativeBase
- if useRelativePaths is true,
this file is taken as the base directory in terms of which
all files should be made relative
java.io.IOException
- if an error occurs while writingpublic void read(java.lang.String inputFile) throws java.io.IOException
inputFile
- name of the input file to read the project from
java.io.IOException
- if an error occurs while readingprivate static java.lang.String getLine(java.io.BufferedReader reader) throws java.io.IOException
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.String transformFilename(java.lang.String fileName)
public void writeXML(XMLOutput xmlOutput) throws java.io.IOException
XMLWriteable
writeXML
in interface XMLWriteable
xmlOutput
- the XMLOutput for the document
java.io.IOException
private void parseOption(java.lang.String option) throws java.io.IOException
option
- one line in the [Options] section
java.io.IOException
private java.lang.String convertToRelative(java.lang.String srcFile, java.lang.String base)
srcFile
- path to convert
private java.lang.String convertToAbsolute(java.lang.String fileName) throws java.io.IOException
fileName
- path to convert
java.io.IOException
private static java.lang.String makeAbsoluteCWD(java.lang.String fileName)
private boolean addToListInternal(java.util.List<java.lang.String> list, java.lang.String value)
list
- the listvalue
- the value to be added
private void makeListAbsoluteProject(java.util.List<java.lang.String> list) throws java.io.IOException
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |