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

E13403-07

oracle.javatools.editor
Interface ActionHookInvoker

All Known Implementing Classes:
AbstractEditingPlugin, AbstractInsight, BraceMatchingPlugin, EditorSelectionColumns, EditorSelectionWrap

public interface ActionHookInvoker

An ActionHookInvoker is an interface to a class that is responsible for performing some set of actions. Although this interface is almost identical to ActionInvoker, it is intended to be used to allow editor clients or plugins to register themselves as actions hooks in order to take over responsibility for handling a certain subset of editor actions for some specific task (preferably for a temporary period of time.

Let's take code insight as an example, when you pop up a completion window, the insight functionality needs to be able to trap the cursor navigation keys, escape (cancel), and enter (complete) from the editor. This is how it would be done. When the dialog is first brought up, it would register itself as an ActionHookDialog, and when it is dismissed, it will deregister itself.

Note, as a hint, in invokeAction don't do a series of if comparisons as it can get expensive (if there are a lot of actions or a lot of ActionHookInvokers.) For example, don't do this:

Bad code:

     public boolean invokeAction( String actionKey )
     {
       if ( actionKey.equals( "some-action-1" ) )
       {
         // call action 1 here
       }
       else if ( actionKey.equals( "some-action-2" ) )
       {
         // call action 2 here
       }
       else if ( actionKey.equals( "some-action-3" ) )
       {
         // call action 3 here
       }
     }
  

The better thing to do would be to build up a hash table of actions using the action names as keys and invoke the actions that way.

Note the difference in invokeAction() between this interface and ActionInvoker. invokeAction() returns a boolean here based on whether the action was performed by the ActionHookInvoker. Otherwise, the caller will continue on to the next invoker and so on.

A current limitation is that the DefaultKeyTypedAction is not accessible through this interface (or through any interface currently) as it its execution path is different.

See Also:
BasicEditorPane, ActionInvoker

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

Method Detail

invokeAction

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

Parameters:
actionKey - the published key for the action
Returns:
true if the action is handled, false otherwise

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

E13403-07

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