activating problem of standard actions in toolbar [message #241488] |
Wed, 13 February 2008 23:38 |
Eclipse User |
|
|
|
Originally posted by: extra8325.yahoo.co.jp
Hello,
Im trying to create my first GEF application as RCP and have a problem
with activating the action buttons undo, redo, and delete in the workbench
toolbar. They are shown in the toolbar but always deactivated (gray), even
if any model on the editor is selected (must be able to deleted) or is
moved (must be able to undo). Moving model figures is no problem, but
after moving an object it is still gray. I wrote undo methods in each
command class and also created a command class for deleting an object. A
subclass of ComponentEditPolicy which creates the delete command is
installed in the EditPart of nodes with COMPONENT_ROLE. I use
GraphicalEditorWithPalette as editor and it contains a method
createActions() with code such like
getActionRegistry().registerAction(new UndoRetargetAction());
Then there is a class which is a subclass of ActionBarContributor for
building and adding actions. The actions above are there created and added
on the toolbar with
this.addRetargetAction(new UndoRetargetAction());
and
toolBarManager.add(this.getActionRegistry().getAction(Action Factory.UNDO.getId()));
Also all actions are added as global action key in the method
declareGlobarlActionKeys().
this.addGlobalActionKey(ActionFactory.SELECT_ALL.getId());
In the configureGraphicalViewer() method of the editor Ive also tried to
set a contextmenu a subclass of ContextMenuProvider to the viewer and
register it with getSite().registerContextMenu(menuProvider, viewer), but
it didn't work. Ive already more than a few days tried according hints in
web, but sadly, they are still deactivated. I cant solve the problem.
Could anyone give me suggestions or help? Whats missing? Or what's wrong?
I would be very grateful for any hints. Thank you.
Best regards,
Tomoko
|
|
|
|
Re: activating problem of standard actions in toolbar [message #241513 is a reply to message #241488] |
Thu, 14 February 2008 15:22 |
Xiang Qinxian Messages: 119 Registered: July 2009 |
Senior Member |
|
|
Hi,
in the GEF editor, register a real action. RetargetAction just a
wrapper. The action should be org.eclipse.gef.ui.actions.UndoAction object.
Not work becuase no internal IAction handler.
Cheers,
Xiangya
Tomoko Kitamura 写道:
> Hello,
>
> I�m trying to create my first GEF application as RCP and have a problem
> with activating the action buttons undo, redo, and delete in the
> workbench toolbar. They are shown in the toolbar but always deactivated
> (gray), even if any model on the editor is selected (must be able to
> deleted) or is moved (must be able to undo). Moving model figures is no
> problem, but after moving an object it is still gray. I wrote undo
> methods in each command class and also created a command class for
> deleting an object. A subclass of ComponentEditPolicy which creates the
> delete command is installed in the EditPart of nodes with
> COMPONENT_ROLE. I use GraphicalEditorWithPalette as editor and it
> contains a method createActions() with code such like
>
> getActionRegistry().registerAction(new UndoRetargetAction());
>
> Then there is a class which is a subclass of ActionBarContributor for
> building and adding actions. The actions above are there created and
> added on the toolbar with
>
> this.addRetargetAction(new UndoRetargetAction());
> and
> toolBarManager.add(this.getActionRegistry().getAction(Action Factory.UNDO.getId()));
>
>
> Also all actions are added as global action key in the method
> declareGlobarlActionKeys().
> this.addGlobalActionKey(ActionFactory.SELECT_ALL.getId());
>
> In the configureGraphicalViewer() method of the editor I�ve also tried
> to set a contextmenu a subclass of ContextMenuProvider to the viewer and
> register it with getSite().registerContextMenu(menuProvider, viewer),
> but it didn't work. I�ve already more than a few days tried according
> hints in web, but sadly, they are still deactivated. I can�t solve the
> problem. Could anyone give me suggestions or help? What�s missing? Or
> what's wrong? I would be very grateful for any hints. Thank you.
>
> Best regards,
> Tomoko
>
>
|
|
|
|
Re: activating problem of standard actions in toolbar [message #241526 is a reply to message #241517] |
Fri, 15 February 2008 09:43 |
Eclipse User |
|
|
|
Originally posted by: extra8325.yahoo.co.jp
Hello,
I've found the cause of the problem. It was the init() method of the
editor. It was not necessary the method to override (I wrote it according
to a book)... After I cleared it, it works. Sorry for the fuss.
Best regards,
Tomoko
|
|
|
Powered by
FUDForum. Page generated in 0.03330 seconds