Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

oracle.javatools.editor.folding
Interface CodeFoldingProvider


public interface CodeFoldingProvider

The interface that defines how a language implementation provides a generic data model for supporting collapsible source code blocks in the code editor.

Since:
10.1.3

Method Summary
 void beginCompoundEdit(CodeFoldingModel model)
          Notifies this provider that a compound edit has started.
 CodeFoldingModel createModel(BasicEditorPane editorPane)
          Creates a new data model describing the collapsible source code blocks in the document attached to the specified editor component.
 void endCompoundEdit(CodeFoldingModel model)
          Notifies this provider that a compound edit has ended.
 javax.swing.JPopupMenu getPopupMenu()
          Returns the popup menu of actions that can be performed by the provider.
 void insertUpdate(CodeFoldingModel model, int offset, int length)
          Executes an immediate update of the model due to an insertion in the document.
 void removeUpdate(CodeFoldingModel model, int offset, int length)
          Executes an immediate update of the model due to a deletion in the document.
 

Method Detail

createModel

CodeFoldingModel createModel(BasicEditorPane editorPane)
Creates a new data model describing the collapsible source code blocks in the document attached to the specified editor component. Implementations are expected to parse the document and create a complete model.

Parameters:
editorPane - the editor pane component
Returns:
the code folding data model

beginCompoundEdit

void beginCompoundEdit(CodeFoldingModel model)
Notifies this provider that a compound edit has started. Zero or more insertUpdate(oracle.javatools.editor.folding.CodeFoldingModel, int, int)s and removeUpdate(oracle.javatools.editor.folding.CodeFoldingModel, int, int)s, and then an endCompoundEdit(oracle.javatools.editor.folding.CodeFoldingModel) will follow immediately. This method will not be called for singleton edits.

When a compound edit is in progress, implementations are encouraged to defer UI updates from insertUpdate(oracle.javatools.editor.folding.CodeFoldingModel, int, int) and removeUpdate(oracle.javatools.editor.folding.CodeFoldingModel, int, int) to endCompoundEdit(oracle.javatools.editor.folding.CodeFoldingModel).

Parameters:
model - the code folding data model.

insertUpdate

void insertUpdate(CodeFoldingModel model,
                  int offset,
                  int length)
Executes an immediate update of the model due to an insertion in the document. Implementations are expected to update the model without reparsing the document. The provider should fire the appropriate model events when the model changes. When performance is at a premium, it is permissible for this method simply to do nothing, at the expense of causing the code folding UI to become out of sync with the document until the next full refresh of the model.

Parameters:
model - the code folding data model
offset - the caret offset of the insertion
length - the length in characters of the inserted text

removeUpdate

void removeUpdate(CodeFoldingModel model,
                  int offset,
                  int length)
Executes an immediate update of the model due to a deletion in the document. Implementations are expected to update the model without reparsing the document. The provider should fire the appropriate model events when the model changes. When performance is at a premium, it is permissible for this method simply to do nothing, at the expense of causing the code folding UI to become out of sync with the document until the next full refresh of the model.

Parameters:
model - the code folding data model
offset - the caret offset of the deletion
length - the length in characters of the deleted text

endCompoundEdit

void endCompoundEdit(CodeFoldingModel model)
Notifies this provider that a compound edit has ended. This method will not be called for singleton edits.

Parameters:
model - the code folding data model.
See Also:
beginCompoundEdit(oracle.javatools.editor.folding.CodeFoldingModel)

getPopupMenu

javax.swing.JPopupMenu getPopupMenu()
Returns the popup menu of actions that can be performed by the provider. Implementations are expected to return a menu containing the global folding and expanding actions that can be performed in the editor irrespective of the caret position, or null if no actions are supported.

Returns:
a popup menu containing the supported folding actions, or null if no actions are supported

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

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