Extension SDK 10.1.2

oracle.ide.keyboard
Class XMLKeyStrokeContext

java.lang.Object
  extended byoracle.ide.keyboard.XMLKeyStrokeContext
All Implemented Interfaces:
KeyStrokeContext
Direct Known Subclasses:
CanvasKeyStrokeContext, IdeKeyStrokes

public abstract class XMLKeyStrokeContext
extends java.lang.Object
implements KeyStrokeContext

This class should only be used if your addin is part of the product. If your addin is not part of the product, see the package documentation

Example:

public class MyKeys extends XMLKeyStrokeContext
{
  MyKeys()
  {
    super("MyContext");
  }

  public Set getAllActions(boolean bGlobal)
  {
    HashSet set = null;
    if (bGlobal)
    {
      set = new HashSet();
      IdeAction action1 = MyController. ...;
      IdeAction action2 = MyController. ...;
      set.add(myAction1);
      set.add(myAction2);
    }
    return set;
  }

  public static void register()
  {
    MyKeys myKeys = new MyKeys();
    KeyStrokeContextRegistry kscr = Ide.getKeyStrokeContextRegistry();
    kscr.addContext(tks);
  }
}


Constructor Summary
XMLKeyStrokeContext(java.lang.String sName)
           
 
Method Summary
 java.lang.String getAcceleratorFile()
          If your addin provides predefined accelerator definitions, you should return the name of the .KDF file in your jar file.
abstract  java.util.Set getAllActions(boolean bGlobal)
          Returns a Set of actions valid for the context.
 java.util.List getAllPresets()
          This method is called to get a list of the predefined mappings.
 java.lang.String getName()
          Get the name of this context as it will appear in the shortcut configuration panel.
 KeyStrokeMap getPresetKeyStrokeMap(java.lang.Object preset, boolean bGlobal)
          Returns the mapping between KeyStrokes and Actions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLKeyStrokeContext

public XMLKeyStrokeContext(java.lang.String sName)
Method Detail

getName

public java.lang.String getName()
Description copied from interface: KeyStrokeContext
Get the name of this context as it will appear in the shortcut configuration panel.

Specified by:
getName in interface KeyStrokeContext
Returns:
The context name

getAllActions

public abstract java.util.Set getAllActions(boolean bGlobal)
Description copied from interface: KeyStrokeContext
Returns a Set of actions valid for the context. If bGlobal is true, return the actions that are valid event when the focus is not on the window (ex: Debugger.stepInto). If bGlobal is false, return actions that are only valid on the focused window (ex: Debugger.setBreakpoint should only be valid in the editor).

Specified by:
getAllActions in interface KeyStrokeContext
Returns:
a Set of javax.swing.Action (note: IdeAction extends Action)

getPresetKeyStrokeMap

public final KeyStrokeMap getPresetKeyStrokeMap(java.lang.Object preset,
                                                boolean bGlobal)
Description copied from interface: KeyStrokeContext
Returns the mapping between KeyStrokes and Actions. If bGlobal is true, you must return mappings that are allways valid, if it is false, return the mappings that are only valid when your window or a child has the focus.

Specified by:
getPresetKeyStrokeMap in interface KeyStrokeContext
Parameters:
preset - corresponds to one of the elements returned by getPresetKeyStrokeMaps or null to get the default map.
bGlobal - true when asked for the global keys.

getAllPresets

public final java.util.List getAllPresets()
Description copied from interface: KeyStrokeContext
This method is called to get a list of the predefined mappings.

The values in the list should be one of the PC_ constants.

Specified by:
getAllPresets in interface KeyStrokeContext
Returns:
a List of objects describing the presets or null to indicate you only have one mapping.

getAcceleratorFile

public java.lang.String getAcceleratorFile()
Description copied from interface: KeyStrokeContext
If your addin provides predefined accelerator definitions, you should return the name of the .KDF file in your jar file. This method is only used if you extend XMLKeyStrokeContext. ex: "org/xxx/myaddin/mydefinitions.kdf"

Specified by:
getAcceleratorFile in interface KeyStrokeContext
Returns:
the name of the KDF file or null

Extension SDK

 

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