Bug 563386 - UISynchronize: Add disposal check
This aligns the implementation to the one used in
E4Application#createE4Workbench.
Change-Id: I48c013f4825f2ed97f3f881ff1fb4e1fe9d71c86
Signed-off-by: Karsten Thoms <karsten.thoms@karakun.com>
diff --git a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF
index 5e96976..8d2ebf8 100644
--- a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.e4.tools.compat;singleton:=true
-Bundle-Version: 4.7.600.qualifier
+Bundle-Version: 4.7.700.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.ui;bundle-version="3.6.0",
org.eclipse.core.runtime;bundle-version="3.6.0",
diff --git a/bundles/org.eclipse.e4.tools.compat/pom.xml b/bundles/org.eclipse.e4.tools.compat/pom.xml
index 7a8649b..9f463e2 100644
--- a/bundles/org.eclipse.e4.tools.compat/pom.xml
+++ b/bundles/org.eclipse.e4.tools.compat/pom.xml
@@ -10,7 +10,7 @@
<groupId>eclipse.platform.ui.tools</groupId>
<artifactId>org.eclipse.e4.tools.compat</artifactId>
- <version>4.7.600-SNAPSHOT</version>
+ <version>4.7.700-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java
index 8594181..525a700 100644
--- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java
+++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java
@@ -45,7 +45,7 @@
@Override
public Object create(Class serviceInterface, IServiceLocator parentLocator,
- IServiceLocator locator) {
+ IServiceLocator locator) {
if (!IEclipseContext.class.equals(serviceInterface)) {
return null;
}
@@ -70,17 +70,21 @@
appContext.set(IClipboardService.class, new ClipboardServiceImpl());
appContext.set(Realm.class, Realm.getDefault());
- final Display d = Display.getCurrent();
+ final Display display = Display.getCurrent();
appContext.set(UISynchronize.class, new UISynchronize() {
@Override
public void syncExec(Runnable runnable) {
- d.syncExec(runnable);
+ if (display != null && !display.isDisposed()) {
+ display.syncExec(runnable);
+ }
}
@Override
public void asyncExec(Runnable runnable) {
- d.asyncExec(runnable);
+ if (display != null && !display.isDisposed()) {
+ display.asyncExec(runnable);
+ }
}
});
@@ -114,7 +118,7 @@
@Override
public void setClassnameAndId(Object widget, String classname,
- String id) {
+ String id) {
((Widget) widget).setData("org.eclipse.e4.ui.css.CssClassName", classname); //$NON-NLS-1$
((Widget) widget).setData("org.eclipse.e4.ui.css.id", id); //$NON-NLS-1$
engine.applyStyles(widget, true);
@@ -123,7 +127,7 @@
if (appContext.get(ILoggerProvider.class) == null) {
appContext.set(ILoggerProvider.class,
- ContextInjectionFactory.make(DefaultLoggerProvider.class, appContext));
+ ContextInjectionFactory.make(DefaultLoggerProvider.class, appContext));
}
return appContext;