Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » [RCP] WorkbenchAdvisor vs plugin.xml (menus)
[RCP] WorkbenchAdvisor vs plugin.xml (menus) [message #256590] Tue, 29 June 2004 08:10 Go to next message
Michal Tkacz is currently offline Michal TkaczFriend
Messages: 105
Registered: July 2009
Senior Member
I'm starting to learn RCP and wondered whether declaring things in plugin.xml is
equivalent to creating them in my subclass of WorkbenchAdvisor. In particular,
I'd prefer to declare all my menus using actionSets extension point instead of
overriding fillActionBars method. However, it seems that if I don't create my
menu there it won't appear in the workbench. Here is a part of my plugin.xml
file (suppose fillActionBars is not overriden):

<extension
point="org.eclipse.ui.actionSets">
<actionSet
label="%actionSet"
id="actionSet">
<menu
label="%fileMenu"
id="file">
<groupMarker name="fileStart"/>
<separator name="fileEnd"/>
</menu>
<action
label="%quitAction"
class="org.eclipse.ui.internal.QuitAction"
menubarPath="file/fileEnd"
id="quitAction"/>
</actionSet>
</extension>

Note also that the same plugin declares extensions to
org.eclipse.core.runtime.applications and org.eclipse.core.runtime.products (if
this makes any difference).

Any help would be appreciated

Michal Tkacz
Re: [RCP] WorkbenchAdvisor vs plugin.xml (menus) [message #256698 is a reply to message #256590] Tue, 29 June 2004 15:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse.removeMe.guide.andRemoveMe.earthlink.andMeToo.com

They are equivalent but not interchangeable. Looking at your extract, the
QuitAction class your example wishes to contribute doesn't appear to
implement IWorkbenchWindowActionDelegate as expected by the <action> tag
(ergo "ClassCastException"). Take a look at IDEWorkbenchAdvisor. It
creates the standard menus and has a lot of the code you can emulate for
your own menus and those contributed by Eclipse plug-ins that you may wish
to reuse (e.g., text editor plug-in assumes you've created the standard Edit
pulldown).

-- Dan
-----------------------------------------
co-author, "The Java Developer's Guide to Eclipse"

"Michal Tkacz" <mehow@neurosoft.net> wrote in message
news:cbr852$6vo$1@eclipse.org...
> I'm starting to learn RCP and wondered whether declaring things in
plugin.xml is
> equivalent to creating them in my subclass of WorkbenchAdvisor. In
particular,
> I'd prefer to declare all my menus using actionSets extension point
instead of
> overriding fillActionBars method. However, it seems that if I don't create
my
> menu there it won't appear in the workbench. Here is a part of my
plugin.xml
> file (suppose fillActionBars is not overriden):
>
> <extension
> point="org.eclipse.ui.actionSets">
> <actionSet
> label="%actionSet"
> id="actionSet">
> <menu
> label="%fileMenu"
> id="file">
> <groupMarker name="fileStart"/>
> <separator name="fileEnd"/>
> </menu>
> <action
> label="%quitAction"
> class="org.eclipse.ui.internal.QuitAction"
> menubarPath="file/fileEnd"
> id="quitAction"/>
> </actionSet>
> </extension>
>
> Note also that the same plugin declares extensions to
> org.eclipse.core.runtime.applications and
org.eclipse.core.runtime.products (if
> this makes any difference).
>
> Any help would be appreciated
>
> Michal Tkacz
Re: [RCP] WorkbenchAdvisor vs plugin.xml (menus) [message #256733 is a reply to message #256698] Tue, 29 June 2004 16:46 Go to previous message
Michal Tkacz is currently offline Michal TkaczFriend
Messages: 105
Registered: July 2009
Senior Member
Dan Kehn wrote:
> They are equivalent but not interchangeable. Looking at your extract, the
> QuitAction class your example wishes to contribute doesn't appear to
> implement IWorkbenchWindowActionDelegate as expected by the <action> tag
> (ergo "ClassCastException").

You're absolutely right. I missed that (however no exceptions were thrown during
workbench startup). The point is that I'd like to reuse some common actions
(like Quit) but declare them in plugin.xml file if possible. It seems that I
could wrap org.eclipse.ui.internal.QuitAction instance with a class that
implements IWorkbenchWindowActionDelegate, I'll try that.

> Take a look at IDEWorkbenchAdvisor. It
> creates the standard menus and has a lot of the code you can emulate for
> your own menus and those contributed by Eclipse plug-ins that you may wish
> to reuse (e.g., text editor plug-in assumes you've created the standard Edit
> pulldown).

I will. Thanks for help.

Michal Tkacz
Previous Topic:Eclipse and Free TTS
Next Topic:Build Running/Complete API???
Goto Forum:
  


Current Time: Sun Jun 30 13:54:14 GMT 2024

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

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

Back to the top