にライフサイクル リスナーを登録していますplugin.xml
。を定義するだけで問題なく動作しますShell
。
例えば
@PostContextCreate
void postContextCreate(final IEventBroker eventBroker){
System.out.println("CALLED!");
final Shell shell = new Shell(SWT.TOOL | SWT.NO_TRIM);
shell.open();
eventBroker.subscribe(UIEvents.UILifeCycle.ACTIVATE, new EventHandler() {
@Override
public void handleEvent(Event event) {
System.out.println("Closing shell");
shell.close();
shell.dispose();
System.out.println("Closed");
eventBroker.unsubscribe(this);
}
});
しかし、呼び出しを変更して a も使用する場合Display
:
@PostContextCreate
void postContextCreate(final IEventBroker eventBroker){
System.out.println("CALLED!");
Display display = new Display();
final Shell shell = createSplashShell(display);
shell.open();
while (!shell.isDisposed ()) {
if (!display .readAndDispatch ()) display.sleep ();
}
display.dispose ();
//etc
次の例外が発生します。
org.eclipse.e4.core.di.InjectionException: org.eclipse.swt.SWTException: org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63) での
org.eclipseでの無効なスレッド アクセス.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:229) at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:206)
UI
この例外はスレッドで何かをしなければならないことを理解していますが、ここでどのように使用してDisplay
この例外が発生するのかわかりません。
何か助けはありますか?