Extension SDK

oracle.jdeveloper.ceditor
Class CodeEditorController

java.lang.Object
  extended byoracle.ide.addin.BaseController
      extended byoracle.jdeveloper.ceditor.CodeEditorController
All Implemented Interfaces:
ContextMenuListener, Controller, PopupManager

public class CodeEditorController
extends BaseController
implements PopupManager, ContextMenuListener

The CodeEditorController is the controller for the CodeEditor Addin. It takes care of managing commands that this CodeEditor supports (i.e., Cut, Copy, or Paste.)


Field Summary
static int UNDO_WRAPPER_CMD_ID
          Command ID for UndoWrapperCommand
static int UNDO_WRAPPER_MSG
          This is the message that the user had new typed input
 
Constructor Summary
CodeEditorController(CodeEditor codeEditor)
          Constructs a new CodeEditorController.
 
Method Summary
 void checkCommands(Context context, Controller activeController)
          checkCommands() should be called on the controller associated with the active view whenever the Context changes.
protected  void checkCommandsAfterNavigation(Context context)
          Utility routine which is used to verify command sensitivity after a change in the caret position of the editor.
protected  void dispose()
          Utility routine to ensure that we remove ourselves from any listeners that we were added to to ensure that references are cleared.
 boolean handleDefaultAction(Context context)
          Called when the user double clicks on an item that has a popup menu.
 boolean handleEvent(IdeAction action, Context context)
          This method is called when a user interaction with a View triggers the execution of a command.
 void hidePopup(BasicEditorPane editorPane)
          Informs the editor client that the popup menu (if showing) should now be hidden.
 void poppingDown(ContextMenu popup)
          Called just before the context menu is popping down.
 void poppingUp(ContextMenu popup)
          Called just before the context menu is popping up.
 void showPopup(BasicEditorPane editorPane, java.awt.event.MouseEvent mouseEvent)
          Informs the editor client that the user requested a popup menu in the given editor pane, at the location specified in the mouseEvent.
 boolean update(IdeAction action, Context context)
          This method is called when the availability of a specific command needs to be determined.
 
Methods inherited from class oracle.ide.addin.BaseController
checkToolbarCommands, checkToolbarCommands, getView, supervisor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNDO_WRAPPER_CMD_ID

public static final int UNDO_WRAPPER_CMD_ID
Command ID for UndoWrapperCommand


UNDO_WRAPPER_MSG

public static final int UNDO_WRAPPER_MSG
This is the message that the user had new typed input

Constructor Detail

CodeEditorController

public CodeEditorController(CodeEditor codeEditor)
Constructs a new CodeEditorController.

Method Detail

dispose

protected void dispose()
Utility routine to ensure that we remove ourselves from any listeners that we were added to to ensure that references are cleared.


checkCommands

public void checkCommands(Context context,
                          Controller activeController)
checkCommands() should be called on the controller associated with the active view whenever the Context changes. The method gives the controller a chance to assign the enabled/disabled status of each of the context-sensitive Actions it owns. Calling this method on the active controller should cause all context-sensitive Actions owned by this controller and its supervisor's to be updated. No two controllers should attempt to update the status of the same action or else we would have redundant checking, which we want to avoid. checkCommands() should end by calling supervisor().checkCommands() to make sure actions dealt with by higher-level controllers get updated as well. This method is implemented by BaseController to call checkCommands() on the Ide itself. Note that the only context-sensitive Actions should be updated inside a checkCommands() method. Updating the enabled/disabled state of an action is handled by the update() command.

Specified by:
checkCommands in interface Controller
Overrides:
checkCommands in class BaseController
Parameters:
context - the current context. Null values are acceptable.
activeController - the controller associated with the active view. Null values are acceptable.

checkCommandsAfterNavigation

protected void checkCommandsAfterNavigation(Context context)
Utility routine which is used to verify command sensitivity after a change in the caret position of the editor.

Parameters:
context - the current context

update

public boolean update(IdeAction action,
                      Context context)
This method is called when the availability of a specific command needs to be determined. For example, it may be called when the user clicks on a menu, or perhaps to update the "enabled" state of toolbar actions. Call the action's setEnabled() method to set the appropriate command sensitivity.

Specified by:
update in interface Controller
Overrides:
update in class BaseController
Parameters:
action - the action associated with this command
context - the current context
Returns:
true if the controller handles the specified command.

handleEvent

public boolean handleEvent(IdeAction action,
                           Context context)
This method is called when a user interaction with a View triggers the execution of a command.

Specified by:
handleEvent in interface Controller
Overrides:
handleEvent in class BaseController
Parameters:
action - action whose command is to be executed.
Returns:
true if the controller handles the specified command.

showPopup

public void showPopup(BasicEditorPane editorPane,
                      java.awt.event.MouseEvent mouseEvent)
Informs the editor client that the user requested a popup menu in the given editor pane, at the location specified in the mouseEvent. The client is responsible for building/populating the popup menus (if necessary), and making it visible.

Specified by:
showPopup in interface PopupManager
Parameters:
editorPane - the editorPane that the user request occurred in
mouseEvent - the mouse event describing the location of the popup request.

hidePopup

public void hidePopup(BasicEditorPane editorPane)
Informs the editor client that the popup menu (if showing) should now be hidden. This may be in response to some user input or event.

Specified by:
hidePopup in interface PopupManager
Parameters:
editorPane - the editorPane for which the popup should be hidden

poppingUp

public void poppingUp(ContextMenu popup)
Called just before the context menu is popping up.

Specified by:
poppingUp in interface ContextMenuListener

poppingDown

public void poppingDown(ContextMenu popup)
Called just before the context menu is popping down.

Specified by:
poppingDown in interface ContextMenuListener

handleDefaultAction

public boolean handleDefaultAction(Context context)
Called when the user double clicks on an item that has a popup menu. Only one listener should return true from this menu.

Specified by:
handleDefaultAction in interface ContextMenuListener
Parameters:
context - the current context

Extension SDK

 

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