Commit 0edefc4c authored by hjk's avatar hjk

TextEditor: Merge some "assist" related classes

Simplifies the code base by removing one level of unused
and unneeded abstraction.

- Merge {I,Default}AssistInterface to AssistInterface
- Merge {IAssist,Basic}ProposalItem to AssistProposalItem
- Merge {IGenericProposal,BasicProposalItemList}Model to GenericProposalModel

Change-Id: I54ee7b095427383d67a00fc1d87c3808c21d812d
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent 0c3eeab4
...@@ -48,8 +48,8 @@ ...@@ -48,8 +48,8 @@
#include <texteditor/basetexteditor.h> #include <texteditor/basetexteditor.h>
#include <texteditor/convenience.h> #include <texteditor/convenience.h>
#include <texteditor/codeassist/basicproposalitemlistmodel.h> #include <texteditor/codeassist/genericproposalmodel.h>
#include <texteditor/codeassist/basicproposalitem.h> #include <texteditor/codeassist/assistproposalitem.h>
#include <texteditor/codeassist/functionhintproposal.h> #include <texteditor/codeassist/functionhintproposal.h>
#include <texteditor/codeassist/genericproposal.h> #include <texteditor/codeassist/genericproposal.h>
#include <texteditor/codeassist/ifunctionhintproposalmodel.h> #include <texteditor/codeassist/ifunctionhintproposalmodel.h>
...@@ -202,7 +202,7 @@ IAssistProcessor *ClangCompletionAssistProvider::createProcessor() const ...@@ -202,7 +202,7 @@ IAssistProcessor *ClangCompletionAssistProvider::createProcessor() const
return new ClangCompletionAssistProcessor; return new ClangCompletionAssistProcessor;
} }
IAssistInterface *ClangCompletionAssistProvider::createAssistInterface( AssistInterface *ClangCompletionAssistProvider::createAssistInterface(
const QString &filePath, const QString &filePath,
QTextDocument *document, bool isObjCEnabled, int position, AssistReason reason) const QTextDocument *document, bool isObjCEnabled, int position, AssistReason reason) const
{ {
...@@ -235,11 +235,11 @@ IAssistInterface *ClangCompletionAssistProvider::createAssistInterface( ...@@ -235,11 +235,11 @@ IAssistInterface *ClangCompletionAssistProvider::createAssistInterface(
// ------------------------ // ------------------------
// ClangAssistProposalModel // ClangAssistProposalModel
// ------------------------ // ------------------------
class ClangAssistProposalModel : public TextEditor::BasicProposalItemListModel class ClangAssistProposalModel : public TextEditor::GenericProposalModel
{ {
public: public:
ClangAssistProposalModel() ClangAssistProposalModel()
: TextEditor::BasicProposalItemListModel() : TextEditor::GenericProposalModel()
, m_sortable(false) , m_sortable(false)
, m_completionOperator(T_EOF_SYMBOL) , m_completionOperator(T_EOF_SYMBOL)
, m_replaceDotForArrow(false) , m_replaceDotForArrow(false)
...@@ -257,7 +257,7 @@ public: ...@@ -257,7 +257,7 @@ public:
class ClangAssistProposal : public TextEditor::GenericProposal class ClangAssistProposal : public TextEditor::GenericProposal
{ {
public: public:
ClangAssistProposal(int cursorPos, TextEditor::IGenericProposalModel *model) ClangAssistProposal(int cursorPos, TextEditor::GenericProposalModel *model)
: TextEditor::GenericProposal(cursorPos, model) : TextEditor::GenericProposal(cursorPos, model)
, m_replaceDotForArrow(static_cast<ClangAssistProposalModel *>(model)->m_replaceDotForArrow) , m_replaceDotForArrow(static_cast<ClangAssistProposalModel *>(model)->m_replaceDotForArrow)
{} {}
...@@ -345,7 +345,7 @@ int ClangFunctionHintModel::activeArgument(const QString &prefix) const ...@@ -345,7 +345,7 @@ int ClangFunctionHintModel::activeArgument(const QString &prefix) const
return argnr; return argnr;
} }
class ClangAssistProposalItem : public TextEditor::BasicProposalItem class ClangAssistProposalItem : public TextEditor::AssistProposalItem
{ {
public: public:
ClangAssistProposalItem() {} ClangAssistProposalItem() {}
...@@ -550,7 +550,7 @@ ClangCompletionAssistInterface::ClangCompletionAssistInterface(ClangCompleter::P ...@@ -550,7 +550,7 @@ ClangCompletionAssistInterface::ClangCompletionAssistInterface(ClangCompleter::P
const QStringList &options, const QStringList &options,
const QList<CppTools::ProjectPart::HeaderPath> &headerPaths, const QList<CppTools::ProjectPart::HeaderPath> &headerPaths,
const PchInfo::Ptr &pchInfo) const PchInfo::Ptr &pchInfo)
: DefaultAssistInterface(document, position, fileName, reason) : AssistInterface(document, position, fileName, reason)
, m_clangWrapper(clangWrapper) , m_clangWrapper(clangWrapper)
, m_options(options) , m_options(options)
, m_headerPaths(headerPaths) , m_headerPaths(headerPaths)
...@@ -602,7 +602,7 @@ ClangCompletionAssistProcessor::~ClangCompletionAssistProcessor() ...@@ -602,7 +602,7 @@ ClangCompletionAssistProcessor::~ClangCompletionAssistProcessor()
{ {
} }
IAssistProposal *ClangCompletionAssistProcessor::perform(const IAssistInterface *interface) IAssistProposal *ClangCompletionAssistProcessor::perform(const AssistInterface *interface)
{ {
m_interface.reset(static_cast<const ClangCompletionAssistInterface *>(interface)); m_interface.reset(static_cast<const ClangCompletionAssistInterface *>(interface));
......
...@@ -37,9 +37,9 @@ ...@@ -37,9 +37,9 @@
#include <cpptools/cppcompletionassistprovider.h> #include <cpptools/cppcompletionassistprovider.h>
#include <cpptools/cppmodelmanagerinterface.h> #include <cpptools/cppmodelmanagerinterface.h>
#include <texteditor/codeassist/basicproposalitem.h> #include <texteditor/codeassist/assistproposalitem.h>
#include <texteditor/codeassist/completionassistprovider.h> #include <texteditor/codeassist/completionassistprovider.h>
#include <texteditor/codeassist/defaultassistinterface.h> #include <texteditor/codeassist/assistinterface.h>
#include <texteditor/codeassist/iassistprocessor.h> #include <texteditor/codeassist/iassistprocessor.h>
#include <QStringList> #include <QStringList>
...@@ -56,7 +56,7 @@ public: ...@@ -56,7 +56,7 @@ public:
ClangCompletionAssistProvider(); ClangCompletionAssistProvider();
virtual TextEditor::IAssistProcessor *createProcessor() const; virtual TextEditor::IAssistProcessor *createProcessor() const;
virtual TextEditor::IAssistInterface *createAssistInterface( virtual TextEditor::AssistInterface *createAssistInterface(
const QString &filePath, const QString &filePath,
QTextDocument *document, bool isObjCEnabled, int position, QTextDocument *document, bool isObjCEnabled, int position,
TextEditor::AssistReason reason) const; TextEditor::AssistReason reason) const;
...@@ -67,7 +67,7 @@ private: ...@@ -67,7 +67,7 @@ private:
} // namespace Internal } // namespace Internal
class CLANG_EXPORT ClangCompletionAssistInterface: public TextEditor::DefaultAssistInterface class CLANG_EXPORT ClangCompletionAssistInterface: public TextEditor::AssistInterface
{ {
public: public:
ClangCompletionAssistInterface(ClangCodeModel::ClangCompleter::Ptr clangWrapper, ClangCompletionAssistInterface(ClangCodeModel::ClangCompleter::Ptr clangWrapper,
...@@ -109,7 +109,7 @@ public: ...@@ -109,7 +109,7 @@ public:
ClangCompletionAssistProcessor(); ClangCompletionAssistProcessor();
virtual ~ClangCompletionAssistProcessor(); virtual ~ClangCompletionAssistProcessor();
virtual TextEditor::IAssistProposal *perform(const TextEditor::IAssistInterface *interface); virtual TextEditor::IAssistProposal *perform(const TextEditor::AssistInterface *interface);
private: private:
int startCompletionHelper(); int startCompletionHelper();
...@@ -133,7 +133,7 @@ private: ...@@ -133,7 +133,7 @@ private:
private: private:
int m_startPosition; int m_startPosition;
QScopedPointer<const ClangCompletionAssistInterface> m_interface; QScopedPointer<const ClangCompletionAssistInterface> m_interface;
QList<TextEditor::BasicProposalItem *> m_completions; QList<TextEditor::AssistProposalItem *> m_completions;
CPlusPlus::Icons m_icons; CPlusPlus::Icons m_icons;
QStringList m_preprocessorCompletions; QStringList m_preprocessorCompletions;
QScopedPointer<Internal::ClangAssistProposalModel> m_model; QScopedPointer<Internal::ClangAssistProposalModel> m_model;
......
...@@ -39,8 +39,7 @@ ...@@ -39,8 +39,7 @@
#include <texteditor/basetextdocument.h> #include <texteditor/basetextdocument.h>
#include <texteditor/basetexteditor.h> #include <texteditor/basetexteditor.h>
#include <texteditor/codeassist/iassistproposal.h> #include <texteditor/codeassist/iassistproposal.h>
#include <texteditor/codeassist/iassistproposalmodel.h> #include <texteditor/codeassist/genericproposalmodel.h>
#include <texteditor/codeassist/basicproposalitemlistmodel.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/changeset.h> #include <utils/changeset.h>
......
...@@ -62,8 +62,8 @@ ...@@ -62,8 +62,8 @@
#include <texteditor/basetextdocument.h> #include <texteditor/basetextdocument.h>
#include <texteditor/basetextdocumentlayout.h> #include <texteditor/basetextdocumentlayout.h>
#include <texteditor/codeassist/basicproposalitem.h> #include <texteditor/codeassist/assistproposalitem.h>
#include <texteditor/codeassist/basicproposalitemlistmodel.h> #include <texteditor/codeassist/genericproposalmodel.h>
#include <texteditor/codeassist/genericproposal.h> #include <texteditor/codeassist/genericproposal.h>
#include <texteditor/fontsettings.h> #include <texteditor/fontsettings.h>
#include <texteditor/refactoroverlay.h> #include <texteditor/refactoroverlay.h>
...@@ -498,15 +498,15 @@ void CppEditorWidget::contextMenuEvent(QContextMenuEvent *e) ...@@ -498,15 +498,15 @@ void CppEditorWidget::contextMenuEvent(QContextMenuEvent *e)
QSignalMapper mapper; QSignalMapper mapper;
connect(&mapper, SIGNAL(mapped(int)), this, SLOT(performQuickFix(int))); connect(&mapper, SIGNAL(mapped(int)), this, SLOT(performQuickFix(int)));
if (isSemanticInfoValid()) { if (isSemanticInfoValid()) {
IAssistInterface *interface = createAssistInterface(QuickFix, ExplicitlyInvoked); AssistInterface *interface = createAssistInterface(QuickFix, ExplicitlyInvoked);
if (interface) { if (interface) {
QScopedPointer<IAssistProcessor> processor( QScopedPointer<IAssistProcessor> processor(
CppEditorPlugin::instance()->quickFixProvider()->createProcessor()); CppEditorPlugin::instance()->quickFixProvider()->createProcessor());
QScopedPointer<IAssistProposal> proposal(processor->perform(interface)); QScopedPointer<IAssistProposal> proposal(processor->perform(interface));
if (!proposal.isNull()) { if (!proposal.isNull()) {
auto model = static_cast<BasicProposalItemListModel *>(proposal->model()); auto model = static_cast<GenericProposalModel *>(proposal->model());
for (int index = 0; index < model->size(); ++index) { for (int index = 0; index < model->size(); ++index) {
auto item = static_cast<BasicProposalItem *>(model->proposalItem(index)); auto item = static_cast<AssistProposalItem *>(model->proposalItem(index));
QuickFixOperation::Ptr op = item->data().value<QuickFixOperation::Ptr>(); QuickFixOperation::Ptr op = item->data().value<QuickFixOperation::Ptr>();
d->m_quickFixes.append(op); d->m_quickFixes.append(op);
QAction *action = quickFixMenu->addAction(op->description()); QAction *action = quickFixMenu->addAction(op->description());
...@@ -610,7 +610,7 @@ void CppEditorWidget::updateSemanticInfo(const SemanticInfo &semanticInfo, ...@@ -610,7 +610,7 @@ void CppEditorWidget::updateSemanticInfo(const SemanticInfo &semanticInfo,
updateFunctionDeclDefLink(); updateFunctionDeclDefLink();
} }
IAssistInterface *CppEditorWidget::createAssistInterface(AssistKind kind, AssistReason reason) const AssistInterface *CppEditorWidget::createAssistInterface(AssistKind kind, AssistReason reason) const
{ {
if (kind == Completion) { if (kind == Completion) {
if (CppCompletionAssistProvider *cap = cppEditorDocument()->completionAssistProvider()) { if (CppCompletionAssistProvider *cap = cppEditorDocument()->completionAssistProvider()) {
......
...@@ -79,7 +79,7 @@ public: ...@@ -79,7 +79,7 @@ public:
QSharedPointer<FunctionDeclDefLink> declDefLink() const; QSharedPointer<FunctionDeclDefLink> declDefLink() const;
void applyDeclDefLinkChanges(bool jumpToMatch); void applyDeclDefLinkChanges(bool jumpToMatch);
TextEditor::IAssistInterface *createAssistInterface( TextEditor::AssistInterface *createAssistInterface(
TextEditor::AssistKind kind, TextEditor::AssistKind kind,
TextEditor::AssistReason reason) const QTC_OVERRIDE; TextEditor::AssistReason reason) const QTC_OVERRIDE;
......
...@@ -87,8 +87,8 @@ const IAssistProvider *CppQuickFixAssistProcessor::provider() const ...@@ -87,8 +87,8 @@ const IAssistProvider *CppQuickFixAssistProcessor::provider() const
// -------------------------- // --------------------------
CppQuickFixAssistInterface::CppQuickFixAssistInterface(CppEditorWidget *editor, CppQuickFixAssistInterface::CppQuickFixAssistInterface(CppEditorWidget *editor,
TextEditor::AssistReason reason) TextEditor::AssistReason reason)
: DefaultAssistInterface(editor->document(), editor->position(), : AssistInterface(editor->document(), editor->position(),
editor->textDocument()->filePath(), reason) editor->textDocument()->filePath(), reason)
, m_editor(editor) , m_editor(editor)
, m_semanticInfo(editor->semanticInfo()) , m_semanticInfo(editor->semanticInfo())
, m_snapshot(CppTools::CppModelManagerInterface::instance()->snapshot()) , m_snapshot(CppTools::CppModelManagerInterface::instance()->snapshot())
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#define CPPQUICKFIXASSISTANT_H #define CPPQUICKFIXASSISTANT_H
#include <cpptools/cppsemanticinfo.h> #include <cpptools/cppsemanticinfo.h>
#include <texteditor/codeassist/defaultassistinterface.h> #include <texteditor/codeassist/assistinterface.h>
#include <texteditor/codeassist/quickfixassistprovider.h> #include <texteditor/codeassist/quickfixassistprovider.h>
#include <texteditor/codeassist/quickfixassistprocessor.h> #include <texteditor/codeassist/quickfixassistprocessor.h>
...@@ -49,7 +49,7 @@ namespace Internal { ...@@ -49,7 +49,7 @@ namespace Internal {
class CppEditorWidget; class CppEditorWidget;
class CppQuickFixAssistInterface : public TextEditor::DefaultAssistInterface class CppQuickFixAssistInterface : public TextEditor::AssistInterface
{ {
public: public:
CppQuickFixAssistInterface(CppEditorWidget *editor, TextEditor::AssistReason reason); CppQuickFixAssistInterface(CppEditorWidget *editor, TextEditor::AssistReason reason);
......
...@@ -44,10 +44,10 @@ ...@@ -44,10 +44,10 @@
#include <cpptools/symbolfinder.h> #include <cpptools/symbolfinder.h>
#include <cpptools/typehierarchybuilder.h> #include <cpptools/typehierarchybuilder.h>
#include <texteditor/codeassist/basicproposalitemlistmodel.h> #include <texteditor/codeassist/genericproposalmodel.h>
#include <texteditor/codeassist/genericproposal.h> #include <texteditor/codeassist/genericproposal.h>
#include <texteditor/codeassist/genericproposalwidget.h> #include <texteditor/codeassist/genericproposalwidget.h>
#include <texteditor/codeassist/iassistinterface.h> #include <texteditor/codeassist/assistinterface.h>
#include <texteditor/codeassist/iassistprocessor.h> #include <texteditor/codeassist/iassistprocessor.h>
#include <texteditor/codeassist/iassistproposal.h> #include <texteditor/codeassist/iassistproposal.h>
#include <texteditor/texteditorconstants.h> #include <texteditor/texteditorconstants.h>
...@@ -91,7 +91,7 @@ protected: ...@@ -91,7 +91,7 @@ protected:
void showProposal(const QString &prefix) QTC_OVERRIDE void showProposal(const QString &prefix) QTC_OVERRIDE
{ {
IGenericProposalModel *proposalModel = model(); GenericProposalModel *proposalModel = model();
if (proposalModel && proposalModel->size() == 1) { if (proposalModel && proposalModel->size() == 1) {
emit proposalItemActivated(proposalModel->proposalItem(0)); emit proposalItemActivated(proposalModel->proposalItem(0));
deleteLater(); deleteLater();
...@@ -107,7 +107,7 @@ private: ...@@ -107,7 +107,7 @@ private:
class VirtualFunctionProposal : public GenericProposal class VirtualFunctionProposal : public GenericProposal
{ {
public: public:
VirtualFunctionProposal(int cursorPos, IGenericProposalModel *model, bool openInSplit) VirtualFunctionProposal(int cursorPos, GenericProposalModel *model, bool openInSplit)
: GenericProposal(cursorPos, model) : GenericProposal(cursorPos, model)
, m_openInSplit(openInSplit) , m_openInSplit(openInSplit)
{} {}
...@@ -128,24 +128,24 @@ public: ...@@ -128,24 +128,24 @@ public:
: m_params(params) : m_params(params)
{} {}
IAssistProposal *immediateProposal(const TextEditor::IAssistInterface *) QTC_OVERRIDE IAssistProposal *immediateProposal(const TextEditor::AssistInterface *) QTC_OVERRIDE
{ {
QTC_ASSERT(m_params.function, return 0); QTC_ASSERT(m_params.function, return 0);
BasicProposalItem *hintItem = new VirtualFunctionProposalItem(CppEditorWidget::Link()); AssistProposalItem *hintItem = new VirtualFunctionProposalItem(CppEditorWidget::Link());
hintItem->setText(QCoreApplication::translate("VirtualFunctionsAssistProcessor", hintItem->setText(QCoreApplication::translate("VirtualFunctionsAssistProcessor",
"...searching overrides")); "...searching overrides"));
hintItem->setOrder(-1000); hintItem->setOrder(-1000);
QList<BasicProposalItem *> items; QList<AssistProposalItem *> items;
items << itemFromFunction(m_params.function); items << itemFromFunction(m_params.function);
items << hintItem; items << hintItem;
return new VirtualFunctionProposal(m_params.cursorPosition, return new VirtualFunctionProposal(m_params.cursorPosition,
new BasicProposalItemListModel(items), new GenericProposalModel(items),
m_params.openInNextSplit); m_params.openInNextSplit);
} }
IAssistProposal *perform(const IAssistInterface *) QTC_OVERRIDE IAssistProposal *perform(const AssistInterface *) QTC_OVERRIDE
{ {
QTC_ASSERT(m_params.function, return 0); QTC_ASSERT(m_params.function, return 0);
QTC_ASSERT(m_params.staticClass, return 0); QTC_ASSERT(m_params.staticClass, return 0);
...@@ -161,13 +161,13 @@ public: ...@@ -161,13 +161,13 @@ public:
if (overrides.isEmpty()) if (overrides.isEmpty())
return 0; return 0;
QList<BasicProposalItem *> items; QList<AssistProposalItem *> items;
foreach (Function *func, overrides) foreach (Function *func, overrides)
items << itemFromFunction(func); items << itemFromFunction(func);
items.first()->setOrder(1000); // Ensure top position for function of static type items.first()->setOrder(1000); // Ensure top position for function of static type
return new VirtualFunctionProposal(m_params.cursorPosition, return new VirtualFunctionProposal(m_params.cursorPosition,
new BasicProposalItemListModel(items), new GenericProposalModel(items),
m_params.openInNextSplit); m_params.openInNextSplit);
} }
...@@ -179,14 +179,14 @@ private: ...@@ -179,14 +179,14 @@ private:
return func; return func;
} }
BasicProposalItem *itemFromFunction(Function *func) const AssistProposalItem *itemFromFunction(Function *func) const
{ {
const CppEditorWidget::Link link = CppEditorWidget::linkToSymbol(maybeDefinitionFor(func)); const CppEditorWidget::Link link = CppEditorWidget::linkToSymbol(maybeDefinitionFor(func));
QString text = m_overview.prettyName(LookupContext::fullyQualifiedName(func)); QString text = m_overview.prettyName(LookupContext::fullyQualifiedName(func));
if (func->isPureVirtual()) if (func->isPureVirtual())
text += QLatin1String(" = 0"); text += QLatin1String(" = 0");
BasicProposalItem *item = new VirtualFunctionProposalItem(link, m_params.openInNextSplit); AssistProposalItem *item = new VirtualFunctionProposalItem(link, m_params.openInNextSplit);
item->setText(text); item->setText(text);
item->setIcon(m_icons.iconForSymbol(func)); item->setIcon(m_icons.iconForSymbol(func));
......
...@@ -31,12 +31,13 @@ ...@@ -31,12 +31,13 @@
#define CPPVIRTUALFUNCTIONPROPOSALITEM_H #define CPPVIRTUALFUNCTIONPROPOSALITEM_H
#include <texteditor/basetexteditor.h> #include <texteditor/basetexteditor.h>
#include <texteditor/codeassist/basicproposalitem.h> #include <texteditor/codeassist/assistproposalitem.h>
namespace CppEditor { namespace CppEditor {
namespace Internal { namespace Internal {
class VirtualFunctionProposalItem: public TextEditor::BasicProposalItem { class VirtualFunctionProposalItem: public TextEditor::AssistProposalItem
{
public: public:
VirtualFunctionProposalItem(const TextEditor::BaseTextEditorWidget::Link &link, VirtualFunctionProposalItem(const TextEditor::BaseTextEditorWidget::Link &link,
bool openInSplit = true); bool openInSplit = true);
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include "cppvirtualfunctionassistprovider.h" #include "cppvirtualfunctionassistprovider.h"
#include "cppvirtualfunctionproposalitem.h" #include "cppvirtualfunctionproposalitem.h"
#include <texteditor/codeassist/basicproposalitemlistmodel.h> #include <texteditor/codeassist/genericproposalmodel.h>
#include <texteditor/codeassist/iassistprocessor.h> #include <texteditor/codeassist/iassistprocessor.h>
#include <texteditor/codeassist/iassistproposal.h> #include <texteditor/codeassist/iassistproposal.h>
...@@ -124,7 +124,7 @@ public: ...@@ -124,7 +124,7 @@ public:
VirtualFunctionAssistProvider::configure(params); VirtualFunctionAssistProvider::configure(params);
IAssistProcessor *processor = createProcessor(); IAssistProcessor *processor = createProcessor();
IAssistInterface *assistInterface AssistInterface *assistInterface
= m_editorWidget->createAssistInterface(FollowSymbol, ExplicitlyInvoked); = m_editorWidget->createAssistInterface(FollowSymbol, ExplicitlyInvoked);
IAssistProposal *immediateProposal = processor->immediateProposal(assistInterface); IAssistProposal *immediateProposal = processor->immediateProposal(assistInterface);
IAssistProposal *finalProposal = processor->perform(assistInterface); IAssistProposal *finalProposal = processor->perform(assistInterface);
...@@ -140,7 +140,7 @@ public: ...@@ -140,7 +140,7 @@ public:
static OverrideItemList itemList(IAssistProposalModel *imodel) static OverrideItemList itemList(IAssistProposalModel *imodel)
{ {
OverrideItemList result; OverrideItemList result;
BasicProposalItemListModel *model = dynamic_cast<BasicProposalItemListModel *>(imodel); GenericProposalModel *model = dynamic_cast<GenericProposalModel *>(imodel);
if (!model) if (!model)
return result; return result;
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <cppeditor/cppeditorconstants.h> #include <cppeditor/cppeditorconstants.h>
#include <texteditor/codeassist/basicproposalitem.h> #include <texteditor/codeassist/assistproposalitem.h>
#include <texteditor/codeassist/genericproposal.h> #include <texteditor/codeassist/genericproposal.h>
#include <texteditor/codeassist/ifunctionhintproposalmodel.h> #include <texteditor/codeassist/ifunctionhintproposalmodel.h>
#include <texteditor/codeassist/functionhintproposal.h> #include <texteditor/codeassist/functionhintproposal.h>
...@@ -84,7 +84,7 @@ struct CompleteFunctionDeclaration ...@@ -84,7 +84,7 @@ struct CompleteFunctionDeclaration
// --------------------- // ---------------------
// CppAssistProposalItem // CppAssistProposalItem
// --------------------- // ---------------------
class CppAssistProposalItem : public BasicProposalItem class CppAssistProposalItem : public AssistProposalItem
{ {
public: public:
CppAssistProposalItem() : CppAssistProposalItem() :
...@@ -119,9 +119,9 @@ bool CppAssistProposalModel::isSortable(const QString &prefix) const ...@@ -119,9 +119,9 @@ bool CppAssistProposalModel::isSortable(const QString &prefix) const
return !prefix.isEmpty(); return !prefix.isEmpty();
} }
IAssistProposalItem *CppAssistProposalModel::proposalItem(int index) const AssistProposalItem *CppAssistProposalModel::proposalItem(int index) const
{ {
auto item = static_cast<BasicProposalItem *>(BasicProposalItemListModel::proposalItem(index)); auto item = static_cast<AssistProposalItem *>(GenericProposalModel::proposalItem(index));
if (!item->data().canConvert<QString>()) { if (!item->data().canConvert<QString>()) {
CppAssistProposalItem *cppItem = static_cast<CppAssistProposalItem *>(item); CppAssistProposalItem *cppItem = static_cast<CppAssistProposalItem *>(item);
cppItem->keepCompletionOperator(m_completionOperator); cppItem->keepCompletionOperator(m_completionOperator);
...@@ -416,7 +416,7 @@ IAssistProcessor *InternalCompletionAssistProvider::createProcessor() const ...@@ -416,7 +416,7 @@ IAssistProcessor *InternalCompletionAssistProvider::createProcessor() const
return new CppCompletionAssistProcessor; return new CppCompletionAssistProcessor;
} }
IAssistInterface *InternalCompletionAssistProvider::createAssistInterface( AssistInterface *InternalCompletionAssistProvider::createAssistInterface(
const QString &filePath, QTextDocument *document, const QString &filePath, QTextDocument *document,
bool isObjCEnabled, int position, AssistReason reason) const bool isObjCEnabled, int position, AssistReason reason) const
{ {
...@@ -434,7 +434,7 @@ IAssistInterface *InternalCompletionAssistProvider::createAssistInterface( ...@@ -434,7 +434,7 @@ IAssistInterface *InternalCompletionAssistProvider::createAssistInterface(
class CppAssistProposal : public GenericProposal class CppAssistProposal : public GenericProposal
{ {
public: public:
CppAssistProposal(int cursorPos, IGenericProposalModel *model) CppAssistProposal(int cursorPos, GenericProposalModel *model)
: GenericProposal(cursorPos, model) : GenericProposal(cursorPos, model)
, m_replaceDotForArrow(static_cast<CppAssistProposalModel *>(model)->m_replaceDotForArrow) , m_replaceDotForArrow(static_cast<CppAssistProposalModel *>(model)->m_replaceDotForArrow)
{} {}
...@@ -460,7 +460,7 @@ namespace { ...@@ -460,7 +460,7 @@ namespace {
class ConvertToCompletionItem: protected NameVisitor class ConvertToCompletionItem: protected NameVisitor
{ {
// The completion item. // The completion item.
BasicProposalItem *_item; AssistProposalItem *_item;
// The current symbol. // The current symbol.
Symbol *_symbol; Symbol *_symbol;
...@@ -477,14 +477,14 @@ public: ...@@ -477,14 +477,14 @@ public:
overview.showArgumentNames = true; overview.showArgumentNames = true;
} }
BasicProposalItem *operator()(Symbol *symbol) AssistProposalItem *operator()(Symbol *symbol)
{ {
//using declaration can be qualified //using declaration can be qualified
if (!symbol || !symbol->name() || (symbol->name()->isQualifiedNameId() if (!symbol || !symbol->name() || (symbol->name()->isQualifiedNameId()
&& !symbol->asUsingDeclaration())) && !symbol->asUsingDeclaration()))
return 0; return 0;
BasicProposalItem *previousItem = switchCompletionItem(0); AssistProposalItem *previousItem = switchCompletionItem(0);
Symbol *previousSymbol = switchSymbol(symbol); Symbol *previousSymbol = switchSymbol(symbol);
accept(symbol->unqualifiedName()); accept(symbol->unqualifiedName());
if (_item) if (_item)
...@@ -501,16 +501,16 @@ protected: ...@@ -501,16 +501,16 @@ protected:
return previousSymbol; return previousSymbol;
} }
BasicProposalItem *switchCompletionItem(BasicProposalItem *item) AssistProposalItem *switchCompletionItem(AssistProposalItem *item)
{ {
BasicProposalItem *previousItem = _item; AssistProposalItem *previousItem = _item;
_item = item; _item = item;
return previousItem; return previousItem;
} }
BasicProposalItem *newCompletionItem(const Name *name) AssistProposalItem *newCompletionItem(const Name *name)
{ {
BasicProposalItem *item = new CppAssistProposalItem; AssistProposalItem *item = new CppAssistProposalItem;
item->setText(overview.prettyName(name)); item->setText(overview.prettyName(name));
return item; return item;
} }
...@@ -631,7 +631,7 @@ CppCompletionAssistProcessor::CppCompletionAssistProcessor() ...@@ -631,7 +631,7 @@ CppCompletionAssistProcessor::CppCompletionAssistProcessor()
CppCompletionAssistProcessor::~CppCompletionAssistProcessor() CppCompletionAssistProcessor::~CppCompletionAssistProcessor()
{} {}
IAssistProposal * CppCompletionAssistProcessor::perform(const IAssistInterface *interface) IAssistProposal * CppCompletionAssistProcessor::perform(const AssistInterface *interface)
{ {
m_interface.reset(static_cast<const CppCompletionAssistInterface *>(interface)); m_interface.reset(static_cast<const CppCompletionAssistInterface *>(interface));
...@@ -719,7 +719,7 @@ IAssistProposal *CppCompletionAssistProcessor::createContentProposal() ...@@ -719,7 +719,7 @@ IAssistProposal *CppCompletionAssistProcessor::createContentProposal()
{ {
// Duplicates are kept only if they are snippets. // Duplicates are kept only if they are snippets.
QSet<QString> processed; QSet<QString> processed;
QList<BasicProposalItem *>::iterator it = m_completions.begin(); QList<AssistProposalItem *>::iterator it = m_completions.begin();