Launching an editor without a file - openEditor() [message #173809] |
Mon, 28 March 2005 10:40  |
Eclipse User |
|
|
|
Originally posted by: Angel.Roman.prismtech.com
Hi All,
I've read several excellent posts explaining how to open an editor
programatically. However, the posts that I've encountered do not explain
how to create an IEditorInput instance for a file. Furthermore, I am
interested in just creating an IEditorInput that would contain the model
that I would like to edit on the editor. This is all based on double
clicking on a figure on my GEF editor and launching another GEF Editor
that would modify the model passed to it via the IEditorInput. In
summary, can someone explain the process of the inserting my model
instance in an IEditorInput. Is there away to launch an editor without a
file or am I forced to create a dummy file?
Regards,
Angel Roman
|
|
|
|
|
Re: Launching an editor without a file - openEditor() [message #173860 is a reply to message #173815] |
Mon, 28 March 2005 14:23  |
Eclipse User |
|
|
|
Originally posted by: Lamont_Gilbert.rigidsoftware.com
Angel Roman wrote:
> Angel Roman wrote:
>
>> Hi All,
>>
>> I've read several excellent posts explaining how to open an editor
>> programatically. However, the posts that I've encountered do not
>> explain how to create an IEditorInput instance for a file.
>> Furthermore, I am interested in just creating an IEditorInput that
>> would contain the model that I would like to edit on the editor. This
>> is all based on double clicking on a figure on my GEF editor and
>> launching another GEF Editor that would modify the model passed to it
>> via the IEditorInput. In summary, can someone explain the process of
>> the inserting my model instance in an IEditorInput. Is there away to
>> launch an editor without a file or am I forced to create a dummy file?
>>
>> Regards,
>> Angel Roman
>
>
> So far I created an IModelEditorInput which extends the IEditorInput
> interface and adds a getModel() method. Then I created a class
> ModelEditorInput that implements IModelEditorInput which returns the
> model (Object) that I want to pass to the new Editor. Any comments on
> this approach?
>
> Regards,
> Angel
Now inside your editor you need to see what type of IEditorInput you
have received. If its the IModelEditorInput, then cast to it and take
out the model and insert it into your editor so your editor can use it.
Also what I do is add a part listner to my editor and when the editor is
opened or shown, if there is no model, i close it.
CL
|
|
|
Powered by
FUDForum. Page generated in 0.22213 seconds