com.borland.jbuilder.node
Class JBProject

java.lang.Object
  |
  +--com.borland.primetime.node.Node
        |
        +--com.borland.primetime.node.UrlNode
              |
              +--com.borland.primetime.node.Project
                    |
                    +--com.borland.jbuilder.node.JBProject
All Implemented Interfaces:
java.lang.Comparable, NodeContainer

public class JBProject
extends Project
implements NodeContainer

Instances of JBProject represent JBuilder-specific projects. JBuilder projects have all the usual project characteristics plus access to project paths, package management facilities based on those paths and JOT.

The method getPaths() a representation of the project's current path selections. The methods findClassPathUrl(), findSourcePathUrl(), findPathUrl() and getPackageContent() provide means for getting up-to-date information about the contents visible along these paths.

The JOT package manager associated with a JBProject is available via the getJotPackages() method.


Field Summary
static java.lang.String BACKUP_DIRECTORY
          Name "bak" for the default backup directory.
static java.lang.String CLASSES_DIRECTORY
          Name "classes" for the default classes directory.
static java.lang.String DOC_DIRECTORY
          Name "doc" for the default documentation directory.
static javax.swing.Icon ICON
          The icon used for files for this class.
static int MODE_FULL_SOURCE_OR_CLASS
          Searches the project's full source and class paths (including the JDK and library sources) for subpackages.
static int MODE_PROJECT_SOURCE
          Searches the project's source paths (excluding the JDK and library sources) for subpackages, Java source and deployable nodes.
static java.lang.String PROJECT_DIRECTORY
          Name "jbproject" for the project directory.
static java.lang.String PROPERTY_BAKPATH
          Project property name "BackupPath" for recorded path.
static java.lang.String PROPERTY_DOCPATH
          Project property name "DocPath" for recorded path.
static java.lang.String PROPERTY_JDK
          Project property name "JDK" for the JDK name.
static java.lang.String PROPERTY_LIBRARIES
          Project property name "Libraries" for recorded path.
static java.lang.String PROPERTY_OUTPATH
          Project property name "OutPath" for recorded path.
static java.lang.String PROPERTY_SOURCEPATH
          Project property name "SourcePath" for recorded path.
static java.lang.String PROPERTY_WORKINGDIRECTORY
          Project property name "WorkingDirectory" for recorded path.
static java.lang.String SOURCE_DIRECTORY
          Name "src" for the default source directory.
 
Fields inherited from class com.borland.primetime.node.Project
CATEGORY_DEFAULT, ENCODING, PREFIX_UNTITLED, projectListeners
 
Fields inherited from class com.borland.primetime.node.Node
EMPTY_ARRAY, nodeListeners
 
Constructor Summary
JBProject(Url url)
          All Project subtypes must expose this constructor signature, but the constructor should never be used directly.
 
Method Summary
 Url findClassPathUrl(java.lang.String pathName)
          Locates the first location along the project's full class path where a given subpath exists.
 Url findPathUrl(Url[] path, java.lang.String pathName)
          Locates the first location along a list of path root where a given subpath exists.
 Url findSourcePathUrl(java.lang.String pathName)
          Locates the first location along the project's full source path where a given subpath exists.
 Node[] getChildren()
          Returns children of this node.
 com.borland.jbuilder.cmt.CmtComponents getComponents()
           
 com.borland.jbuilder.debugger.DebugInfoManager getDebugInfoManager()
          Returns manager for debug information.
 Node[] getDisplayChildren()
          Returns display children of this node.
 javax.swing.Icon getDisplayIcon()
          Return the icon used for this type of file.
 JotPackages getJotPackages()
           
 java.util.Set getPackageContent(Url[] path, java.lang.String packageName, int type)
          Returns a Set containing Url representations of all items found on the path in the specified package.
 Node[] getPackageNodes(java.lang.String packageName)
           
 Node[] getPackageNodes(java.lang.String packageName, int mode)
           
 ProjectPathSet getPaths()
           
 boolean hasChildren()
          Returns if this node has children.
 boolean hasDisplayChildren()
          Returns if this node has display children.
static void initOpenTool(byte majorVersion, byte minorVersion)
          OpenTool initialization.
 boolean isModified()
          Describes whether or not unsaved changes exist in the project's state.
protected  void postProjectLoad(Url rootUrl)
          Hook for doing postprocessing after the project is saved.
protected  void preProjectSave(Url rootUrl)
          Hook for doing preprocessing prior to project being saved.
 void refresh()
          Forces rebuild of the Automatic Packages display if automatic packages are enabled.
