|
Extension SDK 9.0.5 | ||||||||||
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 | |
static class |
PackageFilter.PackageFactory
|
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, urlFilter, VIEW_HIERARCHICALLY, VIEW_PROJECT_FILES_ONLY, VIEW_SORT_BY_TYPE |
Fields inherited from class oracle.ide.model.DefaultFilter |
folderFirstComparator, folderFirstComparator2, sortedComparator |
Fields inherited from interface oracle.ide.explorer.ChildFilter |
NO_OPTIONS |
Constructor Summary | |
PackageFilter()
Constructs a PackageFilter . |
Method Summary | |
protected void |
addFolderToChildMap(HierarchicalFolder folder,
java.lang.Object key)
Method called when building the childMap and the folder
has no children. |
protected HierarchicalFolder |
buildOtherChildrenMap(Element element,
HierarchicalFolder parent,
java.util.Map otherChildrenMap,
int count)
|
void |
cachePut(java.net.URL url,
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 TNode |
cacheRemove(java.net.URL key)
Overrides superclass cache(TNode) to ensure that all
URL s along the URLPath for a PackageFolder are
unmapped to the TNode for that package in the cache. |
void |
closeChildren()
Called when project is closed. |
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. |
static java.lang.String |
convertUrlToPackageName(java.net.URL url,
URLPath srcPath)
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 static java.lang.String |
convertUrlToRelativeSpec(java.net.URL url,
URLPath sourcePath)
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 . |
static Factory |
findFactory(Project project)
Find the factory assicated with the specified project . |
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. |
PackageFilter.PackageFactory |
getFactory()
|
static PackageFilter.PackageFactory |
getFactory(Project project)
Get the factory assicated with the specified project . |
protected java.lang.Object |
getFolderKey(java.net.URL url)
Returns the folder key for the folder that contains the specified URL . |
protected CategoryFolder |
getMiscFolder()
Return the "Miscellaneous Files" CategoryFolder for this
filter. |
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 boolean |
handleHierarchicalFolder(java.lang.Object item,
java.util.Collection out)
|
protected TNode |
handleOtherAdditions(java.util.Map additionsMap,
TreeExplorer tree,
TNode childNode)
|
protected TNode |
handleOtherRemovals(java.util.Map additionsMap,
TreeExplorer tree,
TNode childNode)
|
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 boolean |
isNodeContainerInProject(TNode node)
Returns true if the specified TNode 's Container is in the project. |
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. |
static Factory |
removeFactory(Project project)
Remove the factory assicated with the specified project . |
void |
setOwner(TNode owner)
Sets the node that owns this filter. |
void |
uncache(TNode node)
Overrides superclass cache(TNode) to ensure that all
URL s along the URLPath for a PackageFolder are
unmapped to the TNode for that package in the cache. |
Methods inherited from class oracle.ide.model.DefaultFilter |
canUpdate, checkElementAttributes, getComparator, getIcon, getLongLabel, getOwner, getShortLabel, getToolTipText, refreshExplorerNode, 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 static PackageFilter.PackageFactory getFactory(Project project)
project
.
If none available one is created.
public static Factory removeFactory(Project project)
project
.
public static Factory findFactory(Project project)
project
.
If none available null is returned.
public static java.lang.String convertUrlToPackageName(java.net.URL url, URLPath srcPath)
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.public void cachePut(java.net.URL url, 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.
cachePut
in class HierarchicalFilter
protected TNode cacheRemove(java.net.URL key)
cache(TNode)
to ensure that all
URL
s along the URLPath
for a PackageFolder
are
unmapped to the TNode
for that package in the cache.
cacheRemove
in class HierarchicalFilter
public void uncache(TNode node)
cache(TNode)
to ensure that all
URL
s along the URLPath
for a PackageFolder
are
unmapped to the TNode
for that package in the cache.
uncache
in interface ChildFilter
uncache
in class HierarchicalFilter
public void closeChildren()
closeChildren
in interface ChildFilter
closeChildren
in class HierarchicalFilter
public PackageFilter.PackageFactory getFactory()
PackageFilter.PackageFactory
used to create package instances.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 void setOwner(TNode owner)
ChildFilter
setOwner
in interface ChildFilter
setOwner
in class DefaultFilter
public int getType()
FilterTypes.PACKAGE_LIST_FILTER
.
getType
in interface ChildFilter
getType
in class DefaultFilter
protected boolean handleHierarchicalFolder(java.lang.Object item, java.util.Collection out)
handleHierarchicalFolder
in class HierarchicalFilter
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 void addFolderToChildMap(HierarchicalFolder folder, java.lang.Object key)
HierarchicalFilter
folder
has no children. This implementation does nothin.
addFolderToChildMap
in class HierarchicalFilter
protected CategoryFolder getMiscFolder()
HierarchicalFilter
CategoryFolder
for this
filter. This folder contains all children of the owning folder that
are not on the source path.
getMiscFolder
in class HierarchicalFilter
protected HierarchicalFolder buildOtherChildrenMap(Element element, HierarchicalFolder parent, java.util.Map otherChildrenMap, int count)
buildOtherChildrenMap
in class HierarchicalFilter
protected TNode handleOtherRemovals(java.util.Map additionsMap, TreeExplorer tree, TNode childNode)
handleOtherRemovals
in class HierarchicalFilter
protected TNode handleOtherAdditions(java.util.Map additionsMap, TreeExplorer tree, TNode childNode)
handleOtherAdditions
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 static java.lang.String convertUrlToRelativeSpec(java.net.URL url, URLPath sourcePath)
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.sourcePath
- the URLPath
for the sources.
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.protected boolean isNodeContainerInProject(TNode node)
true
if the specified TNode
's Container
is in the project.
isNodeContainerInProject
in class HierarchicalFilter
|
Extension SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.