C++: clean-up CppCompletionAssist.

This is step 1 of 2 for merging the various provider factories into a
single class. Merging has the advantage that selecting based on editor
(content) mime-type only has to select one class, instead of re-doing
the selection for each class separately.

Change-Id: I11f815151bd4769ae6028b636793d6a80d02e202
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
Erik Verbruggen
2013-08-30 13:13:44 +02:00
committed by Nikolai Kosjar
parent 49adb78ec9
commit b4a1bd415f
14 changed files with 51 additions and 191 deletions

View File

@@ -43,7 +43,6 @@
#include <cpptools/cpptoolsconstants.h>
#include <cpptools/cppchecksymbols.h>
#include <cpptools/cppcodeformatter.h>
#include <cpptools/cppcompletionsupport.h>
#include <cpptools/cppcompletionassistprovider.h>
#include <cpptools/cpphighlightingsupport.h>
#include <cpptools/cpplocalsymbols.h>
@@ -511,7 +510,6 @@ CPPEditorWidget::CPPEditorWidget(QWidget *parent)
, m_firstRenameChange(false)
, m_objcEnabled(false)
, m_commentsSettings(CppTools::CppToolsSettings::instance()->commentsSettings())
, m_completionSupport(0)
{
qRegisterMetaType<SemanticInfo>("CppTools::SemanticInfo");
@@ -532,8 +530,6 @@ CPPEditorWidget::CPPEditorWidget(QWidget *parent)
this, SLOT(updateSemanticInfo(CppTools::SemanticInfo)));
connect(editorSupport, SIGNAL(highlighterStarted(QFuture<TextEditor::HighlightingResult>*,uint)),
this, SLOT(highlighterStarted(QFuture<TextEditor::HighlightingResult>*,uint)));
m_completionSupport = m_modelManager->completionSupport(editor());
}
m_highlightRevision = 0;
@@ -563,8 +559,6 @@ CPPEditorWidget::~CPPEditorWidget()
{
if (m_modelManager)
m_modelManager->deleteCppEditorSupport(editor());
delete m_completionSupport;
}
TextEditor::BaseTextEditor *CPPEditorWidget::createEditor()
@@ -2111,10 +2105,12 @@ TextEditor::IAssistInterface *CPPEditorWidget::createAssistInterface(
TextEditor::AssistReason reason) const
{
if (kind == TextEditor::Completion) {
if (m_completionSupport)
return m_completionSupport->createAssistInterface(
CppEditorSupport *ces = CppModelManagerInterface::instance()->cppEditorSupport(editor());
CppCompletionAssistProvider *cap = ces->completionAssistProvider();
if (cap)
return cap->createAssistInterface(
ProjectExplorer::ProjectExplorerPlugin::currentProject(),
document(), position(), reason);
editor()->document()->filePath(), document(), position(), reason);
} else if (kind == TextEditor::QuickFix) {
if (!semanticInfo().doc || isOutdated())
return 0;