protected  void setUrl(Url url)
          Used internally by rename() and saveAs() to change the underlying Url associated with the project.
 
Methods inherited from class com.borland.primetime.node.Project
addProjectListener, check, createFileNode, createProject, dumpAllNodes, dumpProjects, findNode, findNodes, findProject, fireChildrenChanged, fireNodeChanged, fireProjectPropertyChanged, getAutoProperty, getDisplayName, getDisplaySequence, getEncoding, getLongDisplayName, getNode, getProject, getProject, getProjectPath, getUrl, isNew, isPersistant, isProjectExtension, isProjectUrl, registerProjectClass, removeProjectListener, rename, revert, save, saveAs, setAutoProperty, setEncoding
 
Methods inherited from class com.borland.primetime.node.UrlNode
getSuggestedUrl
 
Methods inherited from class com.borland.primetime.node.Node
addNodeListener, compareTo, dumpNodes, dumpNodes, dumpNodes, equals, fireNodeRenamed, getNodeID, getParent, getProperties, getProperty, getProperty, getProperty, hashCode, makePersistant, removeNodeListener, setParent, setProperty, setProperty, setProperty, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ICON

public static final javax.swing.Icon ICON
The icon used for files for this class.

PROPERTY_SOURCEPATH

public static final java.lang.String PROPERTY_SOURCEPATH
Project property name "SourcePath" for recorded path.

PROPERTY_OUTPATH

public static final java.lang.String PROPERTY_OUTPATH
Project property name "OutPath" for recorded path.

PROPERTY_DOCPATH

public static final java.lang.String PROPERTY_DOCPATH
Project property name "DocPath" for recorded path.

PROPERTY_BAKPATH

public static final java.lang.String PROPERTY_BAKPATH
Project property name "BackupPath" for recorded path.

PROPERTY_WORKINGDIRECTORY

public static final java.lang.String PROPERTY_WORKINGDIRECTORY
Project property name "WorkingDirectory" for recorded path.

PROPERTY_LIBRARIES

public static final java.lang.String PROPERTY_LIBRARIES
Project property name "Libraries" for recorded path.

PROPERTY_JDK

public static final java.lang.String PROPERTY_JDK
Project property name "JDK" for the JDK name.

PROJECT_DIRECTORY

public static final java.lang.String PROJECT_DIRECTORY
Name "jbproject" for the project directory.

SOURCE_DIRECTORY

public static final java.lang.String SOURCE_DIRECTORY
Name "src" for the default source directory.

BACKUP_DIRECTORY

public static final java.lang.String BACKUP_DIRECTORY
Name "bak" for the default backup directory.

CLASSES_DIRECTORY

public static final java.lang.String CLASSES_DIRECTORY
Name "classes" for the default classes directory.

DOC_DIRECTORY

public static final java.lang.String DOC_DIRECTORY
Name "doc" for the default documentation directory.

MODE_FULL_SOURCE_OR_CLASS

public static final int MODE_FULL_SOURCE_OR_CLASS
Searches the project's full source and class paths (including the JDK and library sources) for subpackages. Includes nodes for Java source and deployable nodes from the full source path. If no Java source nodes are found, class nodes from the full class path are also included.

MODE_PROJECT_SOURCE

public static final int MODE_PROJECT_SOURCE
Searches the project's source paths (excluding the JDK and library sources) for subpackages, Java source and deployable nodes.
Constructor Detail

JBProject

public JBProject(Url url)
          throws DuplicateNodeException,
                 InvalidUrlException
All Project subtypes must expose this constructor signature, but the constructor should never be used directly. Use the static Project factory method getProject() instead.
Parameters:
url - The storage available to this node.
Throws:
DuplicateNodeException - if node already registered.
Method Detail

initOpenTool

public static void initOpenTool(byte majorVersion,
                                byte minorVersion)
OpenTool initialization.
Parameters:
majorVersion - Major release number for which OpenTool is being initialized.
minorVersion - Minor release number for which OpenTool is being initialized.

setUrl

protected void setUrl(Url url)
               throws DuplicateNodeException
Used internally by rename() and saveAs() to change the underlying Url associated with the project.
Overrides:
setUrl in class Project
Parameters:
url - The new Url to be associated with the project. This value must not be null.

getPaths

public ProjectPathSet getPaths()
Returns:
An instance of ProjectPathSet that describes the projects paths and dependancies, guaranteed to be non-null.

