Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2012-04-03 12:34:35 +0000
committerDani Megert2012-04-03 12:34:35 +0000
commit5719618e550ebc69298a1fbbf203d534a846a193 (patch)
tree5871307c2ff1451f1d71f1f17cda9dfd7c916ce9
parent991951ce1916a3c4a1bab80bbc2df6fd894c1316 (diff)
downloadeclipse.platform.text-5719618e550ebc69298a1fbbf203d534a846a193.tar.gz
eclipse.platform.text-5719618e550ebc69298a1fbbf203d534a846a193.tar.xz
eclipse.platform.text-5719618e550ebc69298a1fbbf203d534a846a193.zip
Fixed bug 344101: out-of-sync handling: keeping Eclipse editor contentv20120403-1234
should dirty the editor
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java
index 8b18f0a95..05fe55a1c 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java
@@ -4758,12 +4758,12 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
close(false);
}
- } else {
+ } else if (fHasBeenActivated) {
title= EditorMessages.Editor_error_activated_outofsync_title;
msg= NLSUtility.format(EditorMessages.Editor_error_activated_outofsync_message, inputName);
- if (fHasBeenActivated && MessageDialog.openQuestion(shell, title, msg)) {
+ if (MessageDialog.openQuestion(shell, title, msg)) {
try {
@@ -4781,6 +4781,15 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
ErrorDialog.openError(shell, title, msg, x.getStatus());
}
}
+ } else if (!isDirty()) {
+ // Trigger dummy change to dirty the editor, for details see https://bugs.eclipse.org/344101 .
+ try {
+ IDocument document= provider.getDocument(input);
+ if (document != null)
+ document.replace(0, 0, ""); //$NON-NLS-1$
+ } catch (BadLocationException e) {
+ // Ignore as this can't happen
+ }
}
}
}

Back to the top