Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » New Project / New File Comtext Menu shortcut(In my own view)
New Project / New File Comtext Menu shortcut [message #508362] Mon, 18 January 2010 14:54 Go to next message
Alexander Mack is currently offline Alexander MackFriend
Messages: 100
Registered: July 2009
Senior Member
Hello,
I have my own Navigator View just as my own perspective.
Now I want in the context menu (right click) of my view under the "New.Button" MyProject and MyFile to appear.
I've already added the WizardShortcuts in my perspective via
private void defineShortcuts(IPageLayout pLayout) {
		pLayout.addNewWizardShortcut("eu....projectWizardEntry");
		pLayout.addNewWizardShortcut("eu.....fileWizardEntry");		
	}


In the Package explorer they do appear but not in my view.
I think I have to add the correct viewActionBinding to my view but I do not know the id
<viewerActionBinding
       	viewerId="eu.emundo.atomspro.architecturemodeler.architecturmodelerview">
       	<includes>
       	<actionExtension pattern="org.eclipse.ui.*"/>
       	</includes>
	</viewerActionBinding>



I would appreciate any help!
Thanks in advance & best regards
Alex
Re: New Project / New File Comtext Menu shortcut [message #508382 is a reply to message #508362] Mon, 18 January 2010 15:46 Go to previous messageGo to next message
Francis Upton IV is currently offline Francis Upton IVFriend
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
It sounds like you are using the CommonNavigator for your view (based on your use of the viewerActionBinding). You will need to define a navigatorContent element and include a commonWizard element in that to define the new wizards for the Common Navigator.

Then use the viewerContentBinding to look the navigatorContent extension to your viewer.

See the section on Common Navigator Framework in the Platform Plugin Developer's guide in the help.


Re: New Project / New File Comtext Menu shortcut [message #508576 is a reply to message #508362] Tue, 19 January 2010 13:45 Go to previous messageGo to next message
Alexander Mack is currently offline Alexander MackFriend
Messages: 100
Registered: July 2009
Senior Member
Ahh thanks a lot, did not see the extension attribute Smile
But what is the reason for the fact that the "New Project Shortcut" is not at the top of the New -> menu.
Are there any further values you have to change?
And I thought that the root of the view is IWorkspaceRoot, so I put IResource in the enablement attribute, but on the root the shortcuts do not appear:

<extension point="org.eclipse.ui.navigator.navigatorContent">
	<commonWizard
       type="new"
       wizardId="sample....wizard.projectWizardEntry">
    <enablement>
			<adapt type="org.eclipse.core.resources.IResource"/>
	</enablement>
	</commonWizard>
	<commonWizard
       type="new"
       wizardId="sample....wizard.fileWizardEntry">
    <enablement>
    	<adapt type="org.eclipse.core.resources.IResource"/>
	</enablement>
	</commonWizard>
	<commonFilter
         activeByDefault="true"
         description="Filters all non Architecture Projects"
         id="sample....ArchtectureProjectFilter"
         name="Architecture Project Filter">
      <filterExpression>
      	<not>
      		<or>
      			<adapt type="org.eclipse.core.resources.IFile"/>
      			<instanceof value="sample....navigator.DiagramTreeData"/>
      			<adapt type="org.eclipse.core.resources.IFolder"/>
      			<adapt type="org.eclipse.core.resources.IProject">
	            	<test
	                  forcePluginActivation="true"
	                  property="org.eclipse.core.resources.projectNature"
	                  value="sample....ArchitectureProjectNature">
           	 		</test>
         		</adapt>
      		</or>
      	</not>
      </filterExpression>
   </commonFilter>
	<navigatorContent
       id="sample....navigatorcontent.architectureContent"
       name="Architecture Model Content"
       contentProvider="sample....navigator.DiagramContentProvider"
       labelProvider="sample....navigator.LabelContentProvider"
       activeByDefault="true">
       <triggerPoints>
       		<or>
       			<and>
	       			<instanceof value="org.eclipse.core.resources.IFile"/>
	       			<test
		                     forcePluginActivation="true"
		                     property="org.eclipse.core.resources.extension"
		                     value="atomspro_am"/>
	       		
	       		</and>
	       		<instanceof
	               value="sample....navigator.DiagramTreeData">
	       		</instanceof>
       		</or>
       </triggerPoints>
       <possibleChildren>
       		<instanceof
               value="sample....navigator.DiagramTreeData">
       		</instanceof>
       </possibleChildren>
	</navigatorContent>


Thanks a lot for your help

best regards, Alex
Re: New Project / New File Comtext Menu shortcut [message #508635 is a reply to message #508576] Tue, 19 January 2010 16:45 Go to previous message
Francis Upton IV is currently offline Francis Upton IVFriend
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
Use the popupMenu element in the viewer extension.

Look at org.eclipse.ui.navigator.resources/plugin.xml for the implementation of the project explorer; this will show you how the menus, etc are setup for that.

Francis


Previous Topic:actionSetPartAssociations with a multipage editor
Next Topic:Detached views
Goto Forum:
  


Current Time: Tue Mar 19 04:03:24 GMT 2024

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

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

Back to the top