org.eclipse.rap
org.eclipse.rap copied to clipboard
Methods annotated with @PersistState have no effect on the saved model XMI in RAP
State written through MPart.getPersistedState().putIfAbsent() is not present in the saved model file. This happens because invoction of the @PersistState annotated methods happens after the model file has been written.
This is the stack of writing the model:
E4Application.saveModel() line: 193
E4EntryPointFactory.createWorkbench() line: 85
E4EntryPointFactory$1.createUI() line: 45
RWTLifeCycle.createUI() line: 177
RWTLifeCycle$UIThreadController.run() line: 290
UIThread(Thread).run() line: 834
This is the stack of invocation of the @PersistState annotated methods:
PartRenderingEngine$3.run() line: 828
SafeRunner.run(ISafeRunnable) line: 45
PartRenderingEngine.removeGui(MUIElement) line: 813
PartRenderingEngine.safeRemoveGui(MUIElement) line: 865
PartRenderingEngine$3.run() line: 828
SafeRunner.run(ISafeRunnable) line: 45
PartRenderingEngine.removeGui(MUIElement) line: 813
PartRenderingEngine.safeRemoveGui(MUIElement) line: 858
PartRenderingEngine$3.run() line: 828
SafeRunner.run(ISafeRunnable) line: 45
PartRenderingEngine.removeGui(MUIElement) line: 813
PartRenderingEngine.safeRemoveGui(MUIElement) line: 865
PartRenderingEngine$3.run() line: 828
SafeRunner.run(ISafeRunnable) line: 45
PartRenderingEngine.removeGui(MUIElement) line: 813
PartRenderingEngine.safeRemoveGui(MUIElement) line: 865
PartRenderingEngine$3.run() line: 828
SafeRunner.run(ISafeRunnable) line: 45
PartRenderingEngine.removeGui(MUIElement) line: 813
PartRenderingEngine.safeRemoveGui(MUIElement) line: 865
PartRenderingEngine$3.run() line: 828
SafeRunner.run(ISafeRunnable) line: 45
PartRenderingEngine.removeGui(MUIElement) line: 813
PartRenderingEngine.stop() line: 1195
E4Application$1(E4Workbench).close() line: 191
E4EntryPointFactory.createWorkbench() line: 86
E4EntryPointFactory$1.createUI() line: 45
RWTLifeCycle.createUI() line: 177
RWTLifeCycle$UIThreadController.run() line: 290
UIThread(Thread).run() line: 834
If you compare the stacktraces, you will find that writing the model happens in
E4EntryPointFactory.createWorkbench() line: 85
but invocation of the @PersistState annotated methods happens afterwards, in
E4EntryPointFactory.createWorkbench() line: 86
I checked the original platform code and it looks similar to the one in RAP E4EntryPointFactory. Do I miss something? Is it possible to point us to the code that differ between RAP and RCP?
For non-RAP I found the following:
This is the stack of invocation of the @PersistState annotated methods:
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 77
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
Method.invoke(Object, Object...) line: 568
MethodRequestor.execute() line: 58
InjectorImpl.invokeUsingClass(Object, Class<?>, Class<Annotation>, Object, PrimaryObjectSupplier, PrimaryObjectSupplier, boolean, boolean, boolean) line: 317
InjectorImpl.invoke(Object, Class<Annotation>, Object, PrimaryObjectSupplier) line: 245
ContextInjectionFactory.invoke(Object, Class<Annotation>, IEclipseContext, Object) line: 147
PartRenderingEngine.safeRemoveGui(MUIElement) line: 928
PartRenderingEngine$4.run() line: 860
SafeRunner.run(ISafeRunnable) line: 45
PartRenderingEngine.removeGui(MUIElement) line: 844
PartRenderingEngine.safeRemoveGui(MUIElement) line: 892
PartRenderingEngine$4.run() line: 860
SafeRunner.run(ISafeRunnable) line: 45
PartRenderingEngine.removeGui(MUIElement) line: 844
PartRenderingEngine.safeRemoveGui(MUIElement) line: 892
PartRenderingEngine$4.run() line: 860
SafeRunner.run(ISafeRunnable) line: 45
PartRenderingEngine.removeGui(MUIElement) line: 844
WBWRenderer.cleanUp(MWindow) line: 631
WBWRenderer.lambda$4(ShellEvent) line: 571
0x0000000800edaad8.accept(Object) line: not available
ShellListener$2.shellClosed(ShellEvent) line: 102
TypedListener.handleEvent(Event) line: 102
EventTable.sendEvent(Event) line: 89
Display.sendEvent(EventTable, Event) line: 4243
Shell(Widget).sendEvent(Event) line: 1060
Shell(Widget).sendEvent(int, Event, boolean) line: 1084
Shell(Widget).sendEvent(int, Event) line: 1069
Shell(Decorations).closeWidget() line: 269
Shell(Decorations).WM_CLOSE(long, long) line: 1552
Shell(Control).windowProc(long, int, long, long) line: 4755
Shell(Canvas).windowProc(long, int, long, long) line: 340
Shell(Decorations).windowProc(long, int, long, long) line: 1480
Shell.windowProc(long, int, long, long) line: 2286
Display.windowProc(long, long, long, long) line: 5002
OS.DefWindowProc(long, int, long, long) line: not available [native method]
Shell.callWindowProc(long, int, long, long) line: 508
Shell(Control).windowProc(long, int, long, long) line: 4854
Shell(Canvas).windowProc(long, int, long, long) line: 340
Shell(Decorations).windowProc(long, int, long, long) line: 1480
Shell.windowProc(long, int, long, long) line: 2286
Display.windowProc(long, long, long, long) line: 5002
OS.DefWindowProc(long, int, long, long) line: not available [native method]
Shell.callWindowProc(long, int, long, long) line: 508
Shell(Control).windowProc(long, int, long, long) line: 4854
Shell(Canvas).windowProc(long, int, long, long) line: 340
Shell(Decorations).windowProc(long, int, long, long) line: 1480
Shell.windowProc(long, int, long, long) line: 2286
Display.windowProc(long, long, long, long) line: 5002
OS.DispatchMessage(MSG) line: not available [native method]
Display.readAndDispatch() line: 3630
PartRenderingEngine$5.run() line: 1154
Realm.runWithDefault(Realm, Runnable) line: 338
PartRenderingEngine.run(MApplicationElement, IEclipseContext) line: 1045
E4Workbench.createAndRunUI(MApplicationElement) line: 155
E4Application.start(IApplicationContext) line: 168
EclipseAppHandle.run(Object) line: 203
This is the stack of writing the model:
E4Application.start(IApplicationContext) line: 170
EclipseAppHandle.run(Object) line: 203
In the code snippet of E4Application.start() you see
workbench.createAndRunUI(workbench.getApplication()); <-- calls @PersistState annotated methods
saveModel(); <-- persists the model
workbench.close();
Do you have a suggestion how to fix it? A pull request will be welcomed.
Sorry, no idea. My knowledge of the codebase is very limited.