summaryrefslogtreecommitdiff
path: root/src/plugins/cppeditor/cppincludehierarchy.cpp
diff options
context:
space:
mode:
authorPrzemyslaw Gorszkowski <pgorszkowski@gmail.com>2013-11-05 14:02:13 +0100
committerNikolai Kosjar <nikolai.kosjar@digia.com>2013-11-20 11:55:28 +0100
commitabdbae33083164b4021884fee500cf325ffc8994 (patch)
treec7eb1197df85302ad20b53444c3f86a6ee0cbf1c /src/plugins/cppeditor/cppincludehierarchy.cpp
parentf744372ed35fb7c99312df5b7bc3e6124d9cae36 (diff)
downloadqt-creator-abdbae33083164b4021884fee500cf325ffc8994.tar.gz
CppEditor: "Include Hierarchy": using snapshot from snapshotUpdater
For "includes" we should use snapshot from "SnapshotUpdater"(project specific snapshot, not global snapshot) instead of "global" snapshot. The snapshot of the editor's SnapshotUpdater contains the documents parsed with the appropriate include paths/defines etc. and should therefore be used for the include hierarchy. Change-Id: I6bbaf5040536b771d32697aad1db364758ff8382 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Diffstat (limited to 'src/plugins/cppeditor/cppincludehierarchy.cpp')
-rw-r--r--src/plugins/cppeditor/cppincludehierarchy.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/plugins/cppeditor/cppincludehierarchy.cpp b/src/plugins/cppeditor/cppincludehierarchy.cpp
index 15a2429f82..3efde4c154 100644
--- a/src/plugins/cppeditor/cppincludehierarchy.cpp
+++ b/src/plugins/cppeditor/cppincludehierarchy.cpp
@@ -36,6 +36,7 @@
#include "cppincludehierarchymodel.h"
#include "cppincludehierarchytreeview.h"
+#include <coreplugin/editormanager/editormanager.h>
#include <cplusplus/CppDocument.h>
#include <utils/annotateditemdelegate.h>
@@ -89,7 +90,8 @@ CppIncludeHierarchyWidget::CppIncludeHierarchyWidget() :
m_treeView(0),
m_model(0),
m_delegate(0),
- m_includeHierarchyInfoLabel(0)
+ m_includeHierarchyInfoLabel(0),
+ m_editor(0)
{
m_inspectedFile = new CppIncludeLabel(this);
m_inspectedFile->setMargin(5);
@@ -118,6 +120,9 @@ CppIncludeHierarchyWidget::CppIncludeHierarchyWidget() :
setLayout(layout);
connect(CppEditorPlugin::instance(), SIGNAL(includeHierarchyRequested()), SLOT(perform()));
+ connect(Core::EditorManager::instance(), SIGNAL(editorsClosed(QList<Core::IEditor *>)),
+ this, SLOT(editorsClosed(QList<Core::IEditor *>)));
+
}
CppIncludeHierarchyWidget::~CppIncludeHierarchyWidget()
@@ -128,15 +133,16 @@ void CppIncludeHierarchyWidget::perform()
{
showNoIncludeHierarchyLabel();
- CPPEditor *editor = qobject_cast<CPPEditor *>(Core::EditorManager::currentEditor());
- if (!editor)
+ m_editor = qobject_cast<CPPEditor *>(Core::EditorManager::currentEditor());
+ if (!m_editor)
return;
- CPPEditorWidget *widget = qobject_cast<CPPEditorWidget *>(editor->widget());
+
+ CPPEditorWidget *widget = qobject_cast<CPPEditorWidget *>(m_editor->widget());
if (!widget)
return;
m_model->clear();
- m_model->buildHierarchy(widget->editorDocument()->filePath());
+ m_model->buildHierarchy(m_editor, widget->editorDocument()->filePath());
if (m_model->isEmpty())
return;
@@ -162,6 +168,14 @@ void CppIncludeHierarchyWidget::onItemClicked(const QModelIndex &index)
Constants::CPPEDITOR_ID);
}
+void CppIncludeHierarchyWidget::editorsClosed(QList<Core::IEditor *> editors)
+{
+ foreach (Core::IEditor *editor, editors) {
+ if (m_editor == editor)
+ perform();
+ }
+}
+
void CppIncludeHierarchyWidget::showNoIncludeHierarchyLabel()
{
m_inspectedFile->hide();