Link a custom EditorInput to a resource type [message #539085] |
Wed, 09 June 2010 15:25 |
Guillaume P. Messages: 69 Registered: June 2010 Location: Toulouse, France |
Member |
|
|
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 08:04] Report message to a moderator
|
|
|
Re: Link another type of EditorInput to some resources [message #539294 is a reply to message #539085] |
Thu, 10 June 2010 09:46 |
|
On 6/9/2010 11:25 AM, pelouas@gmail.com wrote:
> 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.
Perhaps you should review what that information is and whether it really
needs to be in the editor input object.
--
Nitin Dahyabhai
Eclipse WTP Source Editing and JSDT
IBM Rational
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03306 seconds