summaryrefslogtreecommitdiff
path: root/src/plugins/qmljseditor
diff options
context:
space:
mode:
authorhjk <hjk121@nokiamail.com>2014-09-04 00:04:18 +0200
committerhjk <hjk121@nokiamail.com>2014-09-09 21:01:22 +0200
commit0edefc4c2bb2e8b88d6e86c2fe768b597e16ede1 (patch)
tree76f4c36eed6389537c49e549dfe9567e2e7737e8 /src/plugins/qmljseditor
parent0c3eeab464a488edfedb1e98b433102f2293669a (diff)
downloadqt-creator-0edefc4c2bb2e8b88d6e86c2fe768b597e16ede1.tar.gz
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: Nikolai Kosjar <nikolai.kosjar@digia.com>
Diffstat (limited to 'src/plugins/qmljseditor')
-rw-r--r--src/plugins/qmljseditor/qmljscompletionassist.cpp32
-rw-r--r--src/plugins/qmljseditor/qmljscompletionassist.h20
-rw-r--r--src/plugins/qmljseditor/qmljseditor.cpp10
-rw-r--r--src/plugins/qmljseditor/qmljseditor.h2
-rw-r--r--src/plugins/qmljseditor/qmljsquickfixassist.cpp4
-rw-r--r--src/plugins/qmljseditor/qmljsquickfixassist.h4
6 files changed, 36 insertions, 36 deletions
diff --git a/src/plugins/qmljseditor/qmljscompletionassist.cpp b/src/plugins/qmljseditor/qmljscompletionassist.cpp
index 40564155e9..a025e942f0 100644
--- a/src/plugins/qmljseditor/qmljscompletionassist.cpp
+++ b/src/plugins/qmljseditor/qmljscompletionassist.cpp
@@ -34,7 +34,7 @@
#include <coreplugin/idocument.h>
-#include <texteditor/codeassist/iassistinterface.h>
+#include <texteditor/codeassist/assistinterface.h>
#include <texteditor/codeassist/genericproposal.h>
#include <texteditor/codeassist/functionhintproposal.h>
#include <texteditor/codeassist/ifunctionhintproposalmodel.h>
@@ -83,7 +83,7 @@ enum CompletionOrder {
TypeOrder = -30
};
-static void addCompletion(QList<BasicProposalItem *> *completions,
+static void addCompletion(QList<AssistProposalItem *> *completions,
const QString &text,
const QIcon &icon,
int order,
@@ -92,7 +92,7 @@ static void addCompletion(QList<BasicProposalItem *> *completions,
if (text.isEmpty())
return;
- BasicProposalItem *item = new QmlJSAssistProposalItem;
+ AssistProposalItem *item = new QmlJSAssistProposalItem;
item->setText(text);
item->setIcon(icon);
item->setOrder(order);
@@ -100,7 +100,7 @@ static void addCompletion(QList<BasicProposalItem *> *completions,
completions->append(item);
}
-static void addCompletions(QList<BasicProposalItem *> *completions,
+static void addCompletions(QList<AssistProposalItem *> *completions,
const QStringList &newCompletions,
const QIcon &icon,
int order)
@@ -125,10 +125,10 @@ public:
class CompletionAdder : public PropertyProcessor
{
protected:
- QList<BasicProposalItem *> *completions;
+ QList<AssistProposalItem *> *completions;
public:
- CompletionAdder(QList<BasicProposalItem *> *completions,
+ CompletionAdder(QList<AssistProposalItem *> *completions,
const QIcon &icon, int order)
: completions(completions)
, icon(icon)
@@ -155,7 +155,7 @@ public:
class LhsCompletionAdder : public CompletionAdder
{
public:
- LhsCompletionAdder(QList<BasicProposalItem *> *completions,
+ LhsCompletionAdder(QList<AssistProposalItem *> *completions,
const QIcon &icon,
int order,
bool afterOn)
@@ -511,7 +511,7 @@ QmlJSCompletionAssistProcessor::~QmlJSCompletionAssistProcessor()
IAssistProposal *QmlJSCompletionAssistProcessor::createContentProposal() const
{
- IGenericProposalModel *model = new QmlJSAssistProposalModel(m_completions);
+ GenericProposalModel *model = new QmlJSAssistProposalModel(m_completions);
IAssistProposal *proposal = new GenericProposal(m_startPosition, model);
return proposal;
}
@@ -526,7 +526,7 @@ IAssistProposal *QmlJSCompletionAssistProcessor::createHintProposal(
return proposal;
}
-IAssistProposal *QmlJSCompletionAssistProcessor::perform(const IAssistInterface *assistInterface)
+IAssistProposal *QmlJSCompletionAssistProcessor::perform(const AssistInterface *assistInterface)
{
m_interface.reset(static_cast<const QmlJSCompletionAssistInterface *>(assistInterface));
@@ -756,7 +756,7 @@ IAssistProposal *QmlJSCompletionAssistProcessor::perform(const IAssistInterface
processProperties.setEnumerateSlots(false);
// id: is special
- BasicProposalItem *idProposalItem = new QmlJSAssistProposalItem;
+ AssistProposalItem *idProposalItem = new QmlJSAssistProposalItem;
idProposalItem->setText(QLatin1String("id: "));
idProposalItem->setIcon(m_interface->symbolIcon());
idProposalItem->setOrder(PropertyOrder);
@@ -932,7 +932,7 @@ bool QmlJSCompletionAssistProcessor::completeFileName(const QString &relativeBas
dirIterator.next();
const QString fileName = dirIterator.fileName();
- BasicProposalItem *item = new QmlJSAssistProposalItem;
+ AssistProposalItem *item = new QmlJSAssistProposalItem;
item->setText(fileName);
item->setIcon(m_interface->fileNameIcon());
m_completions.append(item);
@@ -970,7 +970,7 @@ QmlJSCompletionAssistInterface::QmlJSCompletionAssistInterface(QTextDocument *te
const QString &fileName,
AssistReason reason,
const SemanticInfo &info)
- : DefaultAssistInterface(textDocument, position, fileName, reason)
+ : AssistInterface(textDocument, position, fileName, reason)
, m_semanticInfo(info)
, m_darkBlueIcon(iconForColor(Qt::darkBlue))
, m_darkYellowIcon(iconForColor(Qt::darkYellow))
@@ -989,7 +989,7 @@ class QmlJSLessThan
public:
QmlJSLessThan(const QString &searchString) : m_searchString(searchString)
{ }
- bool operator() (const BasicProposalItem *a, const BasicProposalItem *b)
+ bool operator() (const AssistProposalItem *a, const AssistProposalItem *b)
{
if (a->order() != b->order())
return a->order() > b->order();
@@ -1020,12 +1020,12 @@ private:
// -------------------------
void QmlJSAssistProposalModel::filter(const QString &prefix)
{
- BasicProposalItemListModel::filter(prefix);
+ GenericProposalModel::filter(prefix);
if (prefix.startsWith(QLatin1String("__")))
return;
- QList<BasicProposalItem *> newCurrentItems;
+ QList<AssistProposalItem *> newCurrentItems;
newCurrentItems.reserve(m_currentItems.size());
- foreach (BasicProposalItem *item, m_currentItems)
+ foreach (AssistProposalItem *item, m_currentItems)
if (!item->text().startsWith(QLatin1String("__")))
newCurrentItems << item;
m_currentItems = newCurrentItems;
diff --git a/src/plugins/qmljseditor/qmljscompletionassist.h b/src/plugins/qmljseditor/qmljscompletionassist.h
index 23713148db..6145801e62 100644
--- a/src/plugins/qmljseditor/qmljscompletionassist.h
+++ b/src/plugins/qmljseditor/qmljscompletionassist.h
@@ -32,12 +32,12 @@
#include "qmljseditor.h"
-#include <texteditor/codeassist/basicproposalitem.h>
-#include <texteditor/codeassist/basicproposalitemlistmodel.h>
+#include <texteditor/codeassist/assistproposalitem.h>
+#include <texteditor/codeassist/genericproposalmodel.h>
#include <texteditor/codeassist/completionassistprovider.h>
#include <texteditor/codeassist/iassistprocessor.h>
#include <texteditor/snippets/snippetassistcollector.h>
-#include <texteditor/codeassist/defaultassistinterface.h>
+#include <texteditor/codeassist/assistinterface.h>
#include <utils/qtcoverride.h>
@@ -53,7 +53,7 @@ namespace Internal {
class QmlJSCompletionAssistInterface;
-class QmlJSAssistProposalItem : public TextEditor::BasicProposalItem
+class QmlJSAssistProposalItem : public TextEditor::AssistProposalItem
{
public:
bool prematurelyApplies(const QChar &c) const QTC_OVERRIDE;
@@ -62,11 +62,11 @@ public:
};
-class QmlJSAssistProposalModel : public TextEditor::BasicProposalItemListModel
+class QmlJSAssistProposalModel : public TextEditor::GenericProposalModel
{
public:
- QmlJSAssistProposalModel(const QList<TextEditor::BasicProposalItem *> &items)
- : TextEditor::BasicProposalItemListModel(items)
+ QmlJSAssistProposalModel(const QList<TextEditor::AssistProposalItem *> &items)
+ : TextEditor::GenericProposalModel(items)
{}
void filter(const QString &prefix) QTC_OVERRIDE;
@@ -95,7 +95,7 @@ public:
QmlJSCompletionAssistProcessor();
~QmlJSCompletionAssistProcessor();
- TextEditor::IAssistProposal *perform(const TextEditor::IAssistInterface *interface) QTC_OVERRIDE;
+ TextEditor::IAssistProposal *perform(const TextEditor::AssistInterface *interface) QTC_OVERRIDE;
private:
TextEditor::IAssistProposal *createContentProposal() const;
@@ -112,12 +112,12 @@ private:
int m_startPosition;
QScopedPointer<const QmlJSCompletionAssistInterface> m_interface;
- QList<TextEditor::BasicProposalItem *> m_completions;
+ QList<TextEditor::AssistProposalItem *> m_completions;
TextEditor::SnippetAssistCollector m_snippetCollector;
};
-class QmlJSCompletionAssistInterface : public TextEditor::DefaultAssistInterface
+class QmlJSCompletionAssistInterface : public TextEditor::AssistInterface
{
public:
QmlJSCompletionAssistInterface(QTextDocument *textDocument,
diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp
index d788a1e2a5..4b41dd8b8d 100644
--- a/src/plugins/qmljseditor/qmljseditor.cpp
+++ b/src/plugins/qmljseditor/qmljseditor.cpp
@@ -67,7 +67,7 @@
#include <texteditor/syntaxhighlighter.h>
#include <texteditor/refactoroverlay.h>
#include <texteditor/codeassist/genericproposal.h>
-#include <texteditor/codeassist/basicproposalitemlistmodel.h>
+#include <texteditor/codeassist/genericproposalmodel.h>
#include <texteditor/texteditoractionhandler.h>
#include <utils/changeset.h>
@@ -679,15 +679,15 @@ void QmlJSEditorWidget::contextMenuEvent(QContextMenuEvent *e)
QSignalMapper mapper;
connect(&mapper, SIGNAL(mapped(int)), this, SLOT(performQuickFix(int)));
if (!m_qmlJsEditorDocument->isSemanticInfoOutdated()) {
- IAssistInterface *interface = createAssistInterface(QuickFix, ExplicitlyInvoked);
+ AssistInterface *interface = createAssistInterface(QuickFix, ExplicitlyInvoked);
if (interface) {
QScopedPointer<IAssistProcessor> processor(
QmlJSEditorPlugin::instance()->quickFixAssistProvider()->createProcessor());
QScopedPointer<IAssistProposal> proposal(processor->perform(interface));
if (!proposal.isNull()) {
- BasicProposalItemListModel *model = static_cast<BasicProposalItemListModel *>(proposal->model());
+ GenericProposalModel *model = static_cast<GenericProposalModel *>(proposal->model());
for (int index = 0; index < model->size(); ++index) {
- BasicProposalItem *item = static_cast<BasicProposalItem *>(model->proposalItem(index));
+ AssistProposalItem *item = static_cast<AssistProposalItem *>(model->proposalItem(index));
QuickFixOperation::Ptr op = item->data().value<QuickFixOperation::Ptr>();
m_quickFixes.append(op);
QAction *action = refactoringMenu->addAction(op->description());
@@ -831,7 +831,7 @@ bool QmlJSEditorWidget::hideContextPane()
return b;
}
-IAssistInterface *QmlJSEditorWidget::createAssistInterface(
+AssistInterface *QmlJSEditorWidget::createAssistInterface(
TextEditor::AssistKind assistKind,
TextEditor::AssistReason reason) const
{
diff --git a/src/plugins/qmljseditor/qmljseditor.h b/src/plugins/qmljseditor/qmljseditor.h
index d5caedc2ea..77da8fbc30 100644
--- a/src/plugins/qmljseditor/qmljseditor.h
+++ b/src/plugins/qmljseditor/qmljseditor.h
@@ -72,7 +72,7 @@ public:
QModelIndex outlineModelIndex();
- TextEditor::IAssistInterface *createAssistInterface(TextEditor::AssistKind assistKind,
+ TextEditor::AssistInterface *createAssistInterface(TextEditor::AssistKind assistKind,
TextEditor::AssistReason reason) const;
public slots:
void findUsages();
diff --git a/src/plugins/qmljseditor/qmljsquickfixassist.cpp b/src/plugins/qmljseditor/qmljsquickfixassist.cpp
index 7615ccde38..bf92ac17f0 100644
--- a/src/plugins/qmljseditor/qmljsquickfixassist.cpp
+++ b/src/plugins/qmljseditor/qmljsquickfixassist.cpp
@@ -48,8 +48,8 @@ using namespace Internal;
// -----------------------
QmlJSQuickFixAssistInterface::QmlJSQuickFixAssistInterface(QmlJSEditorWidget *editor,
TextEditor::AssistReason reason)
- : DefaultAssistInterface(editor->document(), editor->position(),
- editor->textDocument()->filePath(), reason)
+ : AssistInterface(editor->document(), editor->position(),
+ editor->textDocument()->filePath(), reason)
, m_semanticInfo(editor->qmlJsEditorDocument()->semanticInfo())
, m_currentFile(QmlJSRefactoringChanges::file(editor, m_semanticInfo.document))
{}
diff --git a/src/plugins/qmljseditor/qmljsquickfixassist.h b/src/plugins/qmljseditor/qmljsquickfixassist.h
index 672dd31474..60965b5168 100644
--- a/src/plugins/qmljseditor/qmljsquickfixassist.h
+++ b/src/plugins/qmljseditor/qmljsquickfixassist.h
@@ -34,7 +34,7 @@
#include <qmljstools/qmljsrefactoringchanges.h>
-#include <texteditor/codeassist/defaultassistinterface.h>
+#include <texteditor/codeassist/assistinterface.h>
#include <texteditor/codeassist/quickfixassistprovider.h>
#include <texteditor/codeassist/quickfixassistprocessor.h>
@@ -43,7 +43,7 @@
namespace QmlJSEditor {
namespace Internal {
-class QmlJSQuickFixAssistInterface : public TextEditor::DefaultAssistInterface
+class QmlJSQuickFixAssistInterface : public TextEditor::AssistInterface
{
public:
QmlJSQuickFixAssistInterface(QmlJSEditorWidget *editor, TextEditor::AssistReason reason);