getComponents

public com.borland.jbuilder.cmt.CmtComponents getComponents()
Returns:
a CmtComponentManager interface that allows access to component functionality

getJotPackages

public JotPackages getJotPackages()
Returns:
An instance of the associated JotPackages interface for JOT clients, guaranteed to be non-null.

getPackageContent

public java.util.Set getPackageContent(Url[] path,
                                       java.lang.String packageName,
                                       int type)

Returns a Set containing Url representations of all items found on the path in the specified package. Items that occur in multiple places on the path are reported only once, at the location of the first occurence.

Parameters:
path - An array of Url roots to search.
packageName - The subpackage to search, similar to a Url relative path but using '.' as the path separator rather than a slash.
type - One of Filesystem.TYPE_DIRECTORY, Filesystem.TYPE_FILE, or Filesystem.TYPE_BOTH.

getPackageNodes

public Node[] getPackageNodes(java.lang.String packageName)
Parameters:
packageName - The subpackage to search, similar to a Url relative path but using '.' as the path separator rather than a slash.
Returns:
An array of Node instances representing the items found on the path.

getPackageNodes

public Node[] getPackageNodes(java.lang.String packageName,
                              int mode)
Parameters:
packageName - The subpackage to search, similar to a Url relative path but using '.' as the path separator rather than a slash.
mode - Controls the search used to find package elements. The MODE constants in this class define the avilable search techniques.
Returns:
An array of Node instances representing the items found on the path.

findPathUrl

public Url findPathUrl(Url[] path,
                       java.lang.String pathName)
Locates the first location along a list of path root where a given subpath exists.
Parameters:
path - An array of Url roots to search for the subpath. Must not be null.
pathName - A relative path (as defined by Url) to search for.
Returns:
The first matching Url on the path, or null if no such subpath is defined for any of the path roots.

findSourcePathUrl

public Url findSourcePathUrl(java.lang.String pathName)
Locates the first location along the project's full source path where a given subpath exists. The 'full' source path includes the project's sources and source for all libraries associated with the project.
Parameters:
pathName - A relative path (as defined by Url) to search for.
Returns:
The first matching Url on the path, or null if no such subpath is defined for any of the path roots.

findClassPathUrl

public Url findClassPathUrl(java.lang.String pathName)
Locates the first location along the project's full class path where a given subpath exists. The 'full' class path includes the project's classes and classes for all libraries associated with the project.
Parameters:
pathName - A relative path (as defined by Url) to search for.
Returns:
The first matching Url on the path, or null if no such subpath is defined for any of the path roots.

getDebugInfoManager

public com.borland.jbuilder.debugger.DebugInfoManager getDebugInfoManager()
Returns manager for debug information.
Returns:
Returns manager for debug information.

isModified

public boolean isModified()
Describes whether or not unsaved changes exist in the project's state.
Overrides:
isModified in class Project
Returns:
True if changes have been made that have not yet been saved to the project file.

preProjectSave

protected void preProjectSave(Url rootUrl)
Description copied from class: Project
Hook for doing preprocessing prior to project being saved.
Overrides:
preProjectSave in class Project
Following copied from class: com.borland.primetime.node.Project
Parameters:
rootUrl - Url for the project being saved.

postProjectLoad

protected void postProjectLoad(Url rootUrl)
Description copied from class: Project
Hook for doing postprocessing after the project is saved.
Overrides:
postProjectLoad in class Project
Following copied from class: com.borland.primetime.node.Project
Parameters:
rootUrl - Url for the project being saved.

refresh

public void refresh()
Forces rebuild of the Automatic Packages display if automatic packages are enabled.
Overrides:
refresh in class Project

hasChildren

public boolean hasChildren()
Returns if this node has children.
Overrides:
hasChildren in class Node
Returns:
Always returns true.

hasDisplayChildren

public boolean hasDisplayChildren()
Returns if this node has display children.
Overrides:
hasDisplayChildren in class Node
Returns:
Always returns true.

getChildren

public Node[] getChildren()
Returns children of this node.
Overrides:
getChildren in class Node
Returns:
Array of children Nodes.

getDisplayChildren

public Node[] getDisplayChildren()
Returns display children of this node.
Overrides:
getDisplayChildren in class Node
Returns:
Array of children Nodes.

getDisplayIcon

public javax.swing.Icon getDisplayIcon()
Return the icon used for this type of file.
Overrides:
getDisplayIcon in class Project
Returns:
The icon for this file type.