Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Trigger opening a custom editor (not for files)
Trigger opening a custom editor (not for files) [message #304073] Tue, 30 May 2006 07:00 Go to next message
Eclipse UserFriend
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 #304077 is a reply to message #304073] Tue, 30 May 2006 07:31 Go to previous messageGo to next message
Eclipse UserFriend
create your own open action, and then use IWorkbenchPage#openEditor(*)
to open your editor with a custom IEditorInput (something that it can
use to retrieve the model information).

Later,
PW
Re: Trigger opening a custom editor (not for files) [message #304078 is a reply to message #304073] Tue, 30 May 2006 07:35 Go to previous messageGo to next message
Eclipse UserFriend
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>
&nbsp; (new FileEditorInput(modelFile),<br>
&nbsp;&nbsp;
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--
Re: Trigger opening a custom editor (not for files) [message #304080 is a reply to message #304073] Tue, 30 May 2006 07:45 Go to previous message
Eclipse UserFriend
Pretty old, but could still be helpful:
http://www.jroller.com/page/Zhou?entry=eclipse_editors_not_t ied_to
Previous Topic:excluding files when exporting library
Next Topic:SelectionProvider problem or TableViewer problem
Goto Forum:
  


Current Time: Fri Jul 18 04:40:57 EDT 2025

Powered by FUDForum. Page generated in 1.69986 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top