Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » KeyMap
KeyMap [message #437479] Fri, 04 June 2004 16:23
Eclipse UserFriend
Originally posted by: renzo1977.tiscali.it

I want change the kaymap of a SWT Text (or StyledText) to implement the
intellisense, but I'm not able to do it for Text, and for styledText I can
use only the method text.setKeyBinding(int key, int action); and I can't
set my Action.

Swing Example:

private void addPopupKeyMap()
{
// getKeymap() is a JTextPane method to have the key map for that object
// I defined originalKeyMap and popupKeyMap externally
originalKeyMap = getKeymap();

popupKeyMap = addKeymap("popupBindigs",originalKeyMap);

// PopupScrollAction is the costructor of my Action and when keypressed
// button down exec my instruction
Action action = new PopupScrollAction(1);
KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0);
// Redefine the map and so on
popupKeyMap.addActionForKeyStroke(key, action);
action = new PopupScrollAction(-1);
key = KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0);
popupKeyMap.addActionForKeyStroke(key, action);
action = new PopupScrollAction(-5);
key = KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0);
popupKeyMap.addActionForKeyStroke(key, action);
action = new PopupScrollAction(5);
key = KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0);
popupKeyMap.addActionForKeyStroke(key, action);
action = new PopupCopyTextAction();
key = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
popupKeyMap.addActionForKeyStroke(key, action);
action = new PopupCloseAction();
key = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
popupKeyMap.addActionForKeyStroke(key, action);

}

Sorry for my english for first and please help me....
Previous Topic:TableTreeItem - changing fonts
Next Topic:whether this feature is included in eclipse
Goto Forum:
  


Current Time: Fri Mar 29 07:15:30 GMT 2024

Powered by FUDForum. Page generated in 0.03092 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top