Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2019-01-07 14:19:18 +0000
committerAndrey Loskutov2019-01-07 14:19:18 +0000
commit90ea9219418dbf1befe7e56df63dec46c72ebf51 (patch)
treea87480201ce33ae72b81294fadc1747ce46eab1a
parent0009cbec56ad0dd581e0ed25ec9352e8b77ad2ae (diff)
downloadeclipse.platform-90ea9219418dbf1befe7e56df63dec46c72ebf51.tar.gz
eclipse.platform-90ea9219418dbf1befe7e56df63dec46c72ebf51.tar.xz
eclipse.platform-90ea9219418dbf1befe7e56df63dec46c72ebf51.zip
getSite().getShell() is discouraged way to retrieve a Shell instance, and check if the shell is disposed is wrong anyway for an editor which can be closed but the shell is still there. Added "disposed" flag and changed the checks accordingly to check if *editor* is disposed. Change-Id: I7bd015e5bfca1cfdeb76bf23784c2fd6a8efd666 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r--ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/AntEditor.java27
-rw-r--r--ant/org.eclipse.ant.ui/META-INF/MANIFEST.MF2
-rw-r--r--ant/org.eclipse.ant.ui/pom.xml2
3 files changed, 16 insertions, 15 deletions
diff --git a/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/AntEditor.java b/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/AntEditor.java
index 687310d1a..a0dc2771d 100644
--- a/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/AntEditor.java
+++ b/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/AntEditor.java
@@ -110,6 +110,7 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.editors.text.TextEditor;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.part.IShowInTargetList;
@@ -504,6 +505,8 @@ public class AntEditor extends TextEditor implements IReconcilingParticipant, IP
private AntModel fAntModel;
+ private boolean disposed;
+
/**
* Default no-argument constructor
*/
@@ -1045,6 +1048,7 @@ public class AntEditor extends TextEditor implements IReconcilingParticipant, IP
*/
@Override
public void dispose() {
+ disposed = true;
if (fEditorSelectionChangedListener != null) {
fEditorSelectionChangedListener.uninstall(getSelectionProvider());
fEditorSelectionChangedListener = null;
@@ -1072,11 +1076,10 @@ public class AntEditor extends TextEditor implements IReconcilingParticipant, IP
super.dispose();
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.ISaveablePart#doSave(org.eclipse.core.runtime.IProgressMonitor)
- */
+ public boolean isDisposed() {
+ return disposed;
+ }
+
@Override
public void doSave(IProgressMonitor monitor) {
super.doSave(monitor);
@@ -1141,10 +1144,9 @@ public class AntEditor extends TextEditor implements IReconcilingParticipant, IP
}
private void postImageChange(final AntElementNode node) {
- Shell shell = getSite().getShell();
- if (shell != null && !shell.isDisposed()) {
- shell.getDisplay().asyncExec(() -> {
- if (getSite().getShell() == null || getSite().getShell().isDisposed()) {
+ if (!isDisposed()) {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(() -> {
+ if (isDisposed()) {
return;
}
Image titleImage = getTitleImage();
@@ -1223,10 +1225,9 @@ public class AntEditor extends TextEditor implements IReconcilingParticipant, IP
}
}
- Shell shell = getSite().getShell();
- if (shell != null && !shell.isDisposed()) {
- shell.getDisplay().asyncExec(() -> {
- if (getSite().getShell() == null || getSite().getShell().isDisposed()) {
+ if (!isDisposed()) {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(() -> {
+ if (isDisposed()) {
return;
}
synchronize(true);
diff --git a/ant/org.eclipse.ant.ui/META-INF/MANIFEST.MF b/ant/org.eclipse.ant.ui/META-INF/MANIFEST.MF
index a49661435..97345ef7f 100644
--- a/ant/org.eclipse.ant.ui/META-INF/MANIFEST.MF
+++ b/ant/org.eclipse.ant.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.ant.ui; singleton:=true
-Bundle-Version: 3.7.300.qualifier
+Bundle-Version: 3.7.400.qualifier
Bundle-Activator: org.eclipse.ant.internal.ui.AntUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/ant/org.eclipse.ant.ui/pom.xml b/ant/org.eclipse.ant.ui/pom.xml
index a13a4359f..838e10548 100644
--- a/ant/org.eclipse.ant.ui/pom.xml
+++ b/ant/org.eclipse.ant.ui/pom.xml
@@ -19,7 +19,7 @@
</parent>
<groupId>org.eclipse.ant</groupId>
<artifactId>org.eclipse.ant.ui</artifactId>
- <version>3.7.300-SNAPSHOT</version>
+ <version>3.7.400-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
<defaultSigning-excludeInnerJars>true</defaultSigning-excludeInnerJars>

Back to the top