我正在寻找“与编辑器链接”的解决方案,但是对于FormEditor而不是http://murygin.wordpress.com/2012/06/13/link-eclipse-view-to-editor/
中描述的ViewPart我尝试做类似的事情。但是“与编辑的联系”并没有触发任何行动。
感谢您的帮助!
答案 0 :(得分:3)
我发现我可以使用“Navigator Link Helper”:
Hier是我在plugin.xml中的代码:
<extension point="org.eclipse.ui.navigator.viewer">
...
<viewerContentBinding ...>
<includes>
<contentExtension pattern="my.ui.navigator.linkHelper.myExplorer"/>
</includes>
</viewerContentBinding>
...
</extension>
<extension point="org.eclipse.ui.navigator.linkHelper">
<linkHelper
class="my.ui.navigator.MyExplorerLinkHelper"
id="my.ui.navigator.linkHelper.myExplorer">
<selectionEnablement>
<or>
<adapt type="org.eclipse.core.resources.IProject"/>
<instanceof value="org.eclipse.core.resources.IProject"/>
</or>
</selectionEnablement>
<editorInputEnablement>
<or>
<adapt type="org.eclipse.core.resources.IProject"/>
<instanceof value="org.eclipse.core.resources.IProject"/>
</or>
</editorInputEnablement>
</linkHelper>
</extension>
我实现了这个类:
public class MyExplorerLinkHelper implements ILinkHelper {
@Override
public IStructuredSelection findSelection(IEditorInput anInput) {
...
}
@Override
public void activateEditor(IWorkbenchPage aPage, IStructuredSelection aSelection) {
...
}
}