Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.7.0)

E13403-08

oracle.jdeveloper.java.editing
Class AbstractEditingPlugin

java.lang.Object
  extended by oracle.jdeveloper.java.editing.AbstractEditingPlugin
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener, javax.swing.event.CaretListener, ActionHookInvoker, ActionPostInvoker, CharacterTypedListener, EditorPlugin

public abstract class AbstractEditingPlugin
extends java.lang.Object
implements ActionHookInvoker, ActionPostInvoker, javax.swing.event.CaretListener, CharacterTypedListener, EditorPlugin

The AbstractEditingPlugin is an assistance plugin that helps with Java/JavaScript coding (basically, languages with descendants from C), to take care of the various tedious aspects of editing, such as lining up asterisks in multi-line comments, balancing comment start and ends, and so on.


Field Summary
static java.lang.String PROPERTY_ALIGN_CLOSE_BRACE
          The name of the property where we store whether align close braces is enabled or not.
static java.lang.String PROPERTY_AUTO_ASTERISK
          The name of the property where we store whether auto asterisks is enabled or not.
static java.lang.String PROPERTY_AUTO_BRACE_END
          The name of the property where we store whether auto brace end is enabled or not.
static java.lang.String PROPERTY_AUTO_COMMENT_END
          The name of the property where we store whether auto comment end is enabled or not.
static java.lang.String PROPERTY_AUTO_GEN_DOC_COMMENTS
          The name of the property that stores whether auto generate doc comments is enabled or not.
static java.lang.String PROPERTY_AUTO_PAREN_END
          The name of the property where we store whether auto paren (or bracket) end is enabled or not.
static java.lang.String PROPERTY_AUTO_QUOTE_END
          The name of the property where we store whether auto quote end is enabled or not.
static java.lang.String PROPERTY_AUTO_QUOTE_EXTEND
          The name of the property where we store whether auto quote extension (when inserting a new line) is enabled or not.
static java.lang.String PROPERTY_AUTO_SPLIT_SINGLE_LINE_COMMENT
          The name of the property where we store whether auto comment end is enabled or not.
static java.lang.String PROPERTY_MOVE_OPEN_BRACE
          The name of the property where we store whether we should move the open brace to match the open brace style when the user enters a new open brace.
static java.lang.String PROPERTY_OPEN_BRACE_SAME_LINE
          The name of the property for whether the open brace should be kept on the same line.
 
Constructor Summary
AbstractEditingPlugin()
          Constructs a new AbstractEditingPlugin that is not currently associated with any editor or document.
 
Method Summary
protected abstract  void addJavadocCommentsAtOffset()
          Creates comments including stub Javadoc stubs as necessary.
 void caretUpdate(javax.swing.event.CaretEvent event)
          Called when the caret position is updated.
 void characterTyped(BasicEditorPane editorPane, int offset, char typedChar)
          Providers notification that a character was typed by the user and inserted into the editor pane.
protected  void clearLastTypedChars()
          Utility routine to clear our queue of last typed chars.
 void deinstall(BasicEditorPane editor)
          Called when the plugin is being removed from the BasicEditorPane (for example when the editor is closed.) This is used to notify plugins that they should unregister any listeners that were attached.
protected  char getAutoQuoteExtendChar(LexerToken lexerToken)
          Get the quote character to be used for auto-extending a quoted string.
protected  BraceProvider getBraceProvider()
          Get the brace provider to be used for the various operations.
protected  BasicDocument getDocument()
          Utility routine to fetch the document being edited.
protected  LexerDocumentRenderer getDocumentRenderer()
          Get the document renderer to be used for the various operations.
protected  BasicEditorPane getEditorPane()
           
protected abstract  AbstractLexer getLexer()
          Get the lexer.
protected abstract  int getRightBracketToken()
          Get the right bracket token.
protected abstract  int getRightParenToken()
          Get the right parenthesis token.
 void install(BasicEditorPane editor)
          Called when this plugin is being installed into the BasicEditorPane.
 boolean invokeAction(java.lang.String actionKey)
          Invokes the Action corresponding to the given actionKey.
 void invokedAction(java.lang.String actionKey)
          Notifies the listener that the given action, denoted by the key, was just invoked and completed successfully.
protected  boolean isAutoQuoteExtendEnabled()
          Private utility routine to check whether auto quote extend is currently enabled.
protected abstract  boolean isCharacterLiteralToken(int token)
          Check if the given token is a character literal token.
