Extension SDK 9.0.5

oracle.jdeveloper.jot
Interface JotCodeElement

All Superinterfaces:
JotElement
All Known Subinterfaces:
JotAllocation, JotAnonymousClass, JotArrayAllocation, JotArrayDereference, JotArrayInitializer, JotAssignment, JotBlockElement, JotBlockStatement, JotBreak, JotCase, JotCatch, JotClass, JotClassAllocation, JotClassInitializer, JotCodeBlock, JotComment, JotConditional, JotConstructor, JotContinue, JotDo, JotDocComment, JotDocLinkTag, JotDocParamTag, JotDocReturnTag, JotDocSeeTag, JotDocTag, JotDocTextTag, JotDocThrowsTag, JotElse, JotExpression, JotExpressionStatement, JotField, JotFieldDeclaration, JotFileElement, JotFor, JotForInitializer, JotHasChildStatement, JotIf, JotImport, JotInfixExpression, JotInnerClass, JotLocalClass, JotLocalVariable, JotLocalVariableDeclaration, JotMember, JotMethod, JotMethodCall, JotNestedExpression, JotPackageStatement, JotParameter, JotPostIncrementOrDecrement, JotPreIncrementOrDecrement, JotPrimaryExpression, JotQuestionExpression, JotReturn, JotStatement, JotStatementExpression, JotSwitch, JotSynchronized, JotThrow, JotTry, JotTypecast, JotUnaryExpression, JotVariable, JotVariableDeclaration, JotWhile

public interface JotCodeElement
extends JotElement

A JotCodeElement is a JotElement which exists at any level within a JotFile. It contains operations common to such elements.

JotCodeElement may represent elements existing in source files, or other storage mediums. Operations pertaining to source will return error codes if the element is not in a source file. isSourceElement() can be used to determine if this element represents a node in a source file.

Methods that require the underlying element to exist throw a JotException. isExistant() can be used to determine if the element exists beforehand.

This interface is not intended to be implemented by clients.


Method Summary
 void addPrecedingComment(JotComment comment)
          Adds the given comment on a new line, or lines inserted prior to this element.
 boolean childrenContainErrors()
           
 void delete()
          Removes this element, and children, from it's parent, and marks it invalid.
 JotFile getContainingJotFile()
          Retrieves the JotFile that contains this element.
 java.lang.String getLeftWhitespace()
          Retrieves the consecutive white characters between the end of the previous element and this elements start position.
 int getLength()
          Retrieves the length of this element.
 java.lang.String getRightWhitespace()
          Retrieves the consecutive white characters between the end of this element and the start position of the next element.
 boolean isInError()
           
 boolean isSource()
          Indicates whether this JotCodeElement instance represents an element contained by a source file.
 void setLeftWhitespace(java.lang.String leftWhitespace)
          Sets the consecutive white characters between the end of the previous element and this elements start position.
 void setRightWhitespace(java.lang.String rightWhitespace)
          Sets the consecutive white characters between the end of this element and the start position of the next element, or the end of the file.
 
Methods inherited from interface oracle.jdeveloper.jot.JotElement
getChildren, getContainedElements, getElementName, getElementType, getEndOffset, getID, getJotWorkArea, getParent, getStartOffset, isExistent, isReadOnly, isStructureKnown, setParent
 

Method Detail

isSource

public boolean isSource()
Indicates whether this JotCodeElement instance represents an element contained by a source file.

Returns:
true if this JotCodeElement instance represents a source file, false otherwise.

getLength

public int getLength()
              throws JotInvalidElementException
Retrieves the length of this element.

Returns:
the increment between the start offset, and the end.
Throws:
JotInvalidElementException

getContainingJotFile

public JotFile getContainingJotFile()
                             throws JotInvalidElementException
Retrieves the JotFile that contains this element.

Returns:
the first JotFile occuring up the parent chain.
Throws:
JotInvalidElementException

isInError

public boolean isInError()
                  throws JotInvalidElementException
Returns:
true if this element has an error, otherwise false.
Throws:
JotInvalidElementException

childrenContainErrors

public boolean childrenContainErrors()
                              throws JotInvalidElementException
Returns:
true if this element's direct children contain errors.
Throws:
JotInvalidElementException

delete

public void delete()
            throws JotInvalidElementException
Removes this element, and children, from it's parent, and marks it invalid.

Throws:
JotInvalidElementException

getLeftWhitespace

public java.lang.String getLeftWhitespace()
                                   throws JotInvalidElementException
Retrieves the consecutive white characters between the end of the previous element and this elements start position. This includes only spaces, tabs, and newline characters. The string returned is actually obtained by retrieving the trailing whitespace from the preceding element. The exception to this being the first element.

Returns:
A String containing the preceding whitespace.
Throws:
JotInvalidElementException

getRightWhitespace

public java.lang.String getRightWhitespace()
                                    throws JotInvalidElementException
Retrieves the consecutive white characters between the end of this element and the start position of the next element. This includes only spaces, tabs, and newline characters.

Returns:
A String containing the trailing whitespace.
Throws:
JotInvalidElementException

setLeftWhitespace

public void setLeftWhitespace(java.lang.String leftWhitespace)
                       throws JotInvalidElementException,
                              java.lang.IllegalArgumentException
Sets the consecutive white characters between the end of the previous element and this elements start position. This can include only spaces, tabs, and newline characters. This method actually sets the trailing whitespace for the previous element. The exception to this being the first element.

Parameters:
leftWhitespace - A String containing the new preceding whitespace.
Throws:
JotInvalidElementException
java.lang.IllegalArgumentException

setRightWhitespace

public void setRightWhitespace(java.lang.String rightWhitespace)
                        throws JotInvalidElementException,
                               java.lang.IllegalArgumentException
Sets the consecutive white characters between the end of this element and the start position of the next element, or the end of the file. This may include only spaces, tabs, and newline characters.

Parameters:
rightWhitespace - A String containing the new trailing whitespace.
Throws:
JotInvalidElementException
java.lang.IllegalArgumentException

addPrecedingComment

public void addPrecedingComment(JotComment comment)
                         throws JotInvalidElementException
Adds the given comment on a new line, or lines inserted prior to this element.

Throws:
JotInvalidElementException

Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.