Extension SDK

oracle.ide.keyboard
Class DefaultKeyStrokeContext

java.lang.Object
  extended byoracle.ide.keyboard.DefaultKeyStrokeContext
All Implemented Interfaces:
KeyStrokeContext

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

This class implements the most common behavior of a KeyStrokeContext. The add/removeSubContext mechanism allows components to attach their context to another. For example, if the code editor exposes his DefaultKeyStrokeContext instance, addins that are specific to the code editor can add their context and the local accelerators will be used by the code editor. Additionally, they will appear in the code editor configuration panel.


Constructor Summary
DefaultKeyStrokeContext()
           
 
Method Summary
protected  void addGlobalKeyStrokes(KeyStrokeMap map)
          Overwrite this method to define your global keystrokes.
protected  void addLocalKeyStrokes(KeyStrokeMap map)
          Overwrite this method to define your global keystrokes The codes is similar to addGlobalKeyStrokes.
 void addSubContext(KeyStrokeContext ksc)
          Attach the sub-context ksc to this one.
protected static void addToMap(KeyStrokeMap map, int nId, javax.swing.KeyStroke ks)
          Helper method for filling the KeyStrokeMaps in addGlobal/LocalKeyStrokes.
protected static void addToMap(KeyStrokeMap map, int nId, KeyStrokes kss)
          Helper method for filling the KeyStrokeMaps in addGlobal/LocalKeyStrokes.
 java.util.List getAllPresets()
          By default, DefaultKeyStrokeContexts only have a default preset.
 KeyStrokesConstraint getKeyStrokeConstraint()
          By default, mappings of a DefaultKeyStrokeContexts have a text editor constraint.
 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.
static boolean hasConfigPanel()
          Most contexts only hold global keys and those are editable in the global panel.
 void removeSubContext(KeyStrokeContext ksc)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface oracle.ide.keyboard.KeyStrokeContext
getAllActions
 

Constructor Detail

DefaultKeyStrokeContext

public DefaultKeyStrokeContext()
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

hasConfigPanel

public static boolean hasConfigPanel()
Most contexts only hold global keys and those are editable in the global panel. deprecated


addSubContext

public final void addSubContext(KeyStrokeContext ksc)
Attach the sub-context ksc to this one.


removeSubContext

public final void removeSubContext(KeyStrokeContext ksc)

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()
By default, DefaultKeyStrokeContexts only have a default preset.

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

getKeyStrokeConstraint

public final KeyStrokesConstraint getKeyStrokeConstraint()
By default, mappings of a DefaultKeyStrokeContexts have a text editor constraint.

Specified by:
getKeyStrokeConstraint in interface KeyStrokeContext
Returns:
constraints for local context.

addGlobalKeyStrokes

protected void addGlobalKeyStrokes(KeyStrokeMap map)
Overwrite this method to define your global keystrokes. The code typically looks like:
 addToMap(map, Xxx.YYY_CMD_ID, XxxArb.getAccelerator(XxxArb.YYY_ACCELERATOR))
 


addLocalKeyStrokes

protected void addLocalKeyStrokes(KeyStrokeMap map)
Overwrite this method to define your global keystrokes The codes is similar to addGlobalKeyStrokes.

See Also:
addGlobalKeyStrokes(oracle.ide.keyboard.KeyStrokeMap)

addToMap

protected static void addToMap(KeyStrokeMap map,
                               int nId,
                               javax.swing.KeyStroke ks)
Helper method for filling the KeyStrokeMaps in addGlobal/LocalKeyStrokes.

Parameters:
map - the KeyStrokeMap to fill.
nId - the command ID.
ks - the keystroke associated with the command ID.
See Also:
#addGlobalKeyStrokes, #addLocalKeyStrokes

addToMap

protected static void addToMap(KeyStrokeMap map,
                               int nId,
                               KeyStrokes kss)
Helper method for filling the KeyStrokeMaps in addGlobal/LocalKeyStrokes.

Parameters:
map - the KeyStrokeMap to fill.
nId - the command ID.
kss - the multi-keystroke associated with the command ID.
See Also:
#addGlobalKeyStrokes, #addLocalKeyStrokes

Extension SDK

 

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