protected abstract  boolean isEofToken(int token)
          Check if the given token is an End-of-file (EOF) token.
protected abstract  boolean isMultiLineOrDocCommentToken(int token)
          Check if the given token is a multi line comment or a doc comment token.
protected abstract  boolean isSingleLineCommentToken(int token)
          Check if the given token is a single line comment token.
protected abstract  boolean isStringLiteralToken(int token)
          Check if the given token is a string literal token.
protected  boolean isStringQuoteChar(char c)
          Check if the given character represents a quote character used for string literals.
 void propertyChange(java.beans.PropertyChangeEvent event)
          This method gets called when a bound property is changed.
protected abstract  boolean skipCloseParenGeneration(int token)
          Check if a close parenthesis needs to be generated, if an open parenthesis is followed by the given token.
protected  void updateLastTypedChars(int offset, char c)
          Utility routine to help maintain our queue of most recently typed (consecutive) characters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_AUTO_ASTERISK

public static final java.lang.String PROPERTY_AUTO_ASTERISK
The name of the property where we store whether auto asterisks is enabled or not.

See Also:
Constant Field Values

PROPERTY_AUTO_COMMENT_END

public static final java.lang.String PROPERTY_AUTO_COMMENT_END
The name of the property where we store whether auto comment end is enabled or not.

See Also:
Constant Field Values

PROPERTY_AUTO_SPLIT_SINGLE_LINE_COMMENT

public static final java.lang.String PROPERTY_AUTO_SPLIT_SINGLE_LINE_COMMENT
The name of the property where we store whether auto comment end is enabled or not.

See Also:
Constant Field Values

PROPERTY_AUTO_GEN_DOC_COMMENTS

public static final java.lang.String PROPERTY_AUTO_GEN_DOC_COMMENTS
The name of the property that stores whether auto generate doc comments is enabled or not.

See Also:
Constant Field Values

PROPERTY_AUTO_BRACE_END

public static final java.lang.String PROPERTY_AUTO_BRACE_END
The name of the property where we store whether auto brace end is enabled or not.

See Also:
Constant Field Values

PROPERTY_OPEN_BRACE_SAME_LINE

public static final java.lang.String PROPERTY_OPEN_BRACE_SAME_LINE
The name of the property for whether the open brace should be kept on the same line.

See Also:
Constant Field Values

PROPERTY_MOVE_OPEN_BRACE

public static final java.lang.String PROPERTY_MOVE_OPEN_BRACE
The name of the property where we store whether we should move the open brace to match the open brace style when the user enters a new open brace.

See Also:
Constant Field Values

PROPERTY_ALIGN_CLOSE_BRACE

public static final java.lang.String PROPERTY_ALIGN_CLOSE_BRACE
The name of the property where we store whether align close braces is enabled or not.

See Also:
Constant Field Values

PROPERTY_AUTO_QUOTE_END

public static final java.lang.String PROPERTY_AUTO_QUOTE_END
The name of the property where we store whether auto quote end is enabled or not.

See Also:
Constant Field Values

PROPERTY_AUTO_QUOTE_EXTEND

public static final java.lang.String PROPERTY_AUTO_QUOTE_EXTEND
The name of the property where we store whether auto quote extension (when inserting a new line) is enabled or not.

See Also:
Constant Field Values

PROPERTY_AUTO_PAREN_END

public static final java.lang.String PROPERTY_AUTO_PAREN_END
The name of the property where we store whether auto paren (or bracket) end is enabled or not.

See Also:
Constant Field Values
Constructor Detail

AbstractEditingPlugin

public AbstractEditingPlugin()
Constructs a new AbstractEditingPlugin that is not currently associated with any editor or document.

Method Detail

getEditorPane

protected BasicEditorPane getEditorPane()

getLexer

protected abstract AbstractLexer getLexer()
Get the lexer.

Returns:
AbstractLexer The lexer

isEofToken

protected abstract boolean isEofToken(int token)
Check if the given token is an End-of-file (EOF) token.

Parameters:
token - The token
Returns:
boolean True if the given token is an End-of-file (EOF) token

isSingleLineCommentToken

protected abstract boolean isSingleLineCommentToken(int token)
Check if the given token is a single line comment token.

Parameters:
token - The token
Returns:
boolean True if the given token is a single line comment token

isMultiLineOrDocCommentToken

protected abstract boolean isMultiLineOrDocCommentToken(int token)
Check if the given token is a multi line comment or a doc comment token.

