Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to init an editor (via Memento) programatically?
How to init an editor (via Memento) programatically? [message #453344] Wed, 26 July 2006 23:05 Go to next message
Eric is currently offline EricFriend
Messages: 77
Registered: July 2009
Member
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.
Re: How to init an editor (via Memento) programatically? [message #453363 is a reply to message #453344] Thu, 27 July 2006 14:13 Go to previous messageGo to next message
Eclipse UserFriend
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 #453365 is a reply to message #453363] Thu, 27 July 2006 14:50 Go to previous messageGo to next message
Eric is currently offline EricFriend
Messages: 77
Registered: July 2009
Member
Before exiting, both A and B were open, with B having the focus.
When I restart the app, B automatically gets focus and A apparently
doesn't load (although it shows the A editor tab). Eclipse won't load
it for real (it's lazy) until I select the A editor tab, at which point
Eclipse instantiates it for real and sends it the proper memento.

I process the memento in the EditorPart.init(IEditorSite, IEditorInput)
method of each editor.
-Eric

CL [dnoyeb] Gilbert wrote:
> 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?
>
>
Re: How to init an editor (via Memento) programatically? [message #453373 is a reply to message #453344] Thu, 27 July 2006 18:53 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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


Re: How to init an editor (via Memento) programatically? [message #453560 is a reply to message #453344] Wed, 02 August 2006 15:17 Go to previous message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
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?

see https://bugs.eclipse.org/bugs/show_bug.cgi?id=44295

Dani

>
> I'm using Eclipse 3.1.2.
Previous Topic:Third party jars needing java.class.path in RCP application
Next Topic:IFile in RCP application
Goto Forum:
  


Current Time: Sun Oct 06 23:12:47 GMT 2024

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

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

Back to the top