Skip to main content



      Home
Home » Eclipse Projects » GEF » Launching an editor without a file - openEditor()
Launching an editor without a file - openEditor() [message #173809] Mon, 28 March 2005 10:40 Go to next message
Eclipse UserFriend
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 #173815 is a reply to message #173809] Mon, 28 March 2005 11:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Angel.Roman.prismtech.com

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
Re: Launching an editor without a file - openEditor() [message #173844 is a reply to message #173815] Mon, 28 March 2005 13:31 Go to previous messageGo to next message
Eclipse UserFriend
Sounds good. That is the proper approach, I believe.

BTW, this is not really GEF-related.


"Angel Roman" <Angel.Roman@prismtech.com> wrote in message
news:d29eu7$a7i$1@news.eclipse.org...
> 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
Re: Launching an editor without a file - openEditor() [message #173860 is a reply to message #173815] Mon, 28 March 2005 14:23 Go to previous message
Eclipse UserFriend
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
Previous Topic:Creating view by extending ViewPart
Next Topic:Extending EditDomain or EditPartViewer to Store Custom Information
Goto Forum:
  


Current Time: Tue Jul 15 05:22:54 EDT 2025

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

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

Back to the top