| 
| Common Navigator - Global menu contributions [message #336095] | Wed, 20 May 2009 22:05  |  | 
| Eclipse User  |  |  |  |  | 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 #336115 is a reply to message #336104] | Thu, 21 May 2009 19:26   |  | 
| Eclipse User  |  |  |  |  | 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 #336182 is a reply to message #336116] | Thu, 28 May 2009 04:55  |  | 
| Eclipse User  |  |  |  |  | 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?
 >
 |  |  |  | 
Powered by 
FUDForum. Page generated in 0.04978 seconds