edu.umd.cs.findbugs

Class Project

  • All Implemented Interfaces:
    XMLWriteable


    public class Project
    extends Object
    implements XMLWriteable
    A project in the GUI. This consists of some number of Jar files to analyze for bugs, and optionally

    • some number of source directories, for locating the program's source code
    • some number of auxiliary classpath entries, for locating classes referenced by the program which the user doesn't want to analyze
    • some number of boolean options
    Author:
    David Hovemeyer
    • Constructor Detail

      • Project

        public Project()
        Create an anonymous project.
    • Method Detail

      • setPluginStatusTrinary

        public void setPluginStatusTrinary(String pluginId,
                                  Boolean enabled)
      • setConfiguration

        public void setConfiguration(@Nonnull
                            UserPreferences configuration)
        Parameters:
        configuration - The configuration to set, non null
      • getCloudProperties

        public Properties getCloudProperties()
        Returns:
        Returns the cloudProperties.
      • setCloudProperties

        public void setCloudProperties(Properties cloudProperties)
        Parameters:
        cloudProperties - The cloudProperties to set.
      • duplicate

        public Project duplicate()
        Return an exact copy of this Project.
      • isGuiAvaliable

        public boolean isGuiAvaliable()
      • add

        public void add(Project project2)
        add information from project2 to this project
      • appendWithoutDuplicates

        public static <T> List<T> appendWithoutDuplicates(List<T> lst1,
                                          List<T> lst2)
      • setCurrentWorkingDirectory

        public void setCurrentWorkingDirectory(File f)
      • isModified

        public boolean isModified()
        Return whether or not this Project has unsaved modifications.
      • setModified

        public void setModified(boolean isModified)
        Set whether or not this Project has unsaved modifications.
      • addFile

        public boolean addFile(String fileName)
        Add a file to the project.
        Parameters:
        fileName - the file to add
        Returns:
        true if the file was added, or false if the file was already present
      • addSourceDir

        public boolean addSourceDir(String dirName)
        Add a source directory to the project.
        Parameters:
        dirName - the directory to add
        Returns:
        true if the source directory was added, or false if the source directory was already present
      • addWorkingDir

        public boolean addWorkingDir(String dirName)
        Add a working directory to the project.
        Parameters:
        dirName - the directory to add
        Returns:
        true if the working directory was added, or false if the working directory was already present
      • getFileCount

        public int getFileCount()
        Get the number of files in the project.
        Returns:
        the number of files in the project
      • getFile

        public String getFile(int num)
        Get the given file in the list of project files.
        Parameters:
        num - the number of the file in the list of project files
        Returns:
        the name of the file
      • removeFile

        public void removeFile(int num)
        Remove file at the given index in the list of project files
        Parameters:
        num - index of the file to remove in the list of project files
      • getFileList

        public List<String> getFileList()
        Get the list of files, directories, and zip files in the project.
      • getNumSourceDirs

        public int getNumSourceDirs()
        Get the number of source directories in the project.
        Returns:
        the number of source directories in the project
      • getSourceDir

        public String getSourceDir(int num)
        Get the given source directory.
        Parameters:
        num - the number of the source directory
        Returns:
        the source directory
      • removeSourceDir

        public void removeSourceDir(int num)
        Remove source directory at given index.
        Parameters:
        num - index of the source directory to remove
      • getFileArray

        public String[] getFileArray()
        Get project files as an array of Strings.
      • getSourceDirArray

        public String[] getSourceDirArray()
        Get source dirs as an array of Strings.
      • getSourceDirList

        public List<String> getSourceDirList()
        Get the source dir list.
      • addAuxClasspathEntry

        public boolean addAuxClasspathEntry(String auxClasspathEntry)
        Add an auxiliary classpath entry
        Parameters:
        auxClasspathEntry - the entry
        Returns:
        true if the entry was added successfully, or false if the given entry is already in the list
      • getNumAuxClasspathEntries

        public int getNumAuxClasspathEntries()
        Get the number of auxiliary classpath entries.
      • getAuxClasspathEntry

        public String getAuxClasspathEntry(int n)
        Get the n'th auxiliary classpath entry.
      • removeAuxClasspathEntry

        public void removeAuxClasspathEntry(int n)
        Remove the n'th auxiliary classpath entry.
      • getAuxClasspathEntryList

        public List<String> getAuxClasspathEntryList()
        Return the list of aux classpath entries.
      • getImplicitClasspathEntryList

        @Deprecated
        public List<String> getImplicitClasspathEntryList()
        Deprecated. FindBugs2 and ClassPathBuilder take care of this automatically
        Return the list of implicit classpath entries. The implicit classpath is computed from the closure of the set of jar files that are referenced by the "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.
      • write

        @Deprecated
        public void write(String outputFile,
                            boolean useRelativePaths,
                            String relativeBase)
                   throws IOException
        Deprecated. 
        Save the project to an output file.
        Parameters:
        outputFile - name of output file
        useRelativePaths - true if the project should be written using only relative paths
        relativeBase - if useRelativePaths is true, this file is taken as the base directory in terms of which all files should be made relative
        Throws:
        IOException - if an error occurs while writing
      • readProject

        public static Project readProject(String argument)
                                   throws IOException
        Read Project from named file.
        Parameters:
        argument - command line argument containing project file name
        Returns:
        the Project
        Throws:
        IOException
      • toString

        public String toString()
        Convert to a string in a nice (displayable) format.
        Overrides:
        toString in class Object
      • transformFilename

        public static String transformFilename(String fileName)
        Transform a user-entered filename into a proper filename, by adding the ".fb" file extension if it isn't already present.
      • setTimestamp

        public void setTimestamp(long timestamp)
        Make the given list of pathnames absolute relative to the absolute path of the project file. private void makeListAbsoluteProject(List list) { List replace = new LinkedList(); for (String fileName : list) { fileName = convertToAbsolute(fileName); replace.add(fileName); } list.clear(); list.addAll(replace); }
      • addTimestamp

        public void addTimestamp(long timestamp)
      • getTimestamp

        public long getTimestamp()
      • setProjectName

        public void setProjectName(String projectName)
      • getProjectName

        public String getProjectName()
      • setSuppressionFilter

        public void setSuppressionFilter(@Nonnull
                                Filter suppressionFilter)
      • getSuppressionFilter

        @Nonnull
        public Filter getSuppressionFilter()
      • setGuiCallback

        public void setGuiCallback(IGuiCallback guiCallback)
      • getResolvedSourcePaths

        public Iterable<String> getResolvedSourcePaths()

Copyright © 2003–2015. All rights reserved.