|
Extension SDK 10.1.2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.ide.model.DefaultRecognizer
The DefaultRecognizer
is the default Recognizer
implementation used in the IDE. It contains support for recognizing
an URL
based on , extension.
Constructor Summary | |
DefaultRecognizer()
Pass in the Recognizer that DefaultRecognizer
should delegate to when it needs to invoke a Recognizer
operation on another URL . |
Method Summary | |
boolean |
canConvert(java.net.URL oldURL,
java.net.URL newURL)
This implementation looks at the two URL s to see what the
corresponding Node class will be. |
static void |
clearExtensionToClassMap()
Clears the extension to class map. |
Node |
create(java.net.URL url,
java.lang.Class clazz)
Creates an instance of the design-time node associated with the specified URL . |
static java.lang.Class |
getClassForExtension(java.lang.String extension)
Return the class that has been registered with the given extension or null if not has been registered. |
static DocumentInfo |
getDocumentInfo(java.lang.Class nodeClass)
Returns the DocumentInfo associated with the specified
nodeClass . |
java.util.Map |
getExtensionToClassMap()
|
java.util.HashSet |
getValidConversions(java.lang.Class cls)
|
static void |
mapExtensionToClass(java.lang.String extension,
java.lang.Class cls)
Maps the given extension , which is a file extension,
to the given Class which must be a Node class. |
java.lang.Class |
recognize(java.net.URL url)
Gets the Class of the data item associated with the
specified URL . |
static void |
registerConversion(java.lang.Class oldNodeClass,
java.lang.Class newNodeClass)
Registers a conversion between Node classes that is to be
considered valid. |
static void |
registerDocumentInfo(java.lang.Class nodeClass,
DocumentInfo info)
Associates a document class with a record of information containing the icon and label identifying the document type. |
static java.io.File |
sanitizeExtension(java.lang.String extension)
Makes sure that the extension begins with a '.'. |
static java.lang.String |
sanitizeExtensionAsString(java.lang.String extension)
|
java.net.URL |
validate(java.net.URL newURL,
java.net.URL oldURL)
Validate the specified new name. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DefaultRecognizer()
Recognizer
that DefaultRecognizer
should delegate to when it needs to invoke a Recognizer
operation on another URL
.
Method Detail |
public static void mapExtensionToClass(java.lang.String extension, java.lang.Class cls)
extension
, which is a file extension,
to the given Class
which must be a Node
class.
Addins that extend this class must provide their own
static implementation of this method. Using the default implementation
for any other purpose than to map extension defined by end users
to registered node types will break current IDE behavior. In other
words, this method is only for internal IDE purposes.
The extension
passed in is allowed to contain
or omit the leading "."; if it is omitted, it will be added
automatically.
public static void clearExtensionToClassMap()
public static java.lang.Class getClassForExtension(java.lang.String extension)
public static void registerConversion(java.lang.Class oldNodeClass, java.lang.Class newNodeClass)
Node
classes that is to be
considered valid.
oldNodeClass
- The Node
class that the conversion
is occuring from.newNodeClass
- The Node
class that the
oldNodeClass
is being converted to.public static void registerDocumentInfo(java.lang.Class nodeClass, DocumentInfo info)
public static DocumentInfo getDocumentInfo(java.lang.Class nodeClass)
DocumentInfo
associated with the specified
nodeClass
.
public java.lang.Class recognize(java.net.URL url)
Recognizer
Class
of the data item associated with the
specified URL
. Implementations must return
null
if the URL
is not recognized. The
Class
returned must be the data model class. This
value is passed to the Recognizer.create(URL, Class)
method
which will create the design-time node.
recognize
in interface Recognizer
url
- unique URL
identifying the document.
Class
.public Node create(java.net.URL url, java.lang.Class clazz) throws java.lang.IllegalAccessException, java.lang.InstantiationException
Recognizer
URL
. This method is called by the
NodeFactory
. This method must return a Node
instance. The type
parameter specifies the
Class
of the data object.
create
in interface Recognizer
url
- unique URL
identifying the document.clazz
- the data Class
.
java.lang.IllegalAccessException
java.lang.InstantiationException
public java.net.URL validate(java.net.URL newURL, java.net.URL oldURL) throws RecognizerException
Recognizer
null
if the
name does not validate. This method may modify the URL
to
make it valid, such as adding a file extension. The old
URL
is used as the validation base. For example, if the
new URL
does not have the correct file extension, the old
URL
extension may be added to the new URL
during
the validation process.
validate
in interface Recognizer
newURL
- the new URL
to validate.oldURL
- the old URL
used as the validation base.
URL
or null
if the
name does not validate.
RecognizerException
- if validation fails. The reason
why validation failed is in the exception's message. The message
should be suitably formatted so that it can be displayed to the
user.public boolean canConvert(java.net.URL oldURL, java.net.URL newURL)
URL
s to see what the
corresponding Node class will be. If the conversion is compatible,
then it is allowed.
The DefaultRecognizer
implementation of this checks the
Node
class types that have been registered through
registerConversion(Class, Class)
. If a mapping from the
oldURL
's recognized Node
class can be found
to the newURL
's recognized Node
class, then
this method returns true
. Otherwise, this method
returns false
.
Of course, if the Node
class for the oldURL
and the newURL
are identical, then conversion is
allowed.
canConvert
in interface Recognizer
oldURL
- the url of the node being renamed.newURL
- the new url for the node.
public java.util.HashSet getValidConversions(java.lang.Class cls)
public java.util.Map getExtensionToClassMap()
public static java.io.File sanitizeExtension(java.lang.String extension)
extension
begins with a '.'. If
it does, the extension
is just returned as-is. If it
doesn't, one is prepended to the extension
, and the
result is returned.
The extension is returned as a File
to make the extension
follow the case-sensitivity rules of the local file system.
public static java.lang.String sanitizeExtensionAsString(java.lang.String extension)
|
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.