From 959ba534f6a650acada06b96699aa0e79fca6319 Mon Sep 17 00:00:00 2001
From: mae <qtc-committer@nokia.com>
Date: Mon, 16 Feb 2009 18:44:04 +0100
Subject: [PATCH] show and hide the editor info bar in the correct view

---
 .../coreplugin/editormanager/editormanager.cpp | 18 ++++++++++++++----
 .../coreplugin/editormanager/editormanager.h   |  1 +
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp
index dfc52d29d40..9bef06004a0 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.cpp
+++ b/src/plugins/coreplugin/editormanager/editormanager.cpp
@@ -484,8 +484,8 @@ void EditorManager::setCurrentEditor(IEditor *editor, bool ignoreNavigationHisto
         if (addToHistory)
             addCurrentPositionToNavigationHistory(true);
 
-        EditorView *view = m_d->m_splitter->findView(editor)->view();
-        view->setCurrentEditor(editor);
+        if (SplitterOrView *splitterOrView = m_d->m_splitter->findView(editor))
+            splitterOrView->view()->setCurrentEditor(editor);
     }
     updateActions();
     updateEditorHistory();
@@ -1560,19 +1560,29 @@ void EditorManager::revertToSaved()
     currEditor->file()->modified(&temp);
 }
 
+Core::Internal::EditorView *EditorManager::currentEditorView()
+{
+    if (m_d->m_currentView)
+        return m_d->m_currentView->view();
+    if (m_d->m_currentEditor)
+        if (SplitterOrView *splitterOrView = m_d->m_splitter->findView(m_d->m_currentEditor))
+            return splitterOrView->view();
+    return m_d->m_view;
+}
 
 void EditorManager::showEditorInfoBar(const QString &kind,
                                       const QString &infoText,
                                       const QString &buttonText,
                                       QObject *object, const char *member)
 {
-    m_d->m_view->showEditorInfoBar(kind, infoText, buttonText, object, member);
+
+    currentEditorView()->showEditorInfoBar(kind, infoText, buttonText, object, member);
 }
 
 
 void EditorManager::hideEditorInfoBar(const QString &kind)
 {
-    m_d->m_view->hideEditorInfoBar(kind);
+    currentEditorView()->hideEditorInfoBar(kind);
 }
 
 QString EditorManager::externalEditorHelpText() const
diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h
index 25a05adc245..e38cc379cb1 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.h
+++ b/src/plugins/coreplugin/editormanager/editormanager.h
@@ -227,6 +227,7 @@ private:
     void closeEditor(Core::IEditor *editor);
     void closeView(Core::Internal::EditorView *view);
     void emptyView(Core::Internal::EditorView *view);
+    Core::Internal::EditorView *currentEditorView();
     IEditor *pickUnusedEditor() const;
 
     void updateCurrentPositionInNavigationHistory();
-- 
GitLab