|
Extension SDK | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectoracle.ide.model.DefaultFilter
oracle.ide.model.HierarchicalFilter
oracle.ide.model.PackageFilter
The PackageFilter
organizes the children of a source folder
into a package structure view. The PackageFilter
typically
organizes its children into a flat package structure view, with all
subpackages displayed at the top-level. The PackageFilter
can also organize its children into a nested package structure view that
is reminiscent of the typical DirectoryFilter
structure, but
that is generally less desirable when viewing Java source files. For
performance reasons, however, the nested package structure may be
preferable to the flat package structure when viewing all files on the
source path rather than just project files.
Nested Class Summary |
Nested classes inherited from class oracle.ide.model.HierarchicalFilter |
HierarchicalFilter.HierarchicalComparator |
Nested classes inherited from class oracle.ide.model.DefaultFilter |
DefaultFilter.SortedComparator, DefaultFilter.SortedFolderFirstComparator |
Field Summary |
Fields inherited from class oracle.ide.model.HierarchicalFilter |
childMap, children, isOpen, miscFolder, nodeCache, NULL_KEY, options, sourcePath, TOP_FOLDER_KEY, uniqueNames, urlFilter, VIEW_HIERARCHICALLY, VIEW_PROJECT_FILES_ONLY |
Fields inherited from class oracle.ide.model.DefaultFilter |
folderFirstComparator, sortedComparator |
Fields inherited from interface oracle.ide.explorer.ChildFilter |
NO_OPTIONS |
Constructor Summary | |
PackageFilter()
Constructs a PackageFilter . |
Method Summary | |
void |
cache(TNode node)
Overrides superclass cache(TNode) to ensure that all
URL s along the URLPath for a PackageFolder are
mapped to the TNode for that package in the cache. |
protected java.lang.String |
convertUrlToPackageName(java.net.URL url)
Converts the specified URL to its corresponding package name;
if the URL specifies a file, then the parent directory URL of the file is used. |
protected java.lang.String |
convertUrlToRelativeSpec(java.net.URL url)
Converts the specified URL to its corresponding relative
directory spec; if the URL specifies a file, then the
parent directory URL of the file is used. |
protected Folder |
createFolder(java.lang.Object key)
Creates a PackageFolder instance given the specified folder
key. |
protected Folder |
createFolder(java.net.URL url)
Creates a PackageFolder instance given the specified directory
URL . |
protected java.lang.String |
getChildName(java.lang.Object parentKey,
java.lang.Object childKey)
Returns just the name part of a child folder given a parent folder key and the child folder key, or null if the first folder key
is not a parent key of the second folder key. |
protected java.lang.Object |
getFolderKey(java.net.URL url)
Returns the folder key for the folder that contains the specified URL . |
protected java.lang.Object |
getParentKey(java.lang.Object key)
Returns the parent folder key for the specified folder key. |
int |
getType()
Returns FilterTypes.PACKAGE_LIST_FILTER . |
protected void |
initChildren()
Initializes the collection of top-level children for the filter. |
protected boolean |
isInSourcePath(java.net.URL url)
Overrides superclass isInSourcePath(URL) to ensure that
the URL also corresponds to a valid package name. |
protected static boolean |
isValidPackageSpec(java.lang.String relativeSpec)
Returns true if the relative directory spec corresponds
to a valid package name. |
protected static java.lang.String |
keyToPackageName(java.lang.Object key)
Converts a folder key to a package name. |
protected static java.lang.Object |
packageNameToKey(java.lang.String str)
Converts a package name to a folder key. |
protected static java.lang.String |
relativeSpecToPackageName(java.lang.String relativeSpec)
Converts a relative directory spec to a package name. |
Methods inherited from class oracle.ide.model.HierarchicalFilter |
add, canRefresh, childrenAdded, childrenRemoved, clearChildren, createElement, getCategoryFolder, getChildren, getFolder, getFolderChildren, getFolderChildren, getMiscFolder, getOptions, getProject, getSourcePath, getSourcePathEntry, getURLFilter, getViewAllFiles, getViewHierarchically, hasMiscFiles, initializeChildMap, initMiscFolder, isDirInProject, isParentKey, isSourcePathEntry, list, list, refresh, remove, setComparator, setOptions, setSourcePath, setURLFilter, setViewAllFiles, setViewHierarchically, uncache, update |
Methods inherited from class oracle.ide.model.DefaultFilter |
getComparator, getIcon, getLongLabel, getOwner, getShortLabel, getToolTipText, refreshExplorerNode, setOwner, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public PackageFilter()
PackageFilter
.
Method Detail |
public void cache(TNode node)
cache(TNode)
to ensure that all
URL
s along the URLPath
for a PackageFolder
are
mapped to the TNode
for that package in the cache.
cache
in interface ChildFilter
cache
in class HierarchicalFilter
protected boolean isInSourcePath(java.net.URL url)
isInSourcePath(URL)
to ensure that
the URL
also corresponds to a valid package name. If the
URL
does not correspond to a valid package, this method
returns false
.
isInSourcePath
in class HierarchicalFilter
url
- the URL
to test; the URL
can correspond to
either a file or a directory.public int getType()
FilterTypes.PACKAGE_LIST_FILTER
.
getType
in interface ChildFilter
getType
in class DefaultFilter
protected Folder createFolder(java.net.URL url)
PackageFolder
instance given the specified directory
URL
.
createFolder
in class HierarchicalFilter
url
- the URL
of the Folder
to create.
Folder
instance, or null
if the Folder
could not be created for the specified URL
.protected Folder createFolder(java.lang.Object key)
PackageFolder
instance given the specified folder
key.
createFolder
in class HierarchicalFilter
Folder
instance, or null
if the Folder
could not be created for the specified folder key.getFolderKey(URL)
,
getParentKey(Object)
protected java.lang.Object getFolderKey(java.net.URL url)
URL
. The folder key for a PackageFolder
is simply the
fully qualified package name of the folder.
getFolderKey
in class HierarchicalFilter
url
- the directory URL
of the folder; if the URL
specifies a file, then the parent URL
of the file is used.
URL
, or
HierarchicalFilter.NULL_KEY
if the URL
is not on the source path.protected java.lang.Object getParentKey(java.lang.Object key)
PackageFolder
is the fully qualified package
name of the parent package, or HierarchicalFilter.TOP_FOLDER_KEY
for the
top-level package.
getParentKey
in class HierarchicalFilter
key
- the folder key to get the parent key of.
HierarchicalFilter.NULL_KEY
if the
parent folder is no longer on the source path.getFolderKey(URL)
protected java.lang.String getChildName(java.lang.Object parentKey, java.lang.Object childKey)
null
if the first folder key
is not a parent key of the second folder key.Since each folder key is just the fully qualified package name, just return the tail of the child's key skipping any leading dot character.
getChildName
in class HierarchicalFilter
parentKey
- the prospective parent folder key.childKey
- the prospective child folder key.protected void initChildren()
The children of the filter consists of all top-level PackageFolder
objects (when the filter is in flat view, all packages
in the project are considered top-level packages).
All source files that are in the top-level package are also considered children of the filter (i.e., all source files that are direct children of one of the directories on the sourcepath).
initChildren
in class HierarchicalFilter
protected static java.lang.Object packageNameToKey(java.lang.String str)
protected static java.lang.String keyToPackageName(java.lang.Object key)
protected static java.lang.String relativeSpecToPackageName(java.lang.String relativeSpec)
protected static boolean isValidPackageSpec(java.lang.String relativeSpec)
true
if the relative directory spec corresponds
to a valid package name. Each directory component in the relative
directory spec must be a valid Java identifier.
protected java.lang.String convertUrlToRelativeSpec(java.net.URL url)
URL
to its corresponding relative
directory spec; if the URL
specifies a file, then the
parent directory URL
of the file is used.
The relative spec is obtained by finding the URL
of the
source path entry that contains the target URL
, and then
calling URLFileSystem.toRelativeSpec(URL,URL)
on the two
URL
s.
url
- the URL
to get the relative spec for.
URL
, or null
if the URL
is not on
the source path.protected java.lang.String convertUrlToPackageName(java.net.URL url)
URL
to its corresponding package name;
if the URL
specifies a file, then the parent directory URL
of the file is used.
The package name is obtained by calculating the relative directory
between the specified URL
and the URL
of the source
path entry that contains it, replacing '/' characters with '.'
characters.
url
- the URL
to get the package name for.
URL
, or null
if the URL
is not on the source
path.
|
Extension SDK | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright ©1997, 2003, Oracle. All rights reserved.