Trigger opening a custom editor (not for files) [message #304073] |
Tue, 30 May 2006 07:00  |
Eclipse User |
|
|
|
Hi all,
I am developing a plug-in, in which I have a treeview and an editor.
All the examples I have seen so far show how to register an editor so it
will be used to edit a file in the file system.
The scenario I would like to accomplish is that when the user double clicks
on a tree node (in a custom tree I have developed which is in a view) the
editor will open and present information which is saved in a database. For
that reason, I don't have files in the file system that extensions according
to which the editor will open.
How can I open a custom editor from within a custom view?
What are the mechanisms I should use?
Thanks in advance,
Asaf
|
|
|
|
Re: Trigger opening a custom editor (not for files) [message #304078 is a reply to message #304073] |
Tue, 30 May 2006 07:35   |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
This is a multi-part message in MIME format.
--------------070004030706010805080100
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Asaf,
Code like this can be used to open a the default editor on an IFile:
IWorkbenchPage page = workbenchWindow.getActivePage();
page.openEditor
(new FileEditorInput(modelFile),
workbench.getEditorRegistry().getDefaultEditor(modelFile.get FullPath().toString()).getId());
If you design your own subclass of IEditorInput and you know the ID of
the editor you want to open (which will know how to handle your
specialized IEditorInput), you can use this same approach.
Asaf Lahav wrote:
> Hi all,
>
> I am developing a plug-in, in which I have a treeview and an editor.
> All the examples I have seen so far show how to register an editor so it
> will be used to edit a file in the file system.
>
> The scenario I would like to accomplish is that when the user double clicks
> on a tree node (in a custom tree I have developed which is in a view) the
> editor will open and present information which is saved in a database. For
> that reason, I don't have files in the file system that extensions according
> to which the editor will open.
>
> How can I open a custom editor from within a custom view?
> What are the mechanisms I should use?
>
> Thanks in advance,
> Asaf
>
>
>
--------------070004030706010805080100
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Asaf,<br>
<br>
Code like this can be used to open a the default editor on an IFile:<br>
<blockquote>IWorkbenchPage page = workbenchWindow.getActivePage();<br>
page.openEditor<br>
(new FileEditorInput(modelFile),<br>
workbench.getEditorRegistry().getDefaultEditor(modelFile.get FullPath().toString()).getId()); <br>
</blockquote>
If you design your own subclass of IEditorInput and you know the ID of
the editor you want to open (which will know how to handle your
specialized IEditorInput), you can use this same approach.<br>
<br>
<br>
Asaf Lahav wrote:
<blockquote cite="mide5h566$33s$1@utils.eclipse.org" type="cite">
<pre wrap="">Hi all,
I am developing a plug-in, in which I have a treeview and an editor.
All the examples I have seen so far show how to register an editor so it
will be used to edit a file in the file system.
The scenario I would like to accomplish is that when the user double clicks
on a tree node (in a custom tree I have developed which is in a view) the
editor will open and present information which is saved in a database. For
that reason, I don't have files in the file system that extensions according
to which the editor will open.
How can I open a custom editor from within a custom view?
What are the mechanisms I should use?
Thanks in advance,
Asaf
</pre>
</blockquote>
<br>
</body>
</html>
--------------070004030706010805080100--
|
|
|
|
Powered by
FUDForum. Page generated in 1.69986 seconds