|
Extension SDK | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A JotCodeBlock instance represents a code block. Code blocks can contain block elements.
JotBlockElement
,
"Section 14.2 of the Java Language Specification"Method Summary | |
void |
addBlankLine()
Adds a blank line at the end of the code block. |
void |
addBlankLine(JotBlockElement marker,
boolean before)
Adds a blank line to the code block. |
JotBlockStatement |
addBlock()
Adds a new block statement to the end of this code block. |
JotBlockStatement |
addBlock(JotBlockElement marker,
boolean before)
Adds a new block statement to this code block. |
JotBlockElement |
addBlockElement(JotBlockElement marker,
boolean before,
java.lang.String text)
Adds an arbitrary block element to this code block. |
JotBlockElement |
addBlockElement(java.lang.String text)
Adds an arbitrary block element to this code block. |
JotBlockElement[] |
addBlockElements(JotBlockElement marker,
boolean before,
java.lang.String text)
Adds arbitrary block elements to this code block. |
JotBlockElement[] |
addBlockElements(java.lang.String text)
Adds arbitrary block elements to this code block. |
JotBreak |
addBreak()
Adds a new break statement to the end of this block statement. |
JotBreak |
addBreak(JotBlockElement marker,
boolean before)
Adds a new break statement to this code block. |
JotCase |
addCase(JotBlockElement marker,
boolean before,
java.lang.String label)
Adds a new case statement to this code block. |
JotCase |
addCase(java.lang.String label)
Adds a new case statement to the end of this code block. |
void |
addComment(JotBlockElement marker,
boolean before,
JotComment comment)
Adds a comment to this file. |
JotContinue |
addContinue()
Adds a new continue statement to the end of this code block. |
JotContinue |
addContinue(JotBlockElement marker,
boolean before)
Adds a new continue statement to this code block. |
JotDo |
addDo(JotBlockElement marker,
boolean before,
java.lang.String condition)
Adds a new do statement to this code block. |
JotDo |
addDo(java.lang.String condition)
Adds a new do statement to the end of this code block. |
JotExpressionStatement |
addExpressionStatement(JotBlockElement marker,
boolean before,
JotStatementExpression exp)
Adds a new expression statement to this code block based on a specific expression. |
JotExpressionStatement |
addExpressionStatement(JotBlockElement marker,
boolean before,
java.lang.String exp)
Adds a new expression statement to this code block. |
JotExpressionStatement |
addExpressionStatement(JotStatementExpression exp)
Adds a new expression statement to the end of this code block based on a specific expression. |
JotExpressionStatement |
addExpressionStatement(java.lang.String exp)
Adds a new expression statement to the end of this code block. |
JotFor |
addFor()
Adds a new for statement to the end of this code block. |
JotFor |
addFor(JotBlockElement marker,
boolean before)
Adds a new for statement to this code block. |
JotIf |
addIf(JotBlockElement marker,
boolean before,
java.lang.String exp)
Adds a new if statement to this code block. |
JotIf |
addIf(java.lang.String exp)
Adds a new if statement to the end of this code block. |
JotLocalClass |
addLocalClass(JotBlockElement marker,
boolean before,
java.lang.String cName)
Adds a new local class declaration to this block. |
JotLocalClass |
addLocalClass(java.lang.String cName)
Adds a new local class declaration to the end of this block. |
JotReturn |
addReturn(JotBlockElement marker,
boolean before,
java.lang.String exp)
Adds a new return statement to this code block. |
JotReturn |
addReturn(java.lang.String exp)
Adds a new return statement to the end of this code block. |
JotSwitch |
addSwitch(JotBlockElement marker,
boolean before,
java.lang.String exp)
Adds a new switch statement to this code block. |
JotSwitch |
addSwitch(java.lang.String exp)
Adds a new switch statement to the end of this code block. |
JotSynchronized |
addSynchronized(JotBlockElement marker,
boolean before,
java.lang.String exp)
Adds a new synchronized statement to this code block. |
JotSynchronized |
addSynchronized(java.lang.String exp)
Adds a new synchronized statement to the end of this code block. |
JotThrow |
addThrow(JotBlockElement marker,
boolean before,
java.lang.String exp)
Adds a new throw statement to this code block. |
JotThrow |
addThrow(java.lang.String exp)
Adds a new throw statement to the end of this code block. |
JotTry |
addTry()
Adds a new try statement to the end of this code block. |
JotTry |
addTry(JotBlockElement marker,
boolean before)
Adds a new try statement to this code block. |
JotLocalVariable |
addVariable(JotBlockElement marker,
boolean before,
java.lang.String vType,
java.lang.String vName)
Creates a new variable declaration in this block and adds a variable to it. |
JotLocalVariable |
addVariable(java.lang.String vType,
java.lang.String vName)
Creates a new variable declaration in this block and adds a variable to it. |
JotLocalVariableDeclaration |
addVariableDeclaration(JotBlockElement marker,
boolean before,
java.lang.String vType)
Adds a new variable declaration to this block. |
JotLocalVariableDeclaration |
addVariableDeclaration(java.lang.String vType)
Adds a new variable declaration to the end of this block. |
JotWhile |
addWhile(JotBlockElement marker,
boolean before,
java.lang.String condition)
Adds a new while statement to this code block. |
JotWhile |
addWhile(java.lang.String condition)
Adds a new while statement to the end of this code block. |
JotAssignment |
createAssignment(java.lang.String variable,
java.lang.String value)
Creates a new assignment. |
JotComment |
createComment(int type,
java.lang.String text)
Creates a new comment. |
JotMethodCall |
createMethodCall(java.lang.String object,
java.lang.String method)
Creates a new method call. |
JotNestedExpression |
createNestedMethodCall(JotMethodCall firstCall,
JotMethodCall secondCall)
Creates a new nested method call. |
JotBlockElement[] |
getBlockElements()
Retrieves all the block elements that are children of this block. |
JotComment |
getComment(JotBlockElement marker,
boolean before)
Retrieves the nearest comment to a member. |
JotComment[] |
getComments()
Retrieves all the class-level comments. |
int |
getComparableLocation(JotBlockElement element)
Retrieves the position of an element in the list of elements. |
int |
getComparableLocation(JotStatementExpression stmtExp)
Retrieves the position of an expression in the list of elements. |
void |
removeAllBlockElements()
Removes all block elements from this block. |
void |
removeBlockElement(JotBlockElement element)
Removes a block element from this block. |
void |
removeComment(JotComment comment)
Removes an existing comment. |
void |
setText(java.lang.String text)
Sets the text of this code block. |
Methods inherited from interface oracle.jdeveloper.jot.JotElement |
getElementName, getElementType, getEndOffset, getID, getJotWorkArea, getParent, getStartOffset, isExistent, isReadOnly, isStructureKnown, setParent |
Method Detail |
public JotBlockElement[] getBlockElements()
JotBlockElement
s that represent the
children of this blockpublic int getComparableLocation(JotBlockElement element)
element
- the element whose position is desired.
-1
if the
element is not a current member of this block.public int getComparableLocation(JotStatementExpression stmtExp)
stmtExp
- the expression whose position is desired.
-1
if the expression is not contained by a statement
in the block.public JotBlockStatement addBlock(JotBlockElement marker, boolean before)
marker
- an existing element to position relative to, or
null
if the new block should be positioned at the
beginning or end of this block.before
- whether to position the new block before or after the
existing marker element; or if marker
is null
,
whether to position the new block at the beginning or the end of this
block.
JotBlockStatement
representing the new block.public JotBlockStatement addBlock()
JotBlockStatement
representing the new block.public JotBreak addBreak(JotBlockElement marker, boolean before)
marker
- an existing element to position relative to, or
null
if the break statement should be positioned at the
beginning or end of this block.before
- whether to position the break statement before or after the
existing marker element; or if marker
is null
,
whether to position the break statement at the beginning or the end of
this block.
JotBreak
representing the break statement.public JotBreak addBreak()
JotBreak
representing the break statement.public JotContinue addContinue(JotBlockElement marker, boolean before)
marker
- an existing element to position relative to, or
null
if the continue statement should be positioned at the
beginning or end of this block.before
- whether to position the continue statement before or after the
existing marker element; or if marker
is null
,
whether to position the continue statement at the beginning or the end of
this block.
JotContinue
representing the continue statement.public JotContinue addContinue()
JotContinue
representing the continue statement.public JotReturn addReturn(JotBlockElement marker, boolean before, java.lang.String exp)
marker
- an existing element to position relative to, or
null
if the return statement should be positioned at the
beginning or end of this block.before
- whether to position the return statement before or after the
existing marker element; or if marker
is null
,
whether to position the return statement at the beginning or the end of
this block.exp
- the return expression; null
create return without
a value;
JotReturn
representing the return statement.public JotReturn addReturn(java.lang.String exp)
exp
- the return expression; null
create return without
a value;
JotReturn
representing the return statement.public JotThrow addThrow(JotBlockElement marker, boolean before, java.lang.String exp)
marker
- an existing element to position relative to, or
null
if the throw statement should be positioned at the
beginning or end of this block.before
- whether to position the throw statement before or after the
existing marker element; or if marker
is null
,
whether to position the throw statement at the beginning or the end of
this block.exp
- the value being thrown.
JotThrow
representing the throw statement.public JotThrow addThrow(java.lang.String exp)
exp
- the value being thrown.
JotThrow
representing the throw statement.public JotDo addDo(JotBlockElement marker, boolean before, java.lang.String condition)
marker
- an existing element to position relative to, or
null
if the do statement should be positioned at the
beginning or end of this block.before
- whether to position the do statement before or after the
existing marker element; or if marker
is null
,
whether to position the do statement at the beginning or the end of
this block.condition
- the conditional expression.
JotDo
representing the do statement.public JotDo addDo(java.lang.String condition)
condition
- the conditional expression.
JotDo
representing the do statement.public JotWhile addWhile(JotBlockElement marker, boolean before, java.lang.String condition)
marker
- an existing element to position relative to, or
null
if the while statement should be positioned at the
beginning or end of this block.before
- whether to position the while statement before or after the
existing marker element; or if marker
is null
,
whether to position the while statement at the beginning or the end of
this block.condition
- the conditional expression.
JotWhile
representing the while statement.public JotWhile addWhile(java.lang.String condition)
condition
- the conditional expression.
JotWhile
representing the while statement.public JotIf addIf(JotBlockElement marker, boolean before, java.lang.String exp)
marker
- an existing element to position relative to, or
null
if the if statement should be positioned at the
beginning or end of this block.before
- whether to position the if statement before or after the
existing marker element; or if marker
is null
,
whether to position the if statement at the beginning or the end of
this block.exp
- the conditional expression.
JotIf
representing the if statement.public JotIf addIf(java.lang.String exp)
exp
- the conditional expression.
JotIf
representing the if statement.public JotFor addFor(JotBlockElement marker, boolean before)
marker
- an existing element to position relative to, or
null
if the for statement should be positioned at the
beginning or end of this block.before
- whether to position the for statement before or after the
existing marker element; or if marker
is null
,
whether to position the for statement at the beginning or the end of
this block.
JotFor
representing the for statement.public JotFor addFor()
JotFor
representing the for statement.public JotSwitch addSwitch(JotBlockElement marker, boolean before, java.lang.String exp)
marker
- an existing element to position relative to, or
null
if the switch statement should be positioned at the
beginning or end of this block.before
- whether to position the switch statement before or after the
existing marker element; or if marker
is null
,
whether to position the switch statement at the beginning or the end of
this block.exp
- the expression being switched on.
JotSwitch
representing the switch statement.public JotSwitch addSwitch(java.lang.String exp)
exp
- the expression being switched on.
JotSwitch
representing the switch statement.public JotSynchronized addSynchronized(JotBlockElement marker, boolean before, java.lang.String exp)
marker
- an existing element to position relative to, or
null
if the synchronized statement should be positioned at the
beginning or end of this block.before
- whether to position the synchronized statement before or after the
existing marker element; or if marker
is null
,
whether to position the synchronized statement at the beginning or the end of
this block.exp
- the expression being synchronized on.
JotSynchronized
representing the synchronized statement.public JotSynchronized addSynchronized(java.lang.String exp)
exp
- the expression being synchronized on.
JotSynchronized
representing the synchronized statement.public JotExpressionStatement addExpressionStatement(JotBlockElement marker, boolean before, java.lang.String exp)
marker
- an existing element to position relative to, or
null
if the expression statement should be positioned at the
beginning or end of this block.before
- whether to position the expression statement before or after the
existing marker element; or if marker
is null
,
whether to position the expression statement at the beginning or the end of
this block.exp
- the expression being wrapped.
JotExpressionStatement
representing the expression statement.public JotExpressionStatement addExpressionStatement(java.lang.String exp)
exp
- the expression being wrapped.
JotExpressionStatement
representing the expression statement.public JotExpressionStatement addExpressionStatement(JotBlockElement marker, boolean before, JotStatementExpression exp)
marker
- an existing element to position relative to, or
null
if the expression statement should be positioned at the
beginning or end of this block.before
- whether to position the expression statement before or after the
existing marker element; or if marker
is null
,
whether to position the expression statement at the beginning or the end of
this block.exp
- the statement expression to wrap.
JotExpressionStatement
representing the expression statement.public JotExpressionStatement addExpressionStatement(JotStatementExpression exp)
exp
- the statement expression to wrap.
JotExpressionStatement
representing the expression statement.public JotTry addTry(JotBlockElement marker, boolean before)
marker
- an existing element to position relative to, or
null
if the try statement should be positioned at the
beginning or end of this block.before
- whether to position the try statement before or after the
existing marker element; or if marker
is null
,
whether to position the try statement at the beginning or the end of
this block.
JotTry
representing the try statement.public JotTry addTry()
JotTry
representing the try statement.public JotCase addCase(JotBlockElement marker, boolean before, java.lang.String label)
marker
- an existing element to position relative to, or
null
if the case statement should be positioned at the
beginning or end of this block.before
- whether to position the case statement before or after the
existing marker element; or if marker
is null
,
whether to position the case statement at the beginning or the end of
this block.label
- the case label; or null
to create the default case.
JotSwitch
representing the case statement. If
this code block is not associated with a switch statement, null
will be returned.public JotCase addCase(java.lang.String label)
label
- the case label; or null
to create the default case.
JotSwitch
representing the case statement. If
this code block is not associated with a switch statement, null
will be returned.public JotLocalVariableDeclaration addVariableDeclaration(JotBlockElement marker, boolean before, java.lang.String vType)
JotLocalVariableDeclaration.addLocalVariable()
.
marker
- an existing element to position relative to, or
null
if the variable declaration should be positioned at the
beginning or end of this block.before
- whether to position the variable declaration before or after the
existing marker element; or if marker
is null
,
whether to position the variable declaration at the beginning or the end of
this block.vType
- the type of the variable.
JotLocalVariableDeclaration
representing the new
variable declaration.JotLocalVariableDeclaration.addVariable()
public JotLocalVariableDeclaration addVariableDeclaration(java.lang.String vType)
JotLocalVariableDeclaration.addLocalVariable()
.
vType
- the type of the variable.
JotLocalVariableDeclaration
representing the new
variable declaration.JotLocalVariableDeclaration.addVariable()
public JotLocalVariable addVariable(JotBlockElement marker, boolean before, java.lang.String vType, java.lang.String vName)
addVariableDeclaration( marker, before, vType).addVariable( vName )
.
marker
- an existing element to position relative to, or
null
if the variable declaration should be positioned at the
beginning or end of this block.before
- whether to position the variable declaration before or after the
existing marker element; or if marker
is null
,
whether to position the variable declaration at the beginning or the end of
this block.vType
- the type of the variable.vName
- the name of the variable.
JotLocalVariable
representing the new variable.public JotLocalVariable addVariable(java.lang.String vType, java.lang.String vName)
addVariableDeclaration( vType).addVariable( vName )
.
vType
- the type of the variable.vName
- the name of the variable.
JotLocalVariable
representing the new variable.public JotLocalClass addLocalClass(JotBlockElement marker, boolean before, java.lang.String cName)
marker
- an existing element to position relative to, or
null
if the local class declaration should be positioned at the
beginning or end of this block.before
- whether to position the local class declaration before or after the
existing marker element; or if marker
is null
,
whether to position the local class declaration at the beginning or the end of
this block.cName
- the name of the new local class.
JotLocalClass
instance representing the new local
class declaration.public JotLocalClass addLocalClass(java.lang.String cName)
cName
- the name of the new local class.
JotLocalClass
instance representing the new local
class declaration.public JotBlockElement addBlockElement(JotBlockElement marker, boolean before, java.lang.String text) throws JotException
marker
- an existing element to position relative to, or
null
if the block element should be positioned at the
beginning or end of this block.before
- whether to position the block element before or after the
existing marker element; or if marker
is null
,
whether to position the block element at the beginning or the end of
this block.text
- the text of the new block element.
JotException
- if the text is not parsable into a block element.public JotBlockElement addBlockElement(java.lang.String text) throws JotException
text
- the text of the new block element.
JotException
- if the text is not parsable into a block element.public JotBlockElement[] addBlockElements(JotBlockElement marker, boolean before, java.lang.String text) throws JotException
marker
- an existing element to position relative to, or
null
if the block elements should be positioned at the
beginning or end of this block.before
- whether to position the block elements before or after the
existing marker element; or if marker
is null
,
whether to position the block elements at the beginning or the end of
this block.text
- the text of the new block elements.
JotException
- if the text is not parsable into block elements.public JotBlockElement[] addBlockElements(java.lang.String text) throws JotException
text
- the text of the new block elements.
JotException
- if the text is not parsable into block elements.public void setText(java.lang.String text) throws JotException
text
- the new text of this code block.
JotException
- if the text passed in does not represent parsable
block text.public void removeBlockElement(JotBlockElement element)
element
- the existing element to remove.public void removeAllBlockElements()
public JotMethodCall createMethodCall(java.lang.String object, java.lang.String method)
object
- the object on which the method call is being made.method
- the name of the method being invoked.
JotMethodCall
representing the method call.addExpressionStatement(JotBlockElement, boolean, JotStatementExpression)
,
createNestedMethodCall(JotMethodCall, JotMethodCall)
public JotNestedExpression createNestedMethodCall(JotMethodCall firstCall, JotMethodCall secondCall)
foo().bar()
.
firstCall
- the first method call.secondCall
- the second method call.
JotNestedExpression
representing the nested method
call.createMethodCall(String, String)
public JotAssignment createAssignment(java.lang.String variable, java.lang.String value)
variable
- the variable (or left side) of the assignment.value
- the expression being assigned to the variable.
JotAssignment
representing the assignment.addExpressionStatement(JotBlockElement, boolean, JotStatementExpression)
public void addBlankLine(JotBlockElement marker, boolean before)
marker
- an existing element to position relative to, or
null
if the blank line should be positioned at the
beginning or end of this block.before
- whether to position the blank line before or after the
existing marker element; or if marker
is null
,
whether to position the blank line at the beginning or the end of
this block.public void addBlankLine()
public JotComment createComment(int type, java.lang.String text)
type
- the type of comment to create. Valid types are either
JotComment.BLOCK
, JotComment.LINE
, or JotComment.DOC
.text
- the text of the comment. The comment characters should be
omitted.
#addComment(JotMember, boolean, JotComment)
public void addComment(JotBlockElement marker, boolean before, JotComment comment)
marker
- an existing element to position relative to, or
null
if the comment should be positioned at the
beginning or end of this block.before
- whether to position the comment before or after the
existing marker element; or if marker
is null
,
whether to position the comment at the beginning or the end of
this block. ie. If the marker is null and you wish the comment to be placed
at the top of this block specify true; specify false for the bottom position.comment
- the comment to add.public void removeComment(JotComment comment)
comment
- the comment to remove.public JotComment[] getComments()
public JotComment getComment(JotBlockElement marker, boolean before)
marker
- an existing element locate the comment relative tobefore
- whether to look for the comment before or after
the existing element.
null
if no
comment can be found at the specified location.
|
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.