Common Navigator Framework - show standard menu items [message #765543] |
Wed, 14 December 2011 09:32 |
Missing name Missing name Messages: 3 Registered: December 2011 |
Junior Member |
|
|
Hi,
i'm writing an Eclipse Plugin to show a TreeViewer based on the Common Navigator Framework. The view should be a Namespace Explorer similar to the Package Explorer in Java. I want to use the context menu of the CNF with the standard menu items Copy/Paste/Delete, Open/Close Project, Team(SVN), Import/Export.
The viewer get a new content provider, which parse the filessystem and generate a model for displaying. After this, the only thing in the context menu is the Team menu with subclipse menu contribution. The model classes have their equivalent(IProject, IFolder, IFile) as attribute and the method getAdapter() return that attribute.
Searching the web i found several tutorials, but nothing solved the problem:
Menu contribution like org.eclipse.ui.edit.delete in the plugin.xml the menu items are shown but greyed out. Solution in Eclipse RCP caused of bug (bugs.eclipse.org/bugs/show_bug.cgi?id=270007), there is an ActionBarAdvisor class to register the actions , but in the view plugin there is no advisor class.
Adding in the viewer a popup menu in the plugin.xml with the standard insertion points didn't solve.
I'm very frustrated
Please help.
plugin.xml
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.views">
<category
name="Namespace Explorer"
id="com.myexample.xyz.namespaceexplorer">
</category>
<view
name="Namespace Explorer"
icon="icons/sample.gif"
category="com.myexample.xyz.namespaceexplorer"
class="com.myexample.xyz.namespaceexplorer.views.AquilaNavigator"
id="com.myexample.xyz.namespaceexplorer">
</view>
</extension>
<extension
point="org.eclipse.ui.navigator.viewer">
<viewer
viewerId="com.myexample.xyz.namespaceexplorer">
<popupMenu
id="com.myexample.xyz.namespaceexplorer#PopupMenu">
<insertionPoint
name="group.edit"
separator="true">
</insertionPoint>
<insertionPoint
name="group.properties"
separator="true">
</insertionPoint>
</popupMenu>
</viewer>
<viewerActionBinding
viewerId="com.myexample.xyz.namespaceexplorer">
<includes>
<actionExtension
pattern="org.eclipse.ui.navigator.resources.*">
</actionExtension>
</includes>
</viewerActionBinding>
<viewerContentBinding
viewerId="com.myexample.xyz.namespaceexplorer">
<includes>
<contentExtension
pattern="com.myexample.xyz.namespaceexplorer.navigatorContent.virtualContent">
</contentExtension>
<contentExtension
pattern="org.eclipse.ui.navigator.resources.linkHelper">
</contentExtension>
<contentExtension
pattern="org.eclipse.ui.navigator.resources.filters.workingSet">
</contentExtension>
<contentExtension
pattern="com.myexample.xyz.namespaceexplorer.incFilters.*">
</contentExtension>
</includes>
</viewerContentBinding>
</extension>
<extension
point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="org.eclipse.ui.resourcePerspective">
<view
id="com.myexample.xyz.namespaceexplorer"
ratio="0.5"
relationship="stack"
relative="org.eclipse.ui.navigator.ProjectExplorer">
</view>
</perspectiveExtension>
</extension>
<extension
point="org.eclipse.help.contexts">
<contexts
file="contexts.xml">
</contexts>
</extension>
<extension
point="org.eclipse.ui.navigator.navigatorContent">
<commonFilter
activeByDefault="true"
id="com.myexample.xyz.namespaceexplorer.incFilters.startsWithDot"
name="starts with dot">
<filterExpression>
<and>
<adapt
type="org.eclipse.core.resources.IResource">
<test
property="org.eclipse.core.resources.name"
value=".*">
</test>
</adapt>
</and>
</filterExpression>
</commonFilter>
<commonFilter
activeByDefault="true"
id="com.myexample.xyz.namespaceexplorer.incFilters.allFilesNotEz"
name="all files not ez">
<filterExpression>
<and>
<adapt
type="org.eclipse.core.resources.IFile">
<test
property="org.eclipse.core.resources.extension"
value="*">
</test>
<not>
<test
property="org.eclipse.core.resources.extension"
value="ez">
</test>
</not>
</adapt>
</and>
</filterExpression>
</commonFilter>
<navigatorContent
activeByDefault="true"
contentProvider="com.myexample.xyz.namespaceexplorer.navigatorContent.ViewContentProvider"
id="com.myexample.xyz.namespaceexplorer.navigatorContent.virtualContent"
labelProvider="com.myexample.xyz.namespaceexplorer.navigatorContent.ViewLabelProvider"
name="Virtual Content"
priority="high">
<triggerPoints>
<instanceof
value="org.eclipse.core.resources.IResource">
</instanceof>
</triggerPoints>
<possibleChildren>
<or>
<instanceof
value="com.myexample.xyz.namespaceexplorer.model.TreeEzProject">
</instanceof>
<instanceof
value="com.myexample.xyz.namespaceexplorer.model.TreeEzNamespace">
</instanceof>
<instanceof
value="com.myexample.xyz.namespaceexplorer.model.TreeEzFile">
</instanceof>
</or>
</possibleChildren>
<commonSorter
class="com.myexample.xyz.namespaceexplorer.views.ViewNameSorter">
</commonSorter>
</navigatorContent>
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"
locationURI="popup:com.myexample.xyz.namespaceexplorer?before=additions">
<command
commandId="org.eclipse.ui.edit.copy"
label="Copy"
style="push">
</command>
<command
commandId="org.eclipse.ui.edit.paste"
label="Paste"
style="push">
</command>
<command
commandId="org.eclipse.ui.edit.delete"
label="Delete"
style="push">
</command>
<separator
name="com.myexample.xyz.namespaceexplorer.separator1">
</separator>
<menu
label="Refactor">
<command
commandId="org.eclipse.ui.edit.rename"
label="Rename"
style="push">
</command>
</menu>
<separator
name="com.myexample.xyz.namespaceexplorer.separator2">
</separator>
</menuContribution>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
class=""
commandId="org.eclipse.ui.edit.delete">
</handler>
</extension>
</plugin>
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02414 seconds