Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Eclipse RCP: e3 editor in e4: "createPartProperties" never called(How to save and read user properties of editors in e4?)
icon9.gif  Eclipse RCP: e3 editor in e4: "createPartProperties" never called [message #1436140] Thu, 02 October 2014 13:15 Go to next message
Jean-François Marchant is currently offline Jean-François MarchantFriend
Messages: 3
Registered: October 2014
Junior Member
Hello,

It is my first post into this forum, so excuse me if I do not respect some common rules...

We have developed in e3 several editors. Now, we are migrating to e4 and the editors are working almost correctly.
The behaviour in e3 was:
- when we exit the RCP, the opened editors are closed and their (user-defined) properties are saved by calls to "Map getPartProperties"
- when the RCP restarts, the editors are reopened and their properties are restored by calls to "setPartProperty(String key, String value)"

The observed behaviour in e4 is: only the save on exit occurs!

In e3 and e4, "setPartProperty" is called by "WorkbenchPartReference.createPartProperties(...)". Ok that is fine but the problem is that this last method is called in e3 by "EditorReference.createPartHelper" and is never called in e4 Sad

My question is: how can I restore my saved properties? Any ideas?

Thanks!

JF

PS: my editor(s) are still in plug-ins that have not yet been migrated to e4. In the main plug-in, I use a file "MyLegacyIDE.e4xmi" file and an extension point referring a ".product" file (As in point 4.2 of "Eclipse4MigrationGuide" tutorial of Lars Vogel )
Re: Eclipse RCP: e3 editor in e4: "createPartProperties" never called [message #1445346 is a reply to message #1436140] Wed, 15 October 2014 10:09 Go to previous messageGo to next message
Jean-François Marchant is currently offline Jean-François MarchantFriend
Messages: 3
Registered: October 2014
Junior Member
Without any answer, I searched a way to avoid this problem.
I still have not yet found a solution but here are some additional informations:
- With the debugger, I saw that following code of WorkbenchPage is executed:
MPart editor = partService.createPart(CompatibilityEditor.MODEL_ELEMENT_ID);
editor.getTags().add(editorId);
EditorReference ref = createEditorReferenceForPart(editor, input, editorId, editorState);
partService.showPart(editor, PartState.VISIBLE);

So a CompatiblityEditor instance is created but that class does not implement IPersistableEditor; that is sad because it it was the case maybe the use of IMemento would have been a solution?
Re: Eclipse RCP: e3 editor in e4: "createPartProperties" never called [message #1445349 is a reply to message #1436140] Wed, 15 October 2014 10:11 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6580
Registered: July 2009
Senior Member
Please file a bug! So that this can be fixed.

Tom

On 02.10.14 16:38, Jean-François Marchant wrote:
> Hello,
>
> It is my first post into this forum, so excuse me if I do not respect
> some common rules...
>
> We have developed in e3 several editors. Now, we are migrating to e4 and
> the editors are working almost correctly.
> The behaviour in e3 was:
> - when we exit the RCP, the opened editors are closed and their
> (user-defined) properties are saved by calls to "Map getPartProperties"
> - when the RCP restarts, the editors are reopened and their properties
> are restored by calls to "setPartProperty(String key, String value)"
>
> The observed behaviour in e4 is: only the save on exit occurs!
>
> In e3 and e4, "setPartProperty" is called by
> "WorkbenchPartReference.createPartProperties(...)". Ok that is fine but
> the problem is that this last method is called in e3 by
> "EditorReference.createPartHelper" and is never called in e4 :(
> My question is: how can I restore my saved properties? Any ideas?
>
> Thanks!
>
> JF
>
> PS: my editor(s) are still in plug-ins that have not yet been migrated
> to e4. In the main plug-in, I use a file "MyLegacyIDE.e4xmi" file and an
> extension point referring a ".product" file (As in point 4.2 of
> "Eclipse4MigrationGuide" tutorial of Lars Vogel )
Re: Eclipse RCP: e3 editor in e4: "createPartProperties" never called [message #1445428 is a reply to message #1445346] Wed, 15 October 2014 12:28 Go to previous message
Jean-François Marchant is currently offline Jean-François MarchantFriend
Messages: 3
Registered: October 2014
Junior Member
Found a solution!
My e3 editor has to implement IPersistableEditor and the properties are to be saved (resp. read) in "saveState" (resp. "restoreState") method. In summary the code inside
methods "getPartProperties" , "setPartProperty" has to be moved inside "saveState", "restoreState".
Previous Topic:How to consume/reference context functions
Next Topic:Add SWT Widgets in JfacteTableViewer
Goto Forum:
  


Current Time: Mon Jan 18 17:58:15 GMT 2021

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

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

Back to the top