Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Zarna2010-11-30 11:33:06 -0500
committerTomasz Zarna2010-11-30 11:33:06 -0500
commitf93a2c679e74e704ddebb968cb65f99193bddcc6 (patch)
tree40a73ecf642f83f2930ce98bc0c0e13dc0cc6603
parent503b202f6809c77bff9ae0000b4b06d798ffa531 (diff)
downloadeclipse.platform.team-f93a2c679e74e704ddebb968cb65f99193bddcc6.tar.gz
eclipse.platform.team-f93a2c679e74e704ddebb968cb65f99193bddcc6.tar.xz
eclipse.platform.team-f93a2c679e74e704ddebb968cb65f99193bddcc6.zip
bug 324965: [Edit] Close Compare Editor when cancelled during initialization stage
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java12
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.properties2
2 files changed, 10 insertions, 4 deletions
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
index 1ebda9847..f3fbc5261 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
@@ -342,7 +342,7 @@ public class CompareEditor extends EditorPart implements IReusableEditor, ISavea
protected void initializeInBackground(final CompareEditorInput cei, final boolean hadPreviousInput) {
// Need to cancel any running jobs associated with the oldInput
- Job job = new Job(CompareMessages.CompareEditor_0) {
+ Job job = new Job(NLS.bind(CompareMessages.CompareEditor_0, cei.getTitle())) {
protected IStatus run(final IProgressMonitor monitor) {
final int[] newState = new int[] { ERROR };
try {
@@ -366,11 +366,11 @@ public class CompareEditor extends EditorPart implements IReusableEditor, ISavea
newState[0] = CANCELED;
Display.getDefault().syncExec(new Runnable() {
public void run() {
+ if (fPageBook.isDisposed())
+ return;
// we need to register the saveable if we had a previous input or if
// there are knownSaveables (which means that the workbench called
// getSaveables and got an empty list
- if (monitor.isCanceled() || fPageBook.isDisposed())
- return;
if (hadPreviousInput || (knownSaveables != null && !isAllSaveablesKnown())) {
registerSaveable();
}
@@ -448,6 +448,12 @@ public class CompareEditor extends EditorPart implements IReusableEditor, ISavea
closeEditor();
}
} else if (fControl == null && getState() != CREATING_CONTROL) {
+ if (getState() == CANCELED) {
+ // Close the editor when we are canceled, even when compare
+ // result has been already prepared
+ closeEditor();
+ return;
+ }
// Set the state in case this method gets called again
setState(CREATING_CONTROL);
if (getSite().getSelectionProvider() == null)
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.properties b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.properties
index 16f3c6ac4..451ac3bb6 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.properties
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.properties
@@ -98,7 +98,7 @@ NavigationEndDialog_1=Navigation Options
CompareUIPlugin_0=Opening Compare Editor
CompareUIPlugin_1=Opening Compare Dialog
CompareContainer_0=Updating Comparison State
-CompareEditor_0=Initializing Compare Editor
+CompareEditor_0=Initializing Compare Editor for {0}
CompareEditor_1=Initializing...
CompareEditor_2=Update comparison {0}
DocumentMerger_0=Computing Differences...

Back to the top