|
Extension SDK | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The JotFile
interface defines the JOT model for a Java file.
The file may be either a source file or a compiled class file.
The JotFile methods to read from the model are available for all files.
Methods that modify the JOT model are only supported for source files;
attempts to modify a compiled source file will result in a
JotException
.
The JotFile for a file can be retrieved from a JotManager
instance.
JotManager
Field Summary |
Fields inherited from interface oracle.ide.addin.Subject |
OBJECT_MODIFIED |
Method Summary | |
void |
addBlankLine(JotFileElement elem,
boolean before)
Adds a blank line to this file. |
JotClass |
addClass(int index,
java.lang.String name)
Adds a new class declaration to this file at a specific location. |
JotClass |
addClass(java.lang.String name)
Adds a new class declaration to this file. |
void |
addComment(JotFileElement elem,
boolean before,
JotComment comment)
Adds a comment to this file. |
JotImport |
addImport(java.lang.String name)
Adds a new import statement to this file. |
void |
commitFile()
Commits any pending changes to the JOT model. |
void |
commitFile(boolean isUndoable)
Deprecated. use commitFile() or commitFile(String); |
void |
commitFile(boolean isUndoable,
java.lang.Object origin)
Deprecated. use commitFile(Object) or commitFile(Object, String) |
void |
commitFile(boolean isUndoable,
java.lang.Object origin,
java.lang.String undoText)
Deprecated. use commitFile(Object) or commitFile(Object, String) |
void |
commitFile(java.lang.Object origin)
Commits any pending changes to the JOT model. |
void |
commitFile(java.lang.Object origin,
java.lang.String undoText)
Commits any pending changes to the JOT model. |
void |
commitFile(java.lang.String undoText)
Commits any pending changes to the JOT model. |
JotComment |
createComment(int type,
java.lang.String text)
Creates a new comment. |
JotClass |
getClass(java.lang.String name)
Retrieves a class by name. |
JotClass[] |
getClasses()
Retrieves the classes defined in this file. |
int |
getClassIndex(JotClass cls)
Retrieves the index of the class in this file. |
JotComment |
getComment(JotFileElement elem,
boolean before)
Retrieves the nearest comment to an element. |
JotComment[] |
getComments()
Retrieves all the file-level comments. |
JotDocComment |
getDocComment(JotClass cls)
Retrieves the current JavaDoc comment for a class. |
JotImport |
getImport(java.lang.String name)
Retrieves the named import declaration. |
JotImport[] |
getImports()
Retrieves this file's import declarations. |
java.lang.String |
getMinimumReferenceName(java.lang.String type)
Determines whether a given type can be referred to by its short name. |
java.lang.String |
getPackage()
Retrieves the package name from this file's package declaration. |
java.lang.String |
getQualifiedName(java.lang.String typeName)
Determines the fully qualified name for a given type name. |
long |
getTimestamp()
Retrieves this file's timestamp. |
java.net.URL |
getURL()
Retrieve's this file's URL. |
boolean |
isReadOnly()
Whether this file is read-only. |
boolean |
isSource()
Indicates whether this JotFile instance represents a
source file or a compiled classfile. |
void |
removeClass(JotClass cls)
Removes a class from this file. |
void |
removeComment(JotComment comment)
Removes an existing comment. |
void |
removeImport(JotImport imp)
Removes an existing import from this file. |
void |
rollbackFile()
Rolls back any pending changes to the JOT model. |
JotDocComment |
setDocComment(JotClass cls,
java.lang.String text)
Sets the JavaDoc comment for a class. |
void |
setPackage(java.lang.String pkgName)
Sets the package name in this file's package declaration. |
Methods inherited from interface oracle.ide.addin.Subject |
attach, detach, notifyObservers |
Methods inherited from interface oracle.jdeveloper.jot.JotElement |
getElementName, getElementType, getEndOffset, getID, getJotWorkArea, getParent, getStartOffset, isExistent, isStructureKnown, setParent |
Method Detail |
public java.net.URL getURL()
public java.lang.String getPackage()
public void setPackage(java.lang.String pkgName) throws JotException
pkgName
- the new package name for this file. Specifying
null
will remove the package statement.
JotException
- if this file's package cannot be changed.public long getTimestamp()
JotFile
instance, expressed as milliseconds since
00:00:00 UTC on January 1, 1970.
public boolean isReadOnly()
isReadOnly
in interface JotElement
public java.lang.String getMinimumReferenceName(java.lang.String type)
type
- the fully qualified type name.
public JotClass[] getClasses()
JotClass
instances;
if the file contains no classes the array is empty.public JotClass getClass(java.lang.String name)
name
- the name of the desired class. The name may be
optionally fully qualified.
JotClass
instance for the Class, or
null
if the class is not found in this JotFile
.public JotClass addClass(java.lang.String name) throws JotException
name
- the name of the new class.
JotException
- if new classes cannot be added to this file
or the specified classname is not a valid classname.public JotClass addClass(int index, java.lang.String name) throws JotException
index
- the location to insert the new class.name
- the name of the new class.
JotException
- if new classes cannot be added to this file
or the specified classname is not a valid classname.public void removeClass(JotClass cls) throws JotException
cls
- the class to remove. If the class does not exist in this file,
or is not a top-level class, nothing is done.
JotException
- if this file cannot have classes removed.public int getClassIndex(JotClass cls)
cls
- the top-level class whose location is desired.
public JotImport[] getImports()
JotImport
instances.public JotImport getImport(java.lang.String name)
name
- the body of an import declaration, such as
java.awt.Button or javax.swing.*.
JotImport
instance, or null
if not found.public JotImport addImport(java.lang.String name) throws JotException
name
- the name of the new import statement. This should either
be a fully qualified classname (for example, java.awt.Button) or
a package with a wildcard (for example, java.io.*).
JotException
- if this file cannot have its import list modified.public void removeImport(JotImport imp) throws JotException
imp
- the import to remove.
JotException
- if this file does not support removing imports.public boolean isSource()
JotFile
instance represents a
source file or a compiled classfile.
JotFile
instance represents a
source file, false otherwise.public void commitFile() throws JotException
JotException
- if the changes cannot be commited.public void commitFile(java.lang.Object origin) throws JotException
origin
- the originator of the commit request.
JotException
- if the changes cannot be commited.public void commitFile(java.lang.String undoText) throws JotException
undoText
- the text to use for the undo label.
JotException
- if the changes cannot be commited.public void commitFile(java.lang.Object origin, java.lang.String undoText) throws JotException
undoText
- the text to use for the undo label.origin
- the originator of the commit request.
JotException
- if the changes cannot be commited.public void commitFile(boolean isUndoable) throws JotException
isUndoable
- whether the generated command can be undone.
JotException
- if the changes cannot be commited.commitFile()
,
commitFile(String)
public void commitFile(boolean isUndoable, java.lang.Object origin) throws JotException
isUndoable
- whether the generated command can be undone.origin
- the originator of the commit request.
JotException
- if the changes cannot be commited.commitFile(Object, String)
,
commitFile(Object)
public void commitFile(boolean isUndoable, java.lang.Object origin, java.lang.String undoText) throws JotException
isUndoable
- whether the generated command can be undone.origin
- the originator of the commit request.undoText
- the text to display for the undo of this command. If
isUndoable
is false, undoText
is ignored.
JotException
- if the changes cannot be commited.commitFile(Object, String)
,
commitFile(Object)
public void rollbackFile() throws JotException
JotException
- if the file cannot be rolled back.public JotDocComment setDocComment(JotClass cls, java.lang.String text)
cls
- the JotClass
to comment.text
- the text of the doc comment. The comment start and end
characters should be omitted, as well as the '*' characters at the start
of each line.
public JotDocComment getDocComment(JotClass cls)
cls
- the class whose doc comment is desired.
null
if no
comment exists.public JotComment createComment(int type, java.lang.String text)
type
- the type of comment to create.text
- the text of the comment. The comment characters should be
omitted.
addComment(JotFileElement, boolean, JotComment)
public void addComment(JotFileElement elem, boolean before, JotComment comment)
elem
- the existing file element to position the comment relative
to.before
- whether to add the comment before or after the element.comment
- the comment to add.public void removeComment(JotComment comment)
comment
- the comment to remove.public JotComment[] getComments()
public JotComment getComment(JotFileElement elem, boolean before)
elem
- the element to use for finding the comment.before
- whether to look before or after the element.
null
if no
comment can be found at the specified location.public void addBlankLine(JotFileElement elem, boolean before)
elem
- the existing file element to add the blank line relative to.before
- whether to add the blank line before or after the element.public java.lang.String getQualifiedName(java.lang.String typeName)
|
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.