Extension SDK 10.1.2

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.
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.lang.String getAcceleratorFile()
          If your addin provides predefined accelerator definitions, you should return the name of the .KDF file in your jar file.
 java.util.List getAllPresets()
          By default, DefaultKeyStrokeContexts only have a default preset.
 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
 
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

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

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.

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, 2004, Oracle. All rights reserved.