Parameters:
token - The token
Returns:
boolean True if the given token is a multi line comment or a doc comment token

isCharacterLiteralToken

protected abstract boolean isCharacterLiteralToken(int token)
Check if the given token is a character literal token.

Parameters:
token - The token
Returns:
boolean True if the given token is a character literal token

isStringLiteralToken

protected abstract boolean isStringLiteralToken(int token)
Check if the given token is a string literal token.

Parameters:
token - The token
Returns:
boolean True if the given token is a string literal token

getRightParenToken

protected abstract int getRightParenToken()
Get the right parenthesis token.

Returns:
int The right parenthesis token.

getRightBracketToken

protected abstract int getRightBracketToken()
Get the right bracket token.

Returns:
int The right bracket token.

skipCloseParenGeneration

protected abstract boolean skipCloseParenGeneration(int token)
Check if a close parenthesis needs to be generated, if an open parenthesis is followed by the given token.

Parameters:
token - The token
Returns:
boolean True if a close parenthesis needs to be generated

addJavadocCommentsAtOffset

protected abstract void addJavadocCommentsAtOffset()
Creates comments including stub Javadoc stubs as necessary. This is called after a javadoc comment has been created successfully.


clearLastTypedChars

protected void clearLastTypedChars()
Utility routine to clear our queue of last typed chars.


updateLastTypedChars

protected void updateLastTypedChars(int offset,
                                    char c)
Utility routine to help maintain our queue of most recently typed (consecutive) characters.

Parameters:
offset - the offset where the char was typed
c - new character typed

getDocument

protected BasicDocument getDocument()
Utility routine to fetch the document being edited.

Returns:
BasicDocument the document being edited

getBraceProvider

protected BraceProvider getBraceProvider()
Get the brace provider to be used for the various operations.

Returns:
BraceProvider The BraceProvider implementation

getDocumentRenderer

protected LexerDocumentRenderer getDocumentRenderer()
Get the document renderer to be used for the various operations.

Returns:
LexerDocumentRenderer The LexerDocumentRenderer implementation

getAutoQuoteExtendChar

protected char getAutoQuoteExtendChar(LexerToken lexerToken)
Get the quote character to be used for auto-extending a quoted string.

Parameters:
lexerToken - The current lexer token
Returns:
char The auto quote-extend character to be used

isStringQuoteChar

protected boolean isStringQuoteChar(char c)
Check if the given character represents a quote character used for string literals.

Parameters:
c - The character to check
Returns:
boolean If the given character is a quote character used for string literals

isAutoQuoteExtendEnabled

protected boolean isAutoQuoteExtendEnabled()
Private utility routine to check whether auto quote extend is currently enabled.

Returns:
whether auto-quote-extend is enabled

install

public void install(BasicEditorPane editor)
Called when this plugin is being installed into the BasicEditorPane.

Specified by:
install in interface EditorPlugin
Parameters:
editor - the editor pane

deinstall

public void deinstall(BasicEditorPane editor)
Called when the plugin is being removed from the BasicEditorPane (for example when the editor is closed.) This is used to notify plugins that they should unregister any listeners that were attached.

Specified by:
deinstall in interface EditorPlugin
Parameters:
editor - the editor pane

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
This method gets called when a bound property is changed.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
event - A PropertyChangeEvent object describing the event source and the property that has changed.

invokeAction

public boolean invokeAction(java.lang.String actionKey)
Invokes the Action corresponding to the given actionKey.

Specified by:
invokeAction in interface ActionHookInvoker
Parameters:
actionKey - the published key for the action
Returns:
true if the action is handled, false otherwise

invokedAction

public void invokedAction(java.lang.String actionKey)
Notifies the listener that the given action, denoted by the key, was just invoked and completed successfully.

Specified by:
invokedAction in interface ActionPostInvoker
Parameters:
actionKey - the published key for the action

caretUpdate

public void caretUpdate(javax.swing.event.CaretEvent event)
Called when the caret position is updated.

Specified by:
caretUpdate in interface javax.swing.event.CaretListener
Parameters:
event - the caret event

characterTyped

public void characterTyped(BasicEditorPane editorPane,
                           int offset,
                           char typedChar)
Providers notification that a character was typed by the user and inserted into the editor pane.

Specified by:
characterTyped in interface CharacterTypedListener
Parameters:
editorPane - the editor pane where the character was typed
offset - the offset where the character was inserted
typedChar - the character that was typed

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.7.0)

E13403-08

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