Open new Editor from Selected Figure [message #169552] |
Thu, 24 February 2005 07:11  |
Eclipse User |
|
|
|
Originally posted by: a.morgan.pilz.ie
Hey,
I have added a Figure (Composite) to my Editor that contains other figures
and whose purpose is to group figures together.
When I add these Figures to my Composite they reduce in size so that more
can be fit in.
If I then remove them from the the Composite they return to normal size for
easy editing
What I would like to do is be able to open another editor from the
Composite.
So for example say the Composite contains 3 figures. If I then double-click
on it I want to open a new Editor which then shows these three figures at
normal size for editing purposes.
Anybody done this already or have ideas on how this can be done ?
Thanks,
Alan.
|
|
|
|
|
|
|
|
|
|
|
|
Re: Open new Editor from Selected Figure [message #170130 is a reply to message #170091] |
Tue, 01 March 2005 13:21   |
Eclipse User |
|
|
|
Originally posted by: Lamont_Gilbert.rigidsoftware.com
Alan Morgan wrote:
> Thanks Fabian, that worked.
>
> Now I've got one more (and hopefully last) question on this topic.
> I was using an empty IEditorInput object up until now just to prove I could
> launch another Editor using double-click.
>
> What I want to be able to do is take the information contained within the
> Composite figure that I am double-clicking on and pass this to the new
> editor.
> In other words the Composite I double click on contains e.g. three
> figures,at a given size, location and possibly with connections bewteen each
> other.
> I want the new editor to display everything that was in this Composite
> figure.
> How do I go about doing this ?
>
> Thanks,
> Alan.
>
>
>
you should not be passing around or manipulating Composites or Figures.
You should be manipulating your models. The IEditorInput should
contain a light weight pointer to your model. It should not contain
the model itself. But to get you going quickly, you can just stuff the
model right into the IEditorInput based class you create.
In your editor, in the setEditorInput method or whatever its called, you
check with instanceof to see if its your type of IEditorInput and if so
you use it.
but again, a figure is just a way to show yoru model, but you should be
passing around and manipulating the model only.
CL
|
|
|
Re: Open new Editor from Selected Figure [message #170160 is a reply to message #170130] |
Wed, 02 March 2005 05:05   |
Eclipse User |
|
|
|
Originally posted by: a.morgan.pilz.ie
CL,
Thanks for the advice. I created an instance of IEditorInput and had it hold
an instance of my model.
In the setEditorInput method of my new Editor I take this model and load the
parts of it I need into the new editor.
Not sure if this is how I should be doing it but I guess it'll do for the
time being.
Not quite sure what you are referring to when you speak about IEditorInput
containing a light weight pointer to my model.
Anyway I now have a new editor which displays the contents of my Composite.
What I was hoping to do now was to have changes that I make reflected back
in the original editor.
So if I add and a new Figure in my new Editor this should appear in the
Composite figure in the original editor on save.
This means that I somehow need to be able to update the original Model from
my new Editor.
Not sure how to approach this...would I be better off using a Multipage
Editor here or can I manage this another way ?
Thanks again,
Alan.
"CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> wrote in message
news:d02bql$46g$1@www.eclipse.org...
> Alan Morgan wrote:
> > Thanks Fabian, that worked.
> >
> > Now I've got one more (and hopefully last) question on this topic.
> > I was using an empty IEditorInput object up until now just to prove I
could
> > launch another Editor using double-click.
> >
> > What I want to be able to do is take the information contained within
the
> > Composite figure that I am double-clicking on and pass this to the new
> > editor.
> > In other words the Composite I double click on contains e.g. three
> > figures,at a given size, location and possibly with connections bewteen
each
> > other.
> > I want the new editor to display everything that was in this Composite
> > figure.
> > How do I go about doing this ?
> >
> > Thanks,
> > Alan.
> >
> >
> >
>
> you should not be passing around or manipulating Composites or Figures.
> You should be manipulating your models. The IEditorInput should
> contain a light weight pointer to your model. It should not contain
> the model itself. But to get you going quickly, you can just stuff the
> model right into the IEditorInput based class you create.
>
> In your editor, in the setEditorInput method or whatever its called, you
> check with instanceof to see if its your type of IEditorInput and if so
> you use it.
>
> but again, a figure is just a way to show yoru model, but you should be
> passing around and manipulating the model only.
>
>
> CL
|
|
|
|
|
|
|
Re: Open new Editor from Selected Figure [message #170936 is a reply to message #170123] |
Tue, 08 March 2005 00:25  |
Eclipse User |
|
|
|
When the workbench is launched, the active page is null until after any open
editors have been created. I believe there's a bug open regarding this.
"CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> wrote in message
news:d02bgh$1vp$1@www.eclipse.org...
> Fabian Wolf wrote:
> > CL [dnoyeb] Gilbert wrote:
> >
> >
> >>Fabian Wolf wrote:
> >>
> >>>PlatformUI.getWorkbench().getActiveWorkbenchWindow()
> >>>.getActivePage().openEditor(IEditorInput, Editor.ID);
> >>>
> >>>Alan Morgan wrote:
> >>>
> >>>
> >>>
> >>>>Thanks for the help CL.
> >>>>I've added the check for REQ_OPEN in my performRequest method and I've
> >>>>created a new IEditorInput.
> >>>>But I'm stuck when it comes to the call to openEditor().
> >>>>This method is not static and so I need a instance of IWorkbenchPage.
> >>>>Maybe I'm missing something obvious but I can't see where I can get
this.
> >>>>
> >>>>Any thoughts ?
> >>>>[...]
> >>
> >>be sure to check if getActivePage returns null. It shouldn't but i
> >>think its possible. Maybe just an assert, but perhaps who needs an
> >>assert on something that will throw an NPE right away.
> >
> >
> > Wasn't he trying to open the new editor from an existing one? If
> > getActivePage returns null there, you might be having more trouble than
a
> > NPE ;)
>
> I think thats a safe assumption. I kind of feel that way. But
> technically he is opening his editor from an 'editpart' not an editor.
> And you can assume if there is an edit part there must be an editor.
> But I don't know what happens if an app is minimized, or if windows can
> be hidden or anything. So i just checked for it. getActivePage just
> says it may return null, but it does not say under what conditions there
> can be no active page. And I have not had the energy to look.
>
> CL
|
|
|
Powered by
FUDForum. Page generated in 0.55510 seconds