Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » GEF Action to confirm deletion
GEF Action to confirm deletion [message #766886] Fri, 16 December 2011 10:45 Go to next message
Alexandre Torres is currently offline Alexandre Torres
Messages: 138
Registered: July 2009
Senior Member
Hi,
I need to add code to confirm the delete action, before executing the delete command.
I implemented a class that extends ActionBarContributor, and contributed with retarget actions as follows:

protected void buildActions() {
addRetargetAction(new DeleteRetargetAction());
addRetargetAction(new UndoRetargetAction());
addRetargetAction(new RedoRetargetAction());
}
I tryed to extend DeleteRetargetAction and override the run method, but it does not work, becouse retarget actions delegate to registered delete actions. And now I'm absolutly lost. I just cannot guess who tells what action is executed, or when.
So, what is the correct way to contribute with:

1.A Customized delete action
and
2.My own actions (a WhateverAction will need a retarget action?).

Thanks

Re: GEF Action to confirm deletion [message #767253 is a reply to message #766886] Sat, 17 December 2011 07:55 Go to previous messageGo to next message
Alexandre Torres is currently offline Alexandre Torres
Messages: 138
Registered: July 2009
Senior Member
Solved: just overrided the createActions of my Editor
When the editor extends GraphicalEditorWithFlyoutPalette, the action creation is done by this method.
What I did was something like that:

ActionRegistry registry = getActionRegistry();
IAction action;
action = new CancelableDeleteAction((IWorkbenchPart) this); //My extension to DeleteAction
registry.registerAction(action);
getSelectionActions().add(action.getId());

The actionBarContributor is a dead end to make this kind of change.


Re: GEF Action to confirm deletion [message #768597 is a reply to message #767253] Tue, 20 December 2011 07:40 Go to previous message
kresildefix is currently offline kresildefix
Messages: 2
Registered: October 2011
Junior Member
Thank you for posting your solution.

I tried to create an action to enter the properties of the selected object within a wizard for comfort reasons and there was no way to add my custom action to the actionbarcontributor.

So i added the preferences action to the actionbarcontributor and overwrote it with my implementation like you described it and its working very well.

Best Regards
Kenny
Previous Topic:Disabling animation in gef ui palette ??
Next Topic:GEF Help
Goto Forum:
  


Current Time: Sat Apr 19 16:15:11 EDT 2014

Powered by FUDForum. Page generated in 0.02774 seconds