diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index dfc52d29d4025ad4bc665eb2a7188620ae0e47b9..9bef06004a043311b9e7833442e80c673b6a3d5e 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 25a05adc24588fc41d0264f5ef98de4bac76e619..e38cc379cb126018343975ab7c3457e95320b4c6 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();