Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Common Navigator - Global menu contributions
Common Navigator - Global menu contributions [message #336095] Thu, 21 May 2009 02:05 Go to next message
Thomas Spall is currently offline Thomas Spall
Messages: 29
Registered: July 2009
Junior Member
I am trying to make an RCP project with an own 'ProjectExplorer' view
derived from the Common Navigator. The view appears properly and displays
the project contents, so far so good, but I have problems setting up its
menu contributions. The popup menu of the view works fine, it has a
"New->Project" entry automatically. Now, what I'm after is to get that
"New->Project" to appear also in the global workbench's 'File' menu.

Is it possible to get the Common Navigator to not only produce that
'New->Project' entry in its PopupMenu but also to produce those menu
entries (and of course those entries linked to the proper actions, i.e. a
NewProject wizard should open when clicking on 'File->New->Project') in
the global menu bar?

Here is a copy of the relevant parts of my RCP application's plugin.xml
file:

<extension point="org.eclipse.ui.views">
<view
name="Project Explorer"
class="org.eclipse.ui.navigator.CommonNavigator"
id="compmodelling.view.project">
</view>
</extension>

<extension point="org.eclipse.ui.navigator.viewer">
<viewerActionBinding viewerId="compmodelling.view.project">
<includes>
<actionExtension
pattern="org.eclipse.ui.navigator.resources.*" />
</includes>
</viewerActionBinding>
<viewerContentBinding viewerId="compmodelling.view.project">
<includes>
<contentExtension
pattern="org.eclipse.ui.navigator.resourceContent" />
<contentExtension
pattern="org.eclipse.ui.navigator.resources.filters.*"/>
<contentExtension
pattern="org.eclipse.ui.navigator.resources.linkHelper"/>
<contentExtension
pattern="org.eclipse.ui.navigator.resources.workingSets"/>
</includes>
</viewerContentBinding>
</extension>
Re: Common Navigator - Global menu contributions [message #336100 is a reply to message #336095] Thu, 21 May 2009 12:57 Go to previous messageGo to next message
Andy Czerwonka is currently offline Andy Czerwonka
Messages: 42
Registered: July 2009
Member
I'm also very interested to the answer here. I'm using the Common
Navigator as part of an RCP application without resources. I can't get
my commonWizard extensions to show up at all.

On 2009-05-20 20:05:21 -0600, tspall@opencloud.com (Thomas Spall) said:

> I am trying to make an RCP project with an own 'ProjectExplorer' view
> derived from the Common Navigator. The view appears properly and
> displays the project contents, so far so good, but I have problems
> setting up its menu contributions. The popup menu of the view works
> fine, it has a "New->Project" entry automatically. Now, what I'm after
> is to get that "New->Project" to appear also in the global workbench's
> 'File' menu.
> Is it possible to get the Common Navigator to not only produce that
> 'New->Project' entry in its PopupMenu but also to produce those menu
> entries (and of course those entries linked to the proper actions, i.e.
> a NewProject wizard should open when clicking on 'File->New->Project')
> in the global menu bar?
>
> Here is a copy of the relevant parts of my RCP application's plugin.xml file:
>
> <extension point="org.eclipse.ui.views">
> <view
> name="Project Explorer"
> class="org.eclipse.ui.navigator.CommonNavigator"
> id="compmodelling.view.project">
> </view>
> </extension>
>
> <extension point="org.eclipse.ui.navigator.viewer">
> <viewerActionBinding viewerId="compmodelling.view.project">
> <includes>
> <actionExtension pattern="org.eclipse.ui.navigator.resources.*" />
> </includes>
> </viewerActionBinding>
> <viewerContentBinding viewerId="compmodelling.view.project">
> <includes>
> <contentExtension
> pattern="org.eclipse.ui.navigator.resourceContent" />
> <contentExtension
> pattern="org.eclipse.ui.navigator.resources.filters.*"/>
> <contentExtension
> pattern="org.eclipse.ui.navigator.resources.linkHelper"/>
> <contentExtension
> pattern="org.eclipse.ui.navigator.resources.workingSets"/>
> </includes>
> </viewerContentBinding>
> </extension>
Re: Common Navigator - Global menu contributions [message #336104 is a reply to message #336100] Thu, 21 May 2009 13:24 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

How are you adding the File>New menu in your RCP app? See
org.eclipse.ui.internal.ide.WorkbenchActionBuilder.createFil eMenu() for
how it is done in the eclipse IDE.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Re: Common Navigator - Global menu contributions [message #336115 is a reply to message #336104] Thu, 21 May 2009 23:26 Go to previous messageGo to next message
Thomas Spall is currently offline Thomas Spall
Messages: 29
Registered: July 2009
Junior Member
Hi,
I think I wrongly assumed the Common Navigator owns the "New>Project..."
and "New>Examples..." entries etc.. That's why I thought I must be able to
tell it somehow to put these entries not only in its popup menu but also
to contribute them to the workbench menu. Well, it looks like you CAN'T
tell it to do that.

So, you have to setup that file>New menu yourself. How to do that?...After
searching around quite blindly, I finally stumbled upon some classes in
the the 'org.eclipse.ui.actions' package.
The 'ActionFactory' and 'ContributionItemFactory' in there were kind of
known and I (possibly again wrongly) assumed that they were capable of
manufacturing all items necessary for setting up menus. But this here is
eclipse, so obviously that would be too easy a solution!...in the same
package there is another class, 'NewWizardMenu', which doesn't get
manufactured, and THAT is what I was looking for. In the defining plugin
of your RCP application there will be a class called 'XXXActionBarAdvisor'
with a 'fillMenuBar()' method. Here's the code snippet of what should be
in there to show the standard "File>New>Project..." "File>New>Examples..."
etc. entries:

protected void fillMenuBar(IMenuManager menu) {
IMenuManager fileMenu = new MenuManager(
Messages.ApplicationMenuName_File,
IWorkbenchActionConstants.M_FILE);

fileMenu.add(new
GroupMarker(IWorkbenchActionConstants.FILE_START));

IMenuManager fileNewMenu = new MenuManager(
Messages.ApplicationMenuName_New, "new");

NewWizardMenu newWizardMenu = new
NewWizardMenu(this.getWindow(), "some.id.of.your.wild.choice");
fileNewMenu.add(newWizardMenu);
GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
fileMenu.add(fileNewMenu);
...
(other menu setups like EDIT, HELP)
Re: Common Navigator - Global menu contributions [message #336116 is a reply to message #336104] Fri, 22 May 2009 00:23 Go to previous messageGo to next message
Andy Czerwonka is currently offline Andy Czerwonka
Messages: 42
Registered: July 2009
Member
On 2009-05-21 07:24:37 -0600, Paul Webster <pwebster@ca.ibm.com> said:

> How are you adding the File>New menu in your RCP app? See
> org.eclipse.ui.internal.ide.WorkbenchActionBuilder.createFil eMenu() for
> how it is done in the eclipse IDE.
>
> PW

Let's assume I can get the File meny in there. The question I have is
really around the commonWizard extension. I added added this extension
and see nothing show up in the Common Navigator whatesoever. I've
tried different 'enabled' options, onese that I know work because I use
them for for my trigger points.

I have nothing in my menuGroupId or associatedExtensionId - could that be it?
Re: Common Navigator - Global menu contributions [message #336182 is a reply to message #336116] Thu, 28 May 2009 08:55 Go to previous message
Tom Hofmann is currently offline Tom Hofmann
Messages: 770
Registered: July 2009
Senior Member
Andy,

not sure whether this is answers your question... what we do is we add
the (internal) NewActionProvider for non-resource elements contributed
by my navigator extensions:

<!-- Adds the New wizards to non-resource VCML elements -->
<actionProvider
class=" org.eclipse.ui.internal.navigator.resources.actions.NewActio nProvider "
overrides="org.eclipse.ui.navigator.resources.NewActions">
<enablement>
<and>
<adapt type="com.example.model.MyCustomElement" />
<not><adapt type="org.eclipse.core.resources.IResource" /></not>
</and>
</enablement>
</actionProvider>


HTH, tom


Andy Czerwonka wrote:
> The question I have is really around the commonWizard extension. I
> added added this extension and see nothing show up in the Common
> Navigator whatesoever. I've tried different 'enabled' options, onese
> that I know work because I use them for for my trigger points.
>
> I have nothing in my menuGroupId or associatedExtensionId - could that
> be it?
>
Previous Topic:ShowViewDialog to open only FastViews
Next Topic:IResourceListener only called at workspace level.
Goto Forum:
  


Current Time: Sat Sep 20 01:59:23 GMT 2014

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

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