Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » key listener problem in editor
key listener problem in editor [message #243329] Tue, 03 June 2008 05:55 Go to next message
Eclipse UserFriend
Originally posted by: shady_86.sify.com

hello i have created a GraphicalEditorwithFlyoutPalette, i have used some ActionFactory actions to get key control for delete, undo, redo etc....

now when i open more than one instance of the editor then the keys will work on the latest editor which is open...

i think the reason is that i am doing it in the following way:

public void init(IEditorSite site, IEditorInput input) {
super.init(site, input);
ActionRegistry actionRegistry = getActionRegistry();
IActionBars bars = site.getActionBars();
String id = ActionFactory.UNDO.getId();
bars.setGlobalActionHandler(id, actionRegistry.getAction(id));
<b> ------------------------------------------------------------ ---- </b>
here i am setting action handler globally so the problem might be coming,

what can be the other way to have the keyboard assistance where all the instance will have the keyboard functionality?..,
Re: key listener problem in editor [message #243334 is a reply to message #243329] Tue, 03 June 2008 08:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: shady_86.sify.com

well i found one more way of doing this as given in this thread

http://www.eclipsezone.com/forums/thread.jspa?messageID=9193 3362&#91933362

keyHandler = new KeyHandler();

keyHandler.put(KeyStroke.getPressed(SWT.DEL, 127, 0),
getActionRegistry().getAction(ActionFactory.DELETE.getId())) ;

keyHandler.put(KeyStroke.getPressed(26, SWT.CTRL),
getActionRegistry().getAction(ActionFactory.UNDO.getId()));

keyHandler.put(KeyStroke.getPressed(25, SWT.CTRL),
getActionRegistry().getAction(ActionFactory.REDO.getId()));
------------------------------------------------------------ -----


but the undo and redo is not working here, they have said that they have fixed the problem by configuring the undo and redo action in the WorkbenchAdvisor class.

now how we configure actions in the WorkbenchAdvisor class? i thought it was only done in the ActionBarAdvisor class and i have already configured both the actions in the ActionBarAdvisor class
------------------------------------------------------------ -------


IWorkbenchAction redo = ActionFactory.REDO.create(window);
register(redo);
IWorkbenchAction undo = ActionFactory.UNDO.create(window);
register(undo);
Re: key listener problem in editor [message #243374 is a reply to message #243334] Wed, 04 June 2008 11:21 Go to previous message
Eclipse UserFriend
Originally posted by: shady_86.sify.com

well i found a very simple solution to this,

we can resolve this issue by simply making the contributor class and then setting it in the contributor class field of the editor in the plugin.xml file.

the contributor class will be extended with the GEF ActionBarContributor. then we just have to simply fill the implemented methods with any action that we want.
Previous Topic:Zest - Overlapping Nodes
Next Topic:Palette sample with Eclipse 3.3
Goto Forum:
  


Current Time: Tue Mar 19 09:22:43 GMT 2024

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

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

Back to the top