Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Global Action Handler
Global Action Handler [message #275696] Thu, 11 November 2004 06:55 Go to next message
Eclipse UserFriend
Originally posted by: brendan.moorehead.gmail.com

I have a window listener so i can find the current acitve editor
in the listener i have

private CutAction ctAction = new CutAction();

public void windowActivated(IWorkbenchWindow window) {
IEditorSite currentSite = window.getActivePage().
getActiveEditor().getEditorSite();
IActionBars bars = currentSite.getActionBars();
IAction gCutAction = bars.getGlobalActionHandler
(ActionFactory.CUT.getId());
ctAction.setCutActionSource(gCutAction);
bars.setGlobalActionHandler(ActionFactory.CUT.getId(),ctActi on);
IAction g2CutAction = bars.getGlobalActionHandler
(ActionFactory.CUT.getId());
}
basically this is the find out the handler for the cut action, and store it
then i set my action to handle the cut action.
In the run method for my action ctAction from the CutAction class
i call the run method of the action handler i stored the name of earlier

public void run() {
..... cutActionSource.run();
}

when i run this i am recursively calling the run method in CutAction though
i checked the action id i stored and it was:
org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAct ion @14f5a31
the last time i ran it

but still does not run its run method
this means cut from the toolbar does not work

i have the same problem with copy & paste
Re: Global Action Handler [message #275705 is a reply to message #275696] Thu, 11 November 2004 10:07 Go to previous message
Eclipse UserFriend
Originally posted by: brendan.moorehead.gmail.com

GOT IT SORTED


Brendan Moorehead wrote:

> I have a window listener so i can find the current acitve editor
> in the listener i have

> private CutAction ctAction = new CutAction();

> public void windowActivated(IWorkbenchWindow window) {
> IEditorSite currentSite = window.getActivePage().
> getActiveEditor().getEditorSite();
> IActionBars bars = currentSite.getActionBars();
> IAction gCutAction = bars.getGlobalActionHandler
> (ActionFactory.CUT.getId());
> ctAction.setCutActionSource(gCutAction);
> bars.setGlobalActionHandler(ActionFactory.CUT.getId(),ctActi on);
> IAction g2CutAction = bars.getGlobalActionHandler
> (ActionFactory.CUT.getId());
> }
> basically this is the find out the handler for the cut action, and store it
> then i set my action to handle the cut action.
> In the run method for my action ctAction from the CutAction class
> i call the run method of the action handler i stored the name of earlier

> public void run() {
> ..... cutActionSource.run();
> }

> when i run this i am recursively calling the run method in CutAction though
> i checked the action id i stored and it was:
> org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAct ion @14f5a31
> the last time i ran it

> but still does not run its run method
> this means cut from the toolbar does not work

> i have the same problem with copy & paste
Previous Topic:CVS Repository View no longer works
Next Topic:ActionBars
Goto Forum:
  


Current Time: Sat May 31 18:44:09 EDT 2025

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

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

Back to the top