Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » activating problem of standard actions in toolbar
activating problem of standard actions in toolbar [message #241488] Wed, 13 February 2008 23:38 Go to next message
Eclipse UserFriend
Originally posted by: extra8325.yahoo.co.jp

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 #241498 is a reply to message #241488] Thu, 14 February 2008 10:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: extra8325.yahoo.co.jp

I think, I should ask it in RCP Newsgroup and try it now... But if anyone
in this newsgroup can help me, I would be glad to get responses. Thank you.

Tomoko
Re: activating problem of standard actions in toolbar [message #241513 is a reply to message #241488] Thu, 14 February 2008 15:22 Go to previous messageGo to next message
Xiang Qinxian is currently offline Xiang QinxianFriend
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 #241517 is a reply to message #241513] Thu, 14 February 2008 16:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: extra8325.yahoo.co.jp

Thank you!!!
I'll try it.

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 Go to previous message
Eclipse UserFriend
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
Previous Topic:Opening a Palette View when editor is open thwors Error
Next Topic:Property Sheet and undo
Goto Forum:
  


Current Time: Fri Apr 26 09:48:44 GMT 2024

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

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

Back to the top