com.borland.primetime.node
Class FileType

java.lang.Object
  |
  +--com.borland.primetime.node.FileType

public class FileType
extends java.lang.Object

Instances of FileType represent mappings between filesystem extensions and node types. These mapping are case insensitive and have an associated mapping "kind" which may be used to distinguish different sources of file type mappings.


Constructor Summary
FileType(java.lang.String description, java.lang.Class nodeType, java.lang.Object kind)
          All
FileType(java.lang.String description, java.lang.Class nodeType, java.lang.Object kind, javax.swing.Icon icon)
          All
 
Method Summary
static void customizeFileChooser(javax.swing.JFileChooser fileChooser)
           
 java.lang.String getDescription()
          Returns the description that this FileType was constructed with.
static FileType getFileType(java.io.File file)
          Performs a case-insensitive searches of the global registry for a registered FileType mapping after deriving the file type from a file's extension.
static FileType getFileType(java.lang.String extension)
          Performs a case-insensitive searches of the global registry for a registered FileType mapping.
static java.util.Map getFileTypes()
          Fetches a map that matches all registered extension keys (as lowercase String instances) to FileType values.
 javax.swing.Icon getIcon()
          Returns the icon object that this FileType was constructed with or a generic file icon if null was specified.
 java.lang.Object getKind()
          Returns the 'kind' object that this FileType was constructed with.
 java.lang.Class getNodeType()
          Returns the node type that this FileType was constructed with.
static void registerFileType(java.lang.String extension, FileType fileType)
          Adds or removes a FileType mapping from the global registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileType

public FileType(java.lang.String description,
                java.lang.Class nodeType,
                java.lang.Object kind)
All
Parameters:
description - A description of the file type for display purposes.
nodeType - A reference to a FileNode or Project subclass.
kind - An arbitrary reference that may be used to distinguish the source of this file type mapping.

FileType

public FileType(java.lang.String description,
                java.lang.Class nodeType,
                java.lang.Object kind,
                javax.swing.Icon icon)
All
Parameters:
description - A description of the file type for display purposes.
nodeType - A reference to a FileNode or Project subclass.
kind - An arbitrary reference that may be used to distinguish the source of this file type mapping.
icon - An icon representing the specified file type.
Method Detail

getDescription

public java.lang.String getDescription()
Returns the description that this FileType was constructed with.
Returns:
A non-null String instance.

getNodeType

public java.lang.Class getNodeType()
Returns the node type that this FileType was constructed with.
Returns:
A non-null Class reference that is a subclass of either FileNode or Project.

getKind

public java.lang.Object getKind()
Returns the 'kind' object that this FileType was constructed with.
Returns:
An object reference, or null if no 'kind' was supplied.

getIcon

public javax.swing.Icon getIcon()
Returns the icon object that this FileType was constructed with or a generic file icon if null was specified.
Returns:
An Icon reference.

registerFileType

public static void registerFileType(java.lang.String extension,
                                    FileType fileType)
Adds or removes a FileType mapping from the global registry.
Parameters:
extension - The extension for which a mapping should be added or removed.
fileType - The fileType the extension should map to, or null if the mapping should be removed.

getFileType

public static FileType getFileType(java.lang.String extension)
Performs a case-insensitive searches of the global registry for a registered FileType mapping.
Parameters:
extension - The extension to search for.
Returns:
The matching FileType instance, or null if no FileType is currently registered for the specified extension.

getFileType

public static FileType getFileType(java.io.File file)
Performs a case-insensitive searches of the global registry for a registered FileType mapping after deriving the file type from a file's extension.
Parameters:
file - The File instance whose extension should be used for the search.
Returns:
The matching FileType instance, or null if no FileType is currently registered for the specified extension.

getFileTypes

public static java.util.Map getFileTypes()
Fetches a map that matches all registered extension keys (as lowercase String instances) to FileType values.
Returns:
A copy of the current global registration map.

customizeFileChooser

public static void customizeFileChooser(javax.swing.JFileChooser fileChooser)