Extension SDK 9.0.5

oracle.ide.model
Class DirectoryFilter

java.lang.Object
  extended byoracle.ide.model.DefaultFilter
      extended byoracle.ide.model.HierarchicalFilter
          extended byoracle.ide.model.DirectoryFilter
All Implemented Interfaces:
ChildFilter, Displayable

public final class DirectoryFilter
extends HierarchicalFilter

The DirectoryFilter organizes the children of a source folder into a directory structure view. A DirectoryFilter typically organizes its children in a nested directory structure view. As a subclass of HierarchicalFilter, the DirectoryFilter can also theoretically display its children in a flat directory structure view, although it is not particularly meaningful for it to do so.


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, 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
DirectoryFilter()
          Constructs a DirectoryFilter.
 
Method Summary
protected  Folder createFolder(java.lang.Object key)
          Creates a DirectoryFolder instance given the specified folder key.
protected  Folder createFolder(java.net.URL url)
          Creates a DirectoryFolder 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.
 java.lang.String getToolTipText()
          Returns the filter owner tool tip text.
 int getType()
          Returns FilterTypes.DIRECTORY_FILTER.
protected  void initChildren()
          Initializes the collection of top-level children for the filter.
protected static java.net.URL keyToURL(java.lang.Object key)
          Converts a folder key to an URL.
protected static java.lang.Object urlToKey(java.net.URL url)
          Converts an URL to a folder key.
protected  TNode validateParent(TNode cachedParent, TNode parent, java.net.URL parentURL, java.net.URL childURL)
          This method makes sure that the right parent is used to parent the child pointed by the childURL.
 
Methods inherited from class oracle.ide.model.HierarchicalFilter
add, addElementToChildMap, addFolderToChildMap, buildOtherChildrenMap, cache, cacheGet, cachePut, cacheRemove, canRefresh, childrenAdded, childrenRemoved, clearChildren, closeChildren, containsChild, createElement, createElementNode, createFolderNode, findOrCreateChildList, getCategoryFolder, getChildren, getFolder, getFolderChildren, getFolderChildren, getFolderKey, getMiscFolder, getOptions, getProject, getSourcePath, getSourcePathEntry, getSourcePathEntry, getURLFilter, getViewAllFiles, getViewHierarchically, handleHierarchicalFolder, handleOtherAdditions, handleOtherRemovals, hasMiscFiles, initializeChildMap, initMiscFolder, isDirInProject, isHierarchicalFolder, isInSourcePath, isNodeContainerInProject, isParentKey, isSortByType, isSourcePathEntry, isStrict, list, list, refresh, remove, removeElementFromChildMap, removeElementNode, reset, setComparator, setNodeInProject, setOptions, setSortByType, setSourcePath, setURLFilter, setViewAllFiles, setViewHierarchically, uncache, update, updateTreeComparatorOptions
 
Methods inherited from class oracle.ide.model.DefaultFilter
canUpdate, checkElementAttributes, getComparator, getIcon, getLongLabel, getOwner, getShortLabel, refreshExplorerNode, setOwner, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DirectoryFilter

public DirectoryFilter()
Constructs a DirectoryFilter.

Method Detail

getType

public int getType()
Returns FilterTypes.DIRECTORY_FILTER.

Specified by:
getType in interface ChildFilter
Overrides:
getType in class DefaultFilter

getToolTipText

public java.lang.String getToolTipText()
Returns the filter owner tool tip text.

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

createFolder

protected Folder createFolder(java.net.URL url)
Creates a DirectoryFolder instance given the specified directory URL.

Specified by:
createFolder in class HierarchicalFilter
Parameters:
url - the URL of the Folder to create.
Returns:
a Folder instance, or null if the Folder could not be created for the specified URL.

createFolder

protected Folder createFolder(java.lang.Object key)
Creates a DirectoryFolder instance given the specified folder key.

Specified by:
createFolder in class HierarchicalFilter
Returns:
a Folder instance, or null if the Folder could not be created for the specified folder key.
See Also:
getFolderKey(URL), getParentKey(Object)

getFolderKey

protected java.lang.Object getFolderKey(java.net.URL url)
Returns the folder key for the folder that contains the specified URL. The folder key for a DirectoryFolder is simply string version of the URL for that directory.

Specified by:
getFolderKey in class HierarchicalFilter
Parameters:
url - the directory URL of the folder; if the URL specifies a file, then the parent URL of the file is used.
Returns:
the key of the folder containing the specified URL, or HierarchicalFilter.NULL_KEY if the URL is not on the source path.

getParentKey

protected java.lang.Object getParentKey(java.lang.Object key)
Returns the parent folder key for the specified folder key. The parent key for a DirectoryFolder is the string version of the directory's parent directory URL.

Specified by:
getParentKey in class HierarchicalFilter
Parameters:
key - the folder key to get the parent key of.
Returns:
the key of the parent folder, or HierarchicalFilter.NULL_KEY if the parent folder is no longer on the source path.
See Also:
getFolderKey(URL)

getChildName

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.

Since each folder key is the folder's directory URL, just return the tail of the child's key URL-spec string without the trailing slash.

Specified by:
getChildName in class HierarchicalFilter
Parameters:
parentKey - the prospective parent folder key.
childKey - the prospective child folder key.

initChildren

protected void initChildren()
Initializes the collection of top-level children for the filter.

When there is more than one directory on the project's sourcepath, then a DirectoryFolder is created for each entry on the sourcepath, and those folders are added to the collection of top-level children.

When there is only one directory on the sourcepath, then the children of that directory are instead added to the collection of top-level children. This reduces the amount of nesting in the Navigator.

Specified by:
initChildren in class HierarchicalFilter

urlToKey

protected static java.lang.Object urlToKey(java.net.URL url)
Converts an URL to a folder key.


keyToURL

protected static java.net.URL keyToURL(java.lang.Object key)
Converts a folder key to an URL.


validateParent

protected TNode validateParent(TNode cachedParent,
                               TNode parent,
                               java.net.URL parentURL,
                               java.net.URL childURL)
Description copied from class: HierarchicalFilter
This method makes sure that the right parent is used to parent the child pointed by the childURL. This is a workaround rename bug 3323473.

Overrides:
validateParent in class HierarchicalFilter
Parameters:
cachedParent - the parent tnode found in the cache.
parent - the category node.
parentURL - the parent url.
childURL - the child url.
Returns:
validated parent.

Extension SDK

 

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