Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 8b18f0a95a9..05fe55a1ca0 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