Extension SDK 10.1.2

oracle.ide.keyboard
Interface KeyStrokeContext

All Known Implementing Classes:
DefaultKeyStrokeContext, XMLKeyStrokeContext

public interface KeyStrokeContext

A KeyStrokeContext describes the keystrokes/command mappings available for a component.
oracle.ide.keyboard.KeyStrokes differ from javax.swing.KeyStroke because they can store multiple KeyStroke (ex: can store Ctrl+K, S).
A mapping can be global or local. An example of a component using global and local mappings is the debugger: F5 sets a breakpoint only in the editor while Ctrl+F2 should allways stop debugging.

You can have presets (Ex: JDev3.2, Msvc, ...) that defines different sets of mappings. To declare presets, you should return a List of preset names in getPresetKeyStrokeMaps(). If you only have one preset (jdev5) simply return null from getPresetKeyStrokeMaps().
KeyStrokesConstraint describes the keys the user can map in the local context. For example, in a text editor the user should not be allowed to map the 'S' key since it would prevent to type the 'S' character. However, the UI editor would allow the user to map the 'S' key to the Select command.


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.
 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.
 

Method Detail

getName

public java.lang.String getName()
Get the name of this context as it will appear in the shortcut configuration panel.

Returns:
The context name

getAllActions

public java.util.Set getAllActions(boolean bGlobal)
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).

Returns:
a Set of javax.swing.Action (note: IdeAction extends Action)

getPresetKeyStrokeMap

public KeyStrokeMap getPresetKeyStrokeMap(java.lang.Object preset,
                                          boolean bGlobal)
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.

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 java.util.List getAllPresets()
This method is called to get a list of the predefined mappings.

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

Returns:
a List of objects describing the presets or null to indicate you only have one mapping.

getAcceleratorFile

public java.lang.String getAcceleratorFile()
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"

Returns:
the name of the KDF file or null

Extension SDK

 

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