diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp
index 32a786e05008757a03963fed954aa9d5d68d14ac..4b12f1deeaccf2ece10357190fe2bebc217a703b 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.cpp
+++ b/src/plugins/coreplugin/editormanager/editormanager.cpp
@@ -1146,10 +1146,12 @@ IEditor *EditorManager::openEditor(Core::Internal::EditorView *view, const QStri
         return 0;
     }
     addEditor(editor);
-    restoreEditorState(editor);
-    QApplication::restoreOverrideCursor();
 
-    return activateEditor(view, editor, flags);
+    IEditor *result= activateEditor(view, editor, flags);
+    if (editor == result)
+        restoreEditorState(editor);
+    QApplication::restoreOverrideCursor();
+    return result;
 }
 
 bool EditorManager::openExternalEditor(const QString &fileName, const QString &editorKind)