Hi. I started migrating my app to Luna and encountered this issue.
The app may create Parts from PartDescriptors at startup and i subscribed to APP_STARTUP_COMPLETE event for that purpose. It worked fine in Kepler.
@Inject
@Optional
private void open(
@Named("__DUMMY__") // workaround bug 378694
@EventTopic(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE)
final MApplication app,
final EModelService model,
final EPartService partService,
UISynchronize sync
) {
// ...
sync.asyncExec(new Runnable() {
@Override
public void run() {
// ...
MPart newPart = partService.createPart("descrId");
((MPartStack) model.find("stackId", app)).getChildren().add(newPart);
partService.showPart(newPart, PartState.CREATE);
}
});
}
In Luna M6 though it throws an exception "Application does not have an active window"
!ENTRY org.eclipse.e4.ui.workbench 4 0 2014-05-05 14:02:57.065
!MESSAGE Internal Error
!STACK 0
org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.IllegalStateException: Application does not have an active window)
at org.eclipse.swt.SWT.error(SWT.java:4441)
at org.eclipse.swt.SWT.error(SWT.java:4356)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:139)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3748)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3396)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1122)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1006)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:147)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:166)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:133)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:103)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:378)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:232)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1462)
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Caused by: java.lang.IllegalStateException: Application does not have an active window
at org.eclipse.e4.ui.internal.workbench.ApplicationPartServiceImpl.getActiveWindowService(ApplicationPartServiceImpl.java:36)
at org.eclipse.e4.ui.internal.workbench.ApplicationPartServiceImpl.createPart(ApplicationPartServiceImpl.java:95)
<...>
at myapp.AddonOpen$1.run(AddonOpen.java:59)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)
... 20 more
Is this a bug or is my way of using this event incorrect?