Extension SDK

oracle.ide.model
Class PackageFolder

java.lang.Object
  extended byoracle.ide.model.DefaultDisplayable
      extended byoracle.ide.model.DefaultElement
          extended byoracle.ide.model.DefaultFolder
              extended byoracle.ide.model.HierarchicalFolder
                  extended byoracle.ide.model.PackageFolder
All Implemented Interfaces:
Category, Data, Displayable, Element, Folder, Locatable

public final class PackageFolder
extends HierarchicalFolder

The PackageFolder class encapsulates a package element managed by the PackageFilter. A package folder may correspond to more than one physical directory on the file system; each directory, however, should correspond to the same package directory. This list of directories that this package folder represents is maintained in an URLPath.

For example, if the project's source path is:

    file:/Z:/jdev/src/java;file:/Z:/jbuilder/src/java
 
and the package name is "oracle", then the package folder's URLPath would be:
    file:/Z:/jdev/src/java/oracle;file:/Z:/jbuilder/src/java/oracle
 
While the PackageFolder technically implements the Locatable interface, the URL returned by the HierarchicalFolder.getURL() method is simply the first URL along this package's URLPath. We should instead return a synthetic URL that represents this package but does not correspond to a physical directory on the file system.


Field Summary
 
Fields inherited from class oracle.ide.model.HierarchicalFolder
filter, isOpen, longName, shortName, uniqueNames, url
 
Fields inherited from class oracle.ide.model.DefaultFolder
_children
 
Fields inherited from interface oracle.ide.model.Category
UNDEFINED
 
Constructor Summary
protected PackageFolder(java.lang.Object key, PackageFilter filter)
          Protected constructor that constructs a PackageFolder given a folder key and a PackageFilter that will manage this package folder.
  PackageFolder(java.net.URL url, PackageFilter filter)
          Constructs a PackageFolder given an URL and a PackageFilter that will manage this package folder.
 
Method Summary
protected  void addToPath(java.net.URL url)
          Adds an URL to the URLPath for this package.
 boolean equals(java.lang.Object obj)
          One PackageFolder is equal to another if their #urlPath members are identical.
 javax.swing.Icon getIcon()
          Returns the icon tip for this Displayable.
 java.lang.String getLongLabel()
          Returns the long label for this Displayable.
protected  URLPath getPath()
          Returns the URLPath that represents the list of directory URLs for this package.
 java.lang.String getShortLabel()
          Returns the short label for this Displayable.
 java.lang.String getToolTipText()
          Returns the tool tip for this Displayable.
protected  void init(java.lang.String packageName)
          Initializes the PackageFolder from the package name.
protected  boolean isInProject()
          Tests whether any Element objects belonging to the project are contained by this package folder.
protected  java.net.URL[] list()
          Lists the files and directories belonging to this package folder.
 
Methods inherited from class oracle.ide.model.HierarchicalFolder
add, canAdd, canRemove, getCategory, getChildren, getURL, getViewAllFiles, getViewHierarchically, remove, removeAll, setURL
 
Methods inherited from class oracle.ide.model.DefaultFolder
containsChild, copyToImpl, equalsImpl, mayHaveChildren, size
 
Methods inherited from class oracle.ide.model.DefaultElement
getAttributes, getData
 
Methods inherited from class oracle.ide.model.DefaultDisplayable
toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface oracle.ide.model.Element
getAttributes
 
Methods inherited from interface oracle.ide.model.Data
getData
 
Methods inherited from interface oracle.ide.model.Displayable
toString
 

Constructor Detail

PackageFolder

public PackageFolder(java.net.URL url,
                     PackageFilter filter)
Constructs a PackageFolder given an URL and a PackageFilter that will manage this package folder. The given URL represents the first entry on this package's URLPath; additional URLs can be added to the URLPath by calling the addToPath(URL) method.

Parameters:
url - the URL for this folder.
filter - the HierarchicalFilter that manages this folder.

PackageFolder

protected PackageFolder(java.lang.Object key,
                        PackageFilter filter)
Protected constructor that constructs a PackageFolder given a folder key and a PackageFilter that will manage this package folder. The given key should be created by PackageFilter.getFolderKey(URL) or PackageFilter.getParentKey(Object).

This constructor is not for general use and should only ever be called by the PackageFilter.createFolder(Object) method.

Parameters:
key - the key for this folder.
filter - the HierarchicalFilter that manages this folder.
Method Detail

list

protected java.net.URL[] list()
Lists the files and directories belonging to this package folder. This implementation calls the filter to list the contents of each URL along this package's URLPath and merge them together to eliminate duplicates.

Specified by:
list in class HierarchicalFolder
Returns:
an array of URL objects naming the files and directories contained by the URLPath for this package folder; if the contents of this package folder cannot be listed, then null is returned.

isInProject

protected boolean isInProject()
Tests whether any Element objects belonging to the project are contained by this package folder.

Specified by:
isInProject in class HierarchicalFolder
Returns:
returns true if any of the URL entries along this package's URLPath contain one or more Element objects belonging to the project.

getShortLabel

public java.lang.String getShortLabel()
Returns the short label for this Displayable. This implementation returns the full package name when in flat view, and it returns the bottom-most package name when in nested view.

Specified by:
getShortLabel in interface Displayable
Overrides:
getShortLabel in class HierarchicalFolder

getLongLabel

public java.lang.String getLongLabel()
Returns the long label for this Displayable. This implementation returns the full package name.

Specified by:
getLongLabel in interface Displayable
Overrides:
getLongLabel in class HierarchicalFolder

getToolTipText

public java.lang.String getToolTipText()
Returns the tool tip for this Displayable. This implementation returns the full package name.

Specified by:
getToolTipText in interface Displayable
Overrides:
getToolTipText in class HierarchicalFolder

getIcon

public javax.swing.Icon getIcon()
Returns the icon tip for this Displayable. This implementation returns the package icon.

Specified by:
getIcon in interface Displayable
Overrides:
getIcon in class DefaultFolder
See Also:
Displayable.getIcon()

equals

public boolean equals(java.lang.Object obj)
One PackageFolder is equal to another if their #urlPath members are identical.


init

protected void init(java.lang.String packageName)
Initializes the PackageFolder from the package name. The URLPath for the package is automatically calculated from the package name and the filter's sourcepath.


addToPath

protected void addToPath(java.net.URL url)
Adds an URL to the URLPath for this package. The URL is assumed to be contained by the source path. The URL is also assumed to correspond to the same package directory as every other URL in the #urlPath.

Parameters:
url - the URL to add to the path.

getPath

protected URLPath getPath()
Returns the URLPath that represents the list of directory URLs for this package.


Extension SDK

 

Copyright ©1997, 2003, Oracle. All rights reserved.