Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Contributing menu/toolbar items to my GEF/RCP app
Contributing menu/toolbar items to my GEF/RCP app [message #234690] Mon, 28 May 2007 14:34 Go to next message
Eclipse User
Originally posted by: mlevison.gmail.com

1) Why use ActionContributor vs. adding Actions in the ActionBarAdvisor?
2) What is RetargetAction (org.eclipse.gef.ui.actions)?
3) When adding actions via an ActionBarContributor should you add the
actions to a ‘global handler’:
• pageSite.getActionBars().setGlobalActionHandler() as per the logic
editor sample **or** editor handler
• getEditorSite().getService(IHandlerService.class).
activateHandler() as per the shapes example?
4) If you’re using the ActionBarContributor how do you contribute to a
menu that already exists – perhaps file? In a specific place in that menu?
5) Assuming the ActionBarContributor is right way to go how add the
PrintAction? There doesn’t seem to be a RetargetAction predefined for
print – but it can’t easily be added in the ActionBarAdvisor since its
constructor requires an edit part.

Thanks in advance for any help
Mark Levison
------------------------------------------------------------ ----------
Blog: http://www.notesfromatooluser.com/
Most Popular posts:
Aperture vs. Lightroom - best comparisons
http://www.notesfromatooluser.com/2007/02/aperture_vs_lig.ht ml
Scrum in a Nutshell or 5 minutes to learn Scrum
http://www.notesfromatooluser.com/2006/11/scrum_in_a_nuts.ht ml
Getting Things Done!!! Can't Keep Track of all the tasks you have to do?
Need a better Tool to Implement GTD?
http://www.notesfromatooluser.com/2006/12/getting_things_.ht ml
Re: Contributing menu/toolbar items to my GEF/RCP app [message #234719 is a reply to message #234690] Tue, 29 May 2007 09:48 Go to previous messageGo to next message
Eclipse User
Originally posted by: Lehmann.j.gmx.net

to 5)
just look at the IBM Redbook(
http://www.redbooks.ibm.com/abstracts/sg246302.html ) at side 144. There it
is explained.

kind regards

"Mark Levison" <mlevison@gmail.com> schrieb im Newsbeitrag
news:f3f7aq$o0r$1@build.eclipse.org...
> 1) Why use ActionContributor vs. adding Actions in the ActionBarAdvisor?
> 2) What is RetargetAction (org.eclipse.gef.ui.actions)?
> 3) When adding actions via an ActionBarContributor should you add the
> actions to a
Re: Contributing menu/toolbar items to my GEF/RCP app [message #234743 is a reply to message #234719] Tue, 29 May 2007 16:09 Go to previous message
Eclipse User
Originally posted by: mlevison.gmail.com

Jens Lehmann wrote:
> to 5)
> just look at the IBM Redbook(
> http://www.redbooks.ibm.com/abstracts/sg246302.html ) at side 144. There it
> is explained.
>
Jens thanks for the help - I've read that doc before so it was staring
me in the face. Unfortunately it doesn't seem to have done anything.

No menu or toolbar item were added - so it seems I'm back to my original
question. I know how to contribute the action through the
ActionBarAdvisor - I even wrote a shim DiagramPrintAction to work around
not having the edit part when its time to create the action - but this
all seems like hard work. I assume there's a better way to do this:

public class DiagramPrintAction extends BasicAction {
public DiagramPrintAction(String text, String iconPath, String
accelerator, IWorkbenchWindow inWindow) {
super(text, iconPath, accelerator, inWindow);
setActionDefinitionId("org.eclipse.ui.file.print");
}

public boolean isEnabled() {
IEditorPart editorPart = getActiveEditor();
return editorPart != null;
}

public void run() {
IEditorPart editorPart = getActiveEditor();
PrintAction printAction = new PrintAction(editorPart);
printAction.run();
}

// getActiveEditor is a method in our base class in that will get the
editor that is active at the moment
}

So my questions
1) What did registering the print action and declaring the global action
key do?
2) If I need strongly typed constructors and so don't want to use
plugin.xml is there an elegant/appropriate way to install a print action
in the menu?
3) Why isn't there a retargetAction for print? (A variation of the what
is a retargetAction question).

Cheers
Mark Levison
Previous Topic:How to get IFile object from the file other then workspace
Next Topic:How to show high resolution images to draw2D ImageFigure
Goto Forum:
  


Current Time: Thu Jul 24 13:54:43 EDT 2014

Powered by FUDForum. Page generated in 0.03799 seconds