|
Re: How to init an editor (via Memento) programatically? [message #453363 is a reply to message #453344] |
Thu, 27 July 2006 14:13 |
Eclipse User |
|
|
|
Originally posted by: lamont_gilbert.rigidsoftware.com
Eric wrote:
> I have two plugins in my app: A and B. I start my app and open plugin
> A, which gives me an editor. I do the same for B, giving me B's
> editor. The focus is on editor B. I then exit the app via the "X"
> window button, and restart the app. It comes up having loaded editor B
> and shows everything right where I left off. Great.
>
> However, editor B requires that editor A is loaded and initialized, and
> Eclipse hasn't yet loaded A. If I select/focus on editor A it loads its
> eclipse memento and initializes. If I then reselect editor B, all is
> well.
>
> Question: is there any programmatic way to tell eclipse from within
> editor B that it should load editor A and initialize it with A's memento
> as if I'd manually selected it?
>
> I'm using Eclipse 3.1.2.
Im not clear on if editor A was opened automatically as well? If it was
then the memento should be there. using the memento is typically your own
responsibility. When do you process your memento?
--
Respectfully,
CL Gilbert
"Verily, verily, I say unto you, He that entereth not by the door() into the
sheepfold{}, but climbeth up some other *way, the same is a thief and a
robber."
|
|
|
|
Re: How to init an editor (via Memento) programatically? [message #453373 is a reply to message #453344] |
Thu, 27 July 2006 18:53 |
|
Eric wrote:
> I have two plugins in my app: A and B. I start my app and open plugin
> A, which gives me an editor. I do the same for B, giving me B's
> editor. The focus is on editor B. I then exit the app via the "X"
> window button, and restart the app. It comes up having loaded editor B
> and shows everything right where I left off. Great.
>
> However, editor B requires that editor A is loaded and initialized, and
> Eclipse hasn't yet loaded A. If I select/focus on editor A it loads its
> eclipse memento and initializes. If I then reselect editor B, all is well.
>
> Question: is there any programmatic way to tell eclipse from within
> editor B that it should load editor A and initialize it with A's memento
> as if I'd manually selected it?
Why would Editor B depend on Editor A? Are they both editing the same
resource (i.e. data model)?
Eclipse will help you if you need 2 editors to edit one datamodel, but
not so much for linking editors together. The eclipse editor lifecycle
depends on lazy editor loading ... it won't load an editor unless the
user asks for it (since if the user doesn't see it, then it serves no
purpose).
If you look at the way TextEditor works, you'll see it takes its
incoming IEditorInput and goes to an IDocumentProvider to get an
IDocument. The IDocument is the data model. If you open a second
editor on the same input, you will end up editing the same data model.
Model can be shared between editors (and views as well). For editors
and views sharing information, the most common thing they share is their
current selection, which goes through the workbench selection service.
That being said, if you find the editor reference to your editor A you
can use that to instantiate it programmatically. Check out
IWorkbenchPage for the methods available.
Later,
PW
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
|
|
|
|
Powered by
FUDForum. Page generated in 0.04445 seconds