oracle.ide.model
Class PackageFolder
java.lang.Object
|
+--oracle.ide.model.DefaultDisplayable
|
+--oracle.ide.model.DefaultElement
|
+--oracle.ide.model.DefaultFolder
|
+--oracle.ide.model.HierarchicalFolder
|
+--oracle.ide.model.PackageFolder
- All Implemented Interfaces:
- 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.
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
URL s 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 java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface oracle.ide.model.Data |
getData |
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 URL
s 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.
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.
- Overrides:
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.
- Overrides:
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.
- Overrides:
getShortLabel
in class HierarchicalFolder
- Following copied from interface:
oracle.ide.model.Displayable
- Returns:
- a short descriptive label of the
Displayable
that can be shown to the user.
getLongLabel
public java.lang.String getLongLabel()
- Returns the long label for this
Displayable
. This
implementation returns the full package name.
- Overrides:
getLongLabel
in class HierarchicalFolder
- Following copied from interface:
oracle.ide.model.Displayable
- Returns:
- a long descriptive label of the
Displayable
that
can be shown to the user.
getToolTipText
public java.lang.String getToolTipText()
- Returns the tool tip for this
Displayable
. This
implementation returns the full package name.
- Overrides:
getToolTipText
in class HierarchicalFolder
- Following copied from interface:
oracle.ide.model.Displayable
- Returns:
- the tooltip to show when the mouse pointer pauses over a
UI component that represents this
Displayable
.
getIcon
public javax.swing.Icon getIcon()
- Returns the icon tip for this
Displayable
. This
implementation returns the package icon.
- Overrides:
getIcon
in class DefaultFolder
- Following copied from class:
oracle.ide.model.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.
- Overrides:
equals
in class java.lang.Object
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
URL
s for this package.