Skip navigation links

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

E17493-03


oracle.ide.cmd.buffer
Class EditProcessor

java.lang.Object
  extended by oracle.ide.cmd.buffer.EditProcessor


public final class EditProcessor
extends java.lang.Object

The EditProcessor class contains static utility routines for apply simple or complex edits to a Node. The EditProcessor will take care of buffer locking, notifications by sending an UpdateMessage to Node observers, and undo by wrapping the edit with an IDE command.

For a single simple edit such as an insert, remove, replace, or replace all, Addins can simply call the corresponding doInsert(), doRemove(), doReplace, or doReplaceAll method to perform the edit.

If the simple edit should be undoable by the user using Edit->Undo, Addins should specify true for the isUndoable parameter, and also specify an appropriate human-readable (i.e., translateable) undo edit name for use with the Edit->Undo menu item.

For a complex edit, such as a sequence of inserts or removes, Addins should encapsulate the complex edit in the Edit interface, and use the doEdit() to perform the edit.

For all edit utility methods, the origin parameter is optional. It is used with the UpdateMessage so that Addins that also observe the Node can identify the specify edit that they just applied. Note that it is only used with UpdateMessage notification for the first application of the edit. All subsequent Undo and Redo operations will use null for the origin.


Method Summary
static void doEdit(Edit edit, Node node, java.lang.Object origin)
          Utility routine to invoke the specified edit for the given Node as a command.
static void doInsert(char[] insertData, int insertOffset, Node node, boolean isUndoable, java.lang.String editName, java.lang.Object origin)
          Utility routine to perform a single insert in the Node.
static void doRemove(int removeOffset, int removeCount, Node node, boolean isUndoable, java.lang.String editName, java.lang.Object origin)
          Utility routine to perform a single remove in the Node.
static void doReplace(char[] replaceData, int replaceStartOffset, int replaceEndOffset, Node node, boolean isUndoable, java.lang.String editName, java.lang.Object origin)
          Utility routine to perform a single replace in the Node with the specified replace data.
static void doReplaceAll(char[] replaceData, Node node, boolean isUndoable, java.lang.String editName, java.lang.Object origin)
          Utility routine to perform a replace all in the Node with the new contents.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Method Detail

doInsert

public static void doInsert(char[] insertData,
                            int insertOffset,
                            Node node,
                            boolean isUndoable,
                            java.lang.String editName,
                            java.lang.Object origin)
Utility routine to perform a single insert in the Node. This performs the edit as an IDE command.
Parameters:
insertData - the data to insert into the Node
insertOffset - the offset location to perform the insert
node - the Node to apply the edit to
isUndoable - whether this edit should be undoable
editName - the name of the edit to use for undo
origin - the origin of this edit, used for the UpdateMessage

doRemove

public static void doRemove(int removeOffset,
                            int removeCount,
                            Node node,
                            boolean isUndoable,
                            java.lang.String editName,
                            java.lang.Object origin)
Utility routine to perform a single remove in the Node. This performs the edit as an IDE command.
Parameters:
removeOffset - the start of the remove in the Node
removeCount - the number of characters to remove
node - the Node to apply the edit to
isUndoable - whether this edit should be undoable
editName - the name of the edit to use for undo
origin - the origin of this edit, used for the UpdateMessage

doReplace

public static void doReplace(char[] replaceData,
                             int replaceStartOffset,
                             int replaceEndOffset,
                             Node node,
                             boolean isUndoable,
                             java.lang.String editName,
                             java.lang.Object origin)
Utility routine to perform a single replace in the Node with the specified replace data. This performs the edit as an IDE command.
Parameters:
replaceData - the replace data for the location in the Node
replaceStartOffset - the starting offset of the location to replace
replaceEndOffset - the ending offset of the location to replace
node - the Node to apply the edit to
isUndoable - whether this edit should be undoable
editName - the name of the edit to use for undo
origin - the origin of this edit, used for the UpdateMessage

doReplaceAll

public static void doReplaceAll(char[] replaceData,
                                Node node,
                                boolean isUndoable,
                                java.lang.String editName,
                                java.lang.Object origin)
Utility routine to perform a replace all in the Node with the new contents. This performs the edit as an IDE command.
Parameters:
replaceData - the new data for the Node
node - the Node to apply the edit to
isUndoable - whether this edit should be undoable
editName - the name of the edit to use for undo
origin - the origin of this edit, used for the UpdateMessage

doEdit

public static void doEdit(Edit edit,
                          Node node,
                          java.lang.Object origin)
Utility routine to invoke the specified edit for the given Node as a command.
Parameters:
edit - the edit to apply
node - the Node to apply the edit to
origin - the origin of this edit, used for the UpdateMessage

Skip navigation links

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

E17493-03


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