|
Extension SDK 9.0.5 | ||||||||||
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.JotCodeElement |
addPrecedingComment, childrenContainErrors, delete, getContainingJotFile, getLeftWhitespace, getLength, getRightWhitespace, isInError, isSource, setLeftWhitespace, setRightWhitespace |
Methods inherited from interface oracle.jdeveloper.jot.JotElement |
getChildren, getContainedElements, getElementName, getElementType, getEndOffset, getID, getJotWorkArea, getParent, getStartOffset, isExistent, isReadOnly, isStructureKnown, setParent |
Method Detail |
public JotBlockElement[] getBlockElements() throws JotInvalidElementException
JotBlockElement
s that represent the
children of this block
JotInvalidElementException
public int getComparableLocation(JotBlockElement element) throws JotInvalidElementException
element
- the element whose position is desired.
-1
if the
element is not a current member of this block.
JotInvalidElementException
public int getComparableLocation(JotStatementExpression stmtExp) throws JotInvalidElementException
stmtExp
- the expression whose position is desired.
-1
if the expression is not contained by a statement
in the block.
JotInvalidElementException
public JotBlockStatement addBlock(JotBlockElement marker, boolean before) throws JotInvalidElementException
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.
JotInvalidElementException
public JotBlockStatement addBlock() throws JotInvalidElementException
JotBlockStatement
representing the new block.
JotInvalidElementException
public JotBreak addBreak(JotBlockElement marker, boolean before) throws JotInvalidElementException
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.
JotInvalidElementException
public JotBreak addBreak() throws JotInvalidElementException
JotBreak
representing the break statement.
JotInvalidElementException
public JotContinue addContinue(JotBlockElement marker, boolean before) throws JotInvalidElementException
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.
JotInvalidElementException
public JotContinue addContinue() throws JotInvalidElementException
JotContinue
representing the continue statement.
JotInvalidElementException
public JotReturn addReturn(JotBlockElement marker, boolean before, java.lang.String exp) throws JotInvalidElementException
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.
JotInvalidElementException
public JotReturn addReturn(java.lang.String exp) throws JotInvalidElementException
exp
- the return expression; null
create return without
a value;
JotReturn
representing the return statement.
JotInvalidElementException
public JotThrow addThrow(JotBlockElement marker, boolean before, java.lang.String exp) throws JotInvalidElementException
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.
JotInvalidElementException
public JotThrow addThrow(java.lang.String exp) throws JotInvalidElementException
exp
- the value being thrown.
JotThrow
representing the throw statement.
JotInvalidElementException
public JotDo addDo(JotBlockElement marker, boolean before, java.lang.String condition) throws JotInvalidElementException
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.
JotInvalidElementException
public JotDo addDo(java.lang.String condition) throws JotInvalidElementException
condition
- the conditional expression.
JotDo
representing the do statement.
JotInvalidElementException
public JotWhile addWhile(JotBlockElement marker, boolean before, java.lang.String condition) throws JotInvalidElementException
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.
JotInvalidElementException
public JotWhile addWhile(java.lang.String condition) throws JotInvalidElementException
condition
- the conditional expression.
JotWhile
representing the while statement.
JotInvalidElementException
public JotIf addIf(JotBlockElement marker, boolean before, java.lang.String exp) throws JotInvalidElementException
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.
JotInvalidElementException
public JotIf addIf(java.lang.String exp) throws JotInvalidElementException
exp
- the conditional expression.
JotIf
representing the if statement.
JotInvalidElementException
public JotFor addFor(JotBlockElement marker, boolean before) throws JotInvalidElementException
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.
JotInvalidElementException
public JotFor addFor() throws JotInvalidElementException
JotFor
representing the for statement.
JotInvalidElementException
public JotSwitch addSwitch(JotBlockElement marker, boolean before, java.lang.String exp) throws JotInvalidElementException
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.
JotInvalidElementException
public JotSwitch addSwitch(java.lang.String exp) throws JotInvalidElementException
exp
- the expression being switched on.
JotSwitch
representing the switch statement.
JotInvalidElementException
public JotSynchronized addSynchronized(JotBlockElement marker, boolean before, java.lang.String exp) throws JotInvalidElementException
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.
JotInvalidElementException
public JotSynchronized addSynchronized(java.lang.String exp) throws JotInvalidElementException
exp
- the expression being synchronized on.
JotSynchronized
representing the synchronized statement.
JotInvalidElementException
public JotExpressionStatement addExpressionStatement(JotBlockElement marker, boolean before, java.lang.String exp) throws JotInvalidElementException
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.
JotInvalidElementException
public JotExpressionStatement addExpressionStatement(java.lang.String exp) throws JotInvalidElementException
exp
- the expression being wrapped.
JotExpressionStatement
representing the expression statement.
JotInvalidElementException
public JotExpressionStatement addExpressionStatement(JotBlockElement marker, boolean before, JotStatementExpression exp) throws JotInvalidElementException
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.
JotInvalidElementException
public JotExpressionStatement addExpressionStatement(JotStatementExpression exp) throws JotInvalidElementException
exp
- the statement expression to wrap.
JotExpressionStatement
representing the expression statement.
JotInvalidElementException
public JotTry addTry(JotBlockElement marker, boolean before) throws JotInvalidElementException
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.
JotInvalidElementException
public JotTry addTry() throws JotInvalidElementException
JotTry
representing the try statement.
JotInvalidElementException
public JotCase addCase(JotBlockElement marker, boolean before, java.lang.String label) throws JotInvalidElementException
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.
JotInvalidElementException
public JotCase addCase(java.lang.String label) throws JotInvalidElementException
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.
JotInvalidElementException
public JotLocalVariableDeclaration addVariableDeclaration(JotBlockElement marker, boolean before, java.lang.String vType) throws JotInvalidElementException
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.
JotInvalidElementException
JotLocalVariableDeclaration.addVariable()
public JotLocalVariableDeclaration addVariableDeclaration(java.lang.String vType) throws JotInvalidElementException
JotLocalVariableDeclaration.addLocalVariable()
.
vType
- the type of the variable.
JotLocalVariableDeclaration
representing the new
variable declaration.
JotInvalidElementException
JotLocalVariableDeclaration.addVariable()
public JotLocalVariable addVariable(JotBlockElement marker, boolean before, java.lang.String vType, java.lang.String vName) throws JotInvalidElementException
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.
JotInvalidElementException
public JotLocalVariable addVariable(java.lang.String vType, java.lang.String vName) throws JotInvalidElementException
addVariableDeclaration( vType).addVariable( vName )
.
vType
- the type of the variable.vName
- the name of the variable.
JotLocalVariable
representing the new variable.
JotInvalidElementException
public JotLocalClass addLocalClass(JotBlockElement marker, boolean before, java.lang.String cName) throws JotInvalidElementException
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.
JotInvalidElementException
public JotLocalClass addLocalClass(java.lang.String cName) throws JotInvalidElementException
cName
- the name of the new local class.
JotLocalClass
instance representing the new local
class declaration.
JotInvalidElementException
public JotBlockElement addBlockElement(JotBlockElement marker, boolean before, java.lang.String text) throws JotException, JotInvalidElementException
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.
JotInvalidElementException
public JotBlockElement addBlockElement(java.lang.String text) throws JotException, JotInvalidElementException
text
- the text of the new block element.
JotException
- if the text is not parsable into a block element.
JotInvalidElementException
public JotBlockElement[] addBlockElements(JotBlockElement marker, boolean before, java.lang.String text) throws JotException, JotInvalidElementException
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.
JotInvalidElementException
public JotBlockElement[] addBlockElements(java.lang.String text) throws JotException, JotInvalidElementException
text
- the text of the new block elements.
JotException
- if the text is not parsable into block elements.
JotInvalidElementException
public void setText(java.lang.String text) throws JotException, JotInvalidElementException
text
- the new text of this code block.
JotException
- if the text passed in does not represent parsable
block text.
JotInvalidElementException
public void removeBlockElement(JotBlockElement element) throws JotInvalidElementException
element
- the existing element to remove.
JotInvalidElementException
public void removeAllBlockElements() throws JotInvalidElementException
JotInvalidElementException
public JotMethodCall createMethodCall(java.lang.String object, java.lang.String method) throws JotInvalidElementException
object
- the object on which the method call is being made.method
- the name of the method being invoked.
JotMethodCall
representing the method call.
JotInvalidElementException
addExpressionStatement(JotBlockElement, boolean, JotStatementExpression)
,
createNestedMethodCall(JotMethodCall, JotMethodCall)
public JotNestedExpression createNestedMethodCall(JotMethodCall firstCall, JotMethodCall secondCall) throws JotInvalidElementException
foo().bar()
.
firstCall
- the first method call.secondCall
- the second method call.
JotNestedExpression
representing the nested method
call.
JotInvalidElementException
createMethodCall(String, String)
public JotAssignment createAssignment(java.lang.String variable, java.lang.String value) throws JotInvalidElementException
variable
- the variable (or left side) of the assignment.value
- the expression being assigned to the variable.
JotAssignment
representing the assignment.
JotInvalidElementException
addExpressionStatement(JotBlockElement, boolean, JotStatementExpression)
public void addBlankLine(JotBlockElement marker, boolean before) throws JotInvalidElementException
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.
JotInvalidElementException
public void addBlankLine() throws JotInvalidElementException
JotInvalidElementException
public JotComment createComment(int type, java.lang.String text) throws JotInvalidElementException
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.
JotInvalidElementException
#addComment(JotMember, boolean, JotComment)
public void addComment(JotBlockElement marker, boolean before, JotComment comment) throws JotInvalidElementException
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.
JotInvalidElementException
public void removeComment(JotComment comment) throws JotInvalidElementException
comment
- the comment to remove.
JotInvalidElementException
public JotComment[] getComments() throws JotInvalidElementException
JotInvalidElementException
public JotComment getComment(JotBlockElement marker, boolean before) throws JotInvalidElementException
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.
JotInvalidElementException
|
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.