C++: make highlighting/completion plugable.

Change-Id: I990fdf5411153041c6b4c62f31b453342d59de53
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
This commit is contained in:
Erik Verbruggen
2012-02-20 12:39:08 +01:00
parent d66acb51d0
commit 6fe6f5cdb1
15 changed files with 407 additions and 94 deletions

View File

@@ -30,43 +30,20 @@
**
**************************************************************************/
#include "cppcompletionassist.h"
#include "cppcompletionsupport.h"
#include "cppmodelmanager.h"
#include "cpptoolseditorsupport.h"
#include <coreplugin/idocument.h>
#include <projectexplorer/project.h>
#include <texteditor/codeassist/iassistinterface.h>
using namespace CPlusPlus;
using namespace CppTools;
using namespace CppTools::Internal;
CppCompletionSupport::CppCompletionSupport(CppEditorSupport *editorSupport)
: m_editorSupport(editorSupport)
CppCompletionSupport::CppCompletionSupport(TextEditor::ITextEditor *editor)
: m_editor(editor)
{
Q_ASSERT(editorSupport);
Q_ASSERT(editor);
}
TextEditor::IAssistInterface *CppCompletionSupport::createAssistInterface(ProjectExplorer::Project *project,
QTextDocument *document,
int position,
TextEditor::AssistReason reason) const
CppCompletionSupport::~CppCompletionSupport()
{
}
CppCompletionSupportFactory::~CppCompletionSupportFactory()
{
CppModelManagerInterface *modelManager = CppModelManagerInterface::instance();
QStringList includePaths;
QStringList frameworkPaths;
if (project) {
includePaths = modelManager->projectInfo(project).includePaths();
frameworkPaths = modelManager->projectInfo(project).frameworkPaths();
}
return new CppTools::Internal::CppCompletionAssistInterface(
document,
position,
m_editorSupport->textEditor()->document(),
reason,
modelManager->snapshot(),
includePaths,
frameworkPaths);
}