Link a custom EditorInput to a resource type [message #539085] |
Wed, 09 June 2010 11:25  |
Eclipse User |
|
|
|
Hello,
I am currently trying to open a customized editor when the user double-click on a *.myExtension file in the package explorer (or another explorer type).
The problem is that my editor needs, during initialization, some informations which are not in the file. The solution I fund is to create a new implementation of IEditorInput interface (MyEditorInput) containing these extra informations. The system works when I create myself the MyEditorInput instance before using it with the IWorkbenchPage.openEditor(...) function.
But the problem is when the user accesses the editor via the package explorer (I've used here the org.eclipse.ui.editors extension point). Here a simple IFileEditorInput is created...
I tried to override the EditorPart.init(IEditorSite site, IEditorInput input) in order to transform the IFileEditorInput to a MyEditorInput before calling the super.init(...) with the new editor input, but it is too late.
I have also tried to use the org.eclipse.ui.navigator.LinkHelper extension point:
<extension point="org.eclipse.ui.navigator.linkHelper">
<linkHelper
class="myPlugin.workbench.editors.MyLinkHelper"
id="myPlugin.workbench.myLinkHelper">
<editorInputEnablement>
<instanceof
value="myPlugin.workbench.utils.MyFileEditorInput">
</instanceof>
</editorInputEnablement>
<selectionEnablement>
<instanceof
value="org.eclipse.core.resources.IFile">
</instanceof>
</selectionEnablement>
</linkHelper>
</extension>
with the org.eclipse.ui.navigator.viewer extension point:
<extension
point="org.eclipse.ui.navigator.viewer">
<viewerContentBinding
viewerId="org.eclipse.jdt.ui.PackageExplorer">
<includes>
<contentExtension
pattern="myPlugin.workbench.myLinkHelper">
</contentExtension></includes>
</viewerContentBinding>
</extension>
... but it does nothing (the MyLinkHelper is not used)... Moreover, this extension point seems to be specific to only one navigator view, while the file can be opened from several type of navigators views (Package explorer, Project explorer, ...)
Could someone help me, please ? :-/
[Updated on: Thu, 10 June 2010 04:04] by Moderator
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06374 seconds