texteditor: merge ITextEditable into ITextEditor

rename BastTextEditor->BaseTextEditorWidget, BaseTextEditorEditable->BaseTextEditor
rename BaseTextEditor{,Widget} subclasses
rename editableInterface->editorInterface
rename createEditableInterface->createEditor
minor cleanups after renamings
This commit is contained in:
hjk
2011-02-21 16:02:26 +01:00
parent e32cf192f7
commit f576ad9f2c
180 changed files with 1326 additions and 1382 deletions

View File

@@ -501,7 +501,7 @@ CodeCompletion::CodeCompletion(ModelManagerInterface *modelManager, QObject *par
CodeCompletion::~CodeCompletion()
{ }
TextEditor::ITextEditable *CodeCompletion::editor() const
TextEditor::ITextEditor *CodeCompletion::editor() const
{ return m_editor; }
int CodeCompletion::startPosition() const
@@ -510,9 +510,9 @@ int CodeCompletion::startPosition() const
bool CodeCompletion::shouldRestartCompletion()
{ return m_restartCompletion; }
bool CodeCompletion::supportsEditor(TextEditor::ITextEditable *editor) const
bool CodeCompletion::supportsEditor(TextEditor::ITextEditor *editor) const
{
if (qobject_cast<QmlJSTextEditor *>(editor->widget()))
if (qobject_cast<QmlJSTextEditorWidget *>(editor->widget()))
return true;
return false;
@@ -523,12 +523,12 @@ bool CodeCompletion::supportsPolicy(TextEditor::CompletionPolicy policy) const
return policy == TextEditor::SemanticCompletion;
}
bool CodeCompletion::triggersCompletion(TextEditor::ITextEditable *editor)
bool CodeCompletion::triggersCompletion(TextEditor::ITextEditor *editor)
{
if (maybeTriggersCompletion(editor)) {
// check the token under cursor
if (QmlJSTextEditor *ed = qobject_cast<QmlJSTextEditor *>(editor->widget())) {
if (QmlJSTextEditorWidget *ed = qobject_cast<QmlJSTextEditorWidget *>(editor->widget())) {
QTextCursor tc = ed->textCursor();
QTextBlock block = tc.block();
@@ -557,7 +557,7 @@ bool CodeCompletion::triggersCompletion(TextEditor::ITextEditable *editor)
return false;
}
bool CodeCompletion::maybeTriggersCompletion(TextEditor::ITextEditable *editor)
bool CodeCompletion::maybeTriggersCompletion(TextEditor::ITextEditor *editor)
{
const int cursorPosition = editor->position();
const QChar ch = editor->characterAt(cursorPosition - 1);
@@ -744,13 +744,13 @@ static const Interpreter::Value *getPropertyValue(
return value;
}
int CodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
int CodeCompletion::startCompletion(TextEditor::ITextEditor *editor)
{
m_restartCompletion = false;
m_editor = editor;
QmlJSTextEditor *edit = qobject_cast<QmlJSTextEditor *>(m_editor->widget());
QmlJSTextEditorWidget *edit = qobject_cast<QmlJSTextEditorWidget *>(m_editor->widget());
if (! edit)
return -1;
@@ -1028,7 +1028,7 @@ void CodeCompletion::complete(const TextEditor::CompletionItem &item, QChar type
QString toInsert = item.text;
if (QmlJSTextEditor *edit = qobject_cast<QmlJSTextEditor *>(m_editor->widget())) {
if (QmlJSTextEditorWidget *edit = qobject_cast<QmlJSTextEditorWidget *>(m_editor->widget())) {
if (item.data.isValid()) {
QTextCursor tc = edit->textCursor();
tc.setPosition(m_startPosition, QTextCursor::KeepAnchor);
@@ -1057,7 +1057,7 @@ void CodeCompletion::complete(const TextEditor::CompletionItem &item, QChar type
}
const int length = m_editor->position() - m_startPosition + replacedLength;
m_editor->setCurPos(m_startPosition);
m_editor->setCursorPosition(m_startPosition);
m_editor->replace(length, toInsert);
if (toInsert.endsWith(QLatin1Char('.')))

View File

@@ -41,7 +41,7 @@
#include <QtCore/QPointer>
namespace TextEditor {
class ITextEditable;
class ITextEditor;
}
namespace QmlJS {
@@ -66,13 +66,13 @@ public:
explicit CodeCompletion(QmlJS::ModelManagerInterface *modelManager, QObject *parent = 0);
virtual ~CodeCompletion();
virtual TextEditor::ITextEditable *editor() const;
virtual TextEditor::ITextEditor *editor() const;
virtual int startPosition() const;
virtual bool shouldRestartCompletion();
virtual bool supportsEditor(TextEditor::ITextEditable *editor) const;
virtual bool supportsEditor(TextEditor::ITextEditor *editor) const;
virtual bool supportsPolicy(TextEditor::CompletionPolicy policy) const;
virtual bool triggersCompletion(TextEditor::ITextEditable *editor);
virtual int startCompletion(TextEditor::ITextEditable *editor);
virtual bool triggersCompletion(TextEditor::ITextEditor *editor);
virtual int startCompletion(TextEditor::ITextEditor *editor);
virtual void completions(QList<TextEditor::CompletionItem> *completions);
virtual bool typedCharCompletes(const TextEditor::CompletionItem &item, QChar typedChar);
virtual void complete(const TextEditor::CompletionItem &item, QChar typedChar);
@@ -84,7 +84,7 @@ public:
private:
bool maybeTriggersCompletion(TextEditor::ITextEditable *editor);
bool maybeTriggersCompletion(TextEditor::ITextEditor *editor);
bool isDelimiter(QChar ch) const;
bool completeUrl(const QString &relativeBasePath, const QString &urlString);
@@ -100,7 +100,7 @@ private:
const QIcon &icon, int relevance, bool afterOn);
QmlJS::ModelManagerInterface *m_modelManager;
TextEditor::ITextEditable *m_editor;
TextEditor::ITextEditor *m_editor;
int m_startPosition;
bool m_restartCompletion;
TextEditor::SnippetCollector m_snippetProvider;

View File

@@ -603,8 +603,8 @@ int SemanticInfo::revision() const
return 0;
}
QmlJSTextEditor::QmlJSTextEditor(QWidget *parent) :
TextEditor::BaseTextEditor(parent),
QmlJSTextEditorWidget::QmlJSTextEditorWidget(QWidget *parent) :
TextEditor::BaseTextEditorWidget(parent),
m_outlineCombo(0),
m_outlineModel(new QmlOutlineModel(this)),
m_modelManager(0),
@@ -689,23 +689,23 @@ QmlJSTextEditor::QmlJSTextEditor(QWidget *parent) :
setRequestMarkEnabled(true);
}
QmlJSTextEditor::~QmlJSTextEditor()
QmlJSTextEditorWidget::~QmlJSTextEditorWidget()
{
m_semanticHighlighter->abort();
m_semanticHighlighter->wait();
}
SemanticInfo QmlJSTextEditor::semanticInfo() const
SemanticInfo QmlJSTextEditorWidget::semanticInfo() const
{
return m_semanticInfo;
}
int QmlJSTextEditor::editorRevision() const
int QmlJSTextEditorWidget::editorRevision() const
{
return document()->revision();
}
bool QmlJSTextEditor::isOutdated() const
bool QmlJSTextEditorWidget::isOutdated() const
{
if (m_semanticInfo.revision() != editorRevision())
return true;
@@ -713,12 +713,12 @@ bool QmlJSTextEditor::isOutdated() const
return false;
}
QmlOutlineModel *QmlJSTextEditor::outlineModel() const
QmlOutlineModel *QmlJSTextEditorWidget::outlineModel() const
{
return m_outlineModel;
}
QModelIndex QmlJSTextEditor::outlineModelIndex()
QModelIndex QmlJSTextEditorWidget::outlineModelIndex()
{
if (!m_outlineModelIndex.isValid()) {
m_outlineModelIndex = indexForPosition(position());
@@ -729,10 +729,10 @@ QModelIndex QmlJSTextEditor::outlineModelIndex()
Core::IEditor *QmlJSEditorEditable::duplicate(QWidget *parent)
{
QmlJSTextEditor *newEditor = new QmlJSTextEditor(parent);
newEditor->duplicateFrom(editor());
QmlJSTextEditorWidget *newEditor = new QmlJSTextEditorWidget(parent);
newEditor->duplicateFrom(editorWidget());
QmlJSEditorPlugin::instance()->initializeEditor(newEditor);
return newEditor->editableInterface();
return newEditor->editor();
}
QString QmlJSEditorEditable::id() const
@@ -742,8 +742,8 @@ QString QmlJSEditorEditable::id() const
bool QmlJSEditorEditable::open(const QString &fileName)
{
bool b = TextEditor::BaseTextEditorEditable::open(fileName);
editor()->setMimeType(Core::ICore::instance()->mimeDatabase()->findByFile(QFileInfo(fileName)).type());
bool b = TextEditor::BaseTextEditor::open(fileName);
editorWidget()->setMimeType(Core::ICore::instance()->mimeDatabase()->findByFile(QFileInfo(fileName)).type());
return b;
}
@@ -752,12 +752,12 @@ Core::Context QmlJSEditorEditable::context() const
return m_context;
}
void QmlJSTextEditor::updateDocument()
void QmlJSTextEditorWidget::updateDocument()
{
m_updateDocumentTimer->start(UPDATE_DOCUMENT_DEFAULT_INTERVAL);
}
void QmlJSTextEditor::updateDocumentNow()
void QmlJSTextEditorWidget::updateDocumentNow()
{
// ### move in the parser thread.
@@ -804,7 +804,7 @@ static void appendExtraSelectionsForMessages(
}
}
void QmlJSTextEditor::onDocumentUpdated(QmlJS::Document::Ptr doc)
void QmlJSTextEditorWidget::onDocumentUpdated(QmlJS::Document::Ptr doc)
{
if (file()->fileName() != doc->fileName()
|| doc->editorRevision() != document()->revision()) {
@@ -824,13 +824,13 @@ void QmlJSTextEditor::onDocumentUpdated(QmlJS::Document::Ptr doc)
}
}
void QmlJSTextEditor::modificationChanged(bool changed)
void QmlJSTextEditorWidget::modificationChanged(bool changed)
{
if (!changed && m_modelManager)
m_modelManager->fileChangedOnDisk(file()->fileName());
}
void QmlJSTextEditor::jumpToOutlineElement(int /*index*/)
void QmlJSTextEditorWidget::jumpToOutlineElement(int /*index*/)
{
QModelIndex index = m_outlineCombo->view()->currentIndex();
AST::SourceLocation location = m_outlineModel->sourceLocation(index);
@@ -849,7 +849,7 @@ void QmlJSTextEditor::jumpToOutlineElement(int /*index*/)
setFocus();
}
void QmlJSTextEditor::updateOutlineNow()
void QmlJSTextEditorWidget::updateOutlineNow()
{
if (!m_semanticInfo.document)
return;
@@ -867,7 +867,7 @@ void QmlJSTextEditor::updateOutlineNow()
updateOutlineIndexNow();
}
void QmlJSTextEditor::updateOutlineIndexNow()
void QmlJSTextEditorWidget::updateOutlineIndexNow()
{
if (m_updateOutlineTimer->isActive())
return; // updateOutlineNow will call this function soon anyway
@@ -904,7 +904,7 @@ static UiQualifiedId *qualifiedTypeNameId(Node *m)
return 0;
}
void QmlJSTextEditor::updateCursorPositionNow()
void QmlJSTextEditorWidget::updateCursorPositionNow()
{
if (m_contextPane && document() && semanticInfo().isValid()
&& document()->revision() == semanticInfo().document->editorRevision())
@@ -912,8 +912,8 @@ void QmlJSTextEditor::updateCursorPositionNow()
Node *oldNode = m_semanticInfo.declaringMemberNoProperties(m_oldCursorPosition);
Node *newNode = m_semanticInfo.declaringMemberNoProperties(position());
if (oldNode != newNode && m_oldCursorPosition != -1)
m_contextPane->apply(editableInterface(), semanticInfo().document, LookupContext::Ptr(),newNode, false);
if (m_contextPane->isAvailable(editableInterface(), semanticInfo().document, newNode) &&
m_contextPane->apply(editor(), semanticInfo().document, LookupContext::Ptr(),newNode, false);
if (m_contextPane->isAvailable(editor(), semanticInfo().document, newNode) &&
!m_contextPane->widget()->isVisible()) {
QList<TextEditor::RefactorMarker> markers;
if (UiObjectMember *m = newNode->uiObjectMemberCast()) {
@@ -946,28 +946,28 @@ void QmlJSTextEditor::updateCursorPositionNow()
}
}
void QmlJSTextEditor::showTextMarker()
void QmlJSTextEditorWidget::showTextMarker()
{
m_oldCursorPosition = -1;
updateCursorPositionNow();
}
void QmlJSTextEditor::updateUses()
void QmlJSTextEditorWidget::updateUses()
{
m_updateUsesTimer->start();
}
bool QmlJSTextEditor::updateSelectedElements() const
bool QmlJSTextEditorWidget::updateSelectedElements() const
{
return m_updateSelectedElements;
}
void QmlJSTextEditor::setUpdateSelectedElements(bool value)
void QmlJSTextEditorWidget::setUpdateSelectedElements(bool value)
{
m_updateSelectedElements = value;
}
void QmlJSTextEditor::renameId(const QString &oldId, const QString &newId)
void QmlJSTextEditorWidget::renameId(const QString &oldId, const QString &newId)
{
Utils::ChangeSet changeSet;
@@ -979,7 +979,7 @@ void QmlJSTextEditor::renameId(const QString &oldId, const QString &newId)
changeSet.apply(&tc);
}
void QmlJSTextEditor::updateUsesNow()
void QmlJSTextEditorWidget::updateUsesNow()
{
if (document()->revision() != m_semanticInfo.revision()) {
updateUses();
@@ -1110,7 +1110,7 @@ protected:
}
};
void QmlJSTextEditor::setSelectedElements()
void QmlJSTextEditorWidget::setSelectedElements()
{
if (!m_updateSelectedElements)
return;
@@ -1148,11 +1148,11 @@ void QmlJSTextEditor::setSelectedElements()
emit selectedElementsChanged(offsets, wordAtCursor);
}
void QmlJSTextEditor::updateFileName()
void QmlJSTextEditorWidget::updateFileName()
{
}
void QmlJSTextEditor::renameIdUnderCursor()
void QmlJSTextEditorWidget::renameIdUnderCursor()
{
const QString id = wordUnderCursor();
bool ok = false;
@@ -1166,9 +1166,9 @@ void QmlJSTextEditor::renameIdUnderCursor()
}
}
void QmlJSTextEditor::setFontSettings(const TextEditor::FontSettings &fs)
void QmlJSTextEditorWidget::setFontSettings(const TextEditor::FontSettings &fs)
{
TextEditor::BaseTextEditor::setFontSettings(fs);
TextEditor::BaseTextEditorWidget::setFontSettings(fs);
Highlighter *highlighter = qobject_cast<Highlighter*>(baseTextDocument()->syntaxHighlighter());
if (!highlighter)
return;
@@ -1190,7 +1190,7 @@ void QmlJSTextEditor::setFontSettings(const TextEditor::FontSettings &fs)
}
QString QmlJSTextEditor::wordUnderCursor() const
QString QmlJSTextEditorWidget::wordUnderCursor() const
{
QTextCursor tc = textCursor();
const QChar ch = characterAt(tc.position() - 1);
@@ -1203,7 +1203,7 @@ QString QmlJSTextEditor::wordUnderCursor() const
return word;
}
bool QmlJSTextEditor::isClosingBrace(const QList<Token> &tokens) const
bool QmlJSTextEditorWidget::isClosingBrace(const QList<Token> &tokens) const
{
if (tokens.size() == 1) {
@@ -1215,14 +1215,14 @@ bool QmlJSTextEditor::isClosingBrace(const QList<Token> &tokens) const
return false;
}
TextEditor::BaseTextEditorEditable *QmlJSTextEditor::createEditableInterface()
TextEditor::BaseTextEditor *QmlJSTextEditorWidget::createEditor()
{
QmlJSEditorEditable *editable = new QmlJSEditorEditable(this);
createToolBar(editable);
return editable;
}
void QmlJSTextEditor::createToolBar(QmlJSEditorEditable *editable)
void QmlJSTextEditorWidget::createToolBar(QmlJSEditorEditable *editable)
{
m_outlineCombo = new QComboBox;
m_outlineCombo->setMinimumContentsLength(22);
@@ -1253,7 +1253,7 @@ void QmlJSTextEditor::createToolBar(QmlJSEditorEditable *editable)
toolBar->insertWidget(actions.first(), m_outlineCombo);
}
TextEditor::BaseTextEditor::Link QmlJSTextEditor::findLinkAt(const QTextCursor &cursor, bool /*resolveTarget*/)
TextEditor::BaseTextEditorWidget::Link QmlJSTextEditorWidget::findLinkAt(const QTextCursor &cursor, bool /*resolveTarget*/)
{
const SemanticInfo semanticInfo = m_semanticInfo;
if (! semanticInfo.isValid())
@@ -1267,7 +1267,7 @@ TextEditor::BaseTextEditor::Link QmlJSTextEditor::findLinkAt(const QTextCursor &
// if it's a file import, link to the file
foreach (const Interpreter::ImportInfo &import, semanticInfo.document->bind()->imports()) {
if (import.ast() == importAst && import.type() == Interpreter::ImportInfo::FileImport) {
BaseTextEditor::Link link(import.name());
BaseTextEditorWidget::Link link(import.name());
link.begin = importAst->firstSourceLocation().begin();
link.end = importAst->lastSourceLocation().end();
return link;
@@ -1286,7 +1286,7 @@ TextEditor::BaseTextEditor::Link QmlJSTextEditor::findLinkAt(const QTextCursor &
if (! (value && value->getSourceLocation(&fileName, &line, &column)))
return Link();
BaseTextEditor::Link link;
BaseTextEditorWidget::Link link;
link.fileName = fileName;
link.line = line;
link.column = column - 1; // adjust the column
@@ -1314,34 +1314,34 @@ TextEditor::BaseTextEditor::Link QmlJSTextEditor::findLinkAt(const QTextCursor &
return Link();
}
void QmlJSTextEditor::followSymbolUnderCursor()
void QmlJSTextEditorWidget::followSymbolUnderCursor()
{
openLink(findLinkAt(textCursor()));
}
void QmlJSTextEditor::findUsages()
void QmlJSTextEditorWidget::findUsages()
{
m_findReferences->findUsages(file()->fileName(), textCursor().position());
}
void QmlJSTextEditor::showContextPane()
void QmlJSTextEditorWidget::showContextPane()
{
if (m_contextPane && m_semanticInfo.isValid()) {
Node *newNode = m_semanticInfo.declaringMemberNoProperties(position());
m_contextPane->apply(editableInterface(), m_semanticInfo.document, m_semanticInfo.lookupContext(), newNode, false, true);
m_contextPane->apply(editor(), m_semanticInfo.document, m_semanticInfo.lookupContext(), newNode, false, true);
m_oldCursorPosition = position();
QList<TextEditor::RefactorMarker> markers;
setRefactorMarkers(markers);
}
}
void QmlJSTextEditor::performQuickFix(int index)
void QmlJSTextEditorWidget::performQuickFix(int index)
{
TextEditor::QuickFixOperation::Ptr op = m_quickFixes.at(index);
op->perform();
}
void QmlJSTextEditor::contextMenuEvent(QContextMenuEvent *e)
void QmlJSTextEditorWidget::contextMenuEvent(QContextMenuEvent *e)
{
QMenu *menu = new QMenu();
@@ -1361,7 +1361,7 @@ void QmlJSTextEditor::contextMenuEvent(QContextMenuEvent *e)
connect(&mapper, SIGNAL(mapped(int)), this, SLOT(performQuickFix(int)));
if (! isOutdated()) {
if (quickFixCollector->startCompletion(editableInterface()) != -1) {
if (quickFixCollector->startCompletion(editor()) != -1) {
m_quickFixes = quickFixCollector->quickFixes();
for (int index = 0; index < m_quickFixes.size(); ++index) {
@@ -1392,7 +1392,7 @@ void QmlJSTextEditor::contextMenuEvent(QContextMenuEvent *e)
m_quickFixes.clear();
}
bool QmlJSTextEditor::event(QEvent *e)
bool QmlJSTextEditorWidget::event(QEvent *e)
{
switch (e->type()) {
case QEvent::ShortcutOverride:
@@ -1407,61 +1407,61 @@ bool QmlJSTextEditor::event(QEvent *e)
break;
}
return BaseTextEditor::event(e);
return BaseTextEditorWidget::event(e);
}
void QmlJSTextEditor::wheelEvent(QWheelEvent *event)
void QmlJSTextEditorWidget::wheelEvent(QWheelEvent *event)
{
bool visible = false;
if (m_contextPane && m_contextPane->widget()->isVisible())
visible = true;
BaseTextEditor::wheelEvent(event);
BaseTextEditorWidget::wheelEvent(event);
if (visible) {
LookupContext::Ptr lookupContext;
if (m_semanticInfo.isValid())
lookupContext = m_semanticInfo.lookupContext();
m_contextPane->apply(editableInterface(), semanticInfo().document, QmlJS::LookupContext::Ptr(), m_semanticInfo.declaringMemberNoProperties(m_oldCursorPosition), false, true);
m_contextPane->apply(editor(), semanticInfo().document, QmlJS::LookupContext::Ptr(), m_semanticInfo.declaringMemberNoProperties(m_oldCursorPosition), false, true);
}
}
void QmlJSTextEditor::resizeEvent(QResizeEvent *event)
void QmlJSTextEditorWidget::resizeEvent(QResizeEvent *event)
{
BaseTextEditor::resizeEvent(event);
BaseTextEditorWidget::resizeEvent(event);
hideContextPane();
}
void QmlJSTextEditor::scrollContentsBy(int dx, int dy)
void QmlJSTextEditorWidget::scrollContentsBy(int dx, int dy)
{
BaseTextEditor::scrollContentsBy(dx, dy);
BaseTextEditorWidget::scrollContentsBy(dx, dy);
hideContextPane();
}
void QmlJSTextEditor::unCommentSelection()
void QmlJSTextEditorWidget::unCommentSelection()
{
Utils::unCommentSelection(this);
}
void QmlJSTextEditor::forceSemanticRehighlight()
void QmlJSTextEditorWidget::forceSemanticRehighlight()
{
m_semanticHighlighter->rehighlight(currentSource(/* force = */ true));
}
void QmlJSEditor::QmlJSTextEditor::forceSemanticRehighlightIfCurrentEditor()
void QmlJSEditor::QmlJSTextEditorWidget::forceSemanticRehighlightIfCurrentEditor()
{
Core::EditorManager *editorManager = Core::EditorManager::instance();
if (editorManager->currentEditor() == editableInterface())
if (editorManager->currentEditor() == editor())
forceSemanticRehighlight();
}
void QmlJSTextEditor::semanticRehighlight()
void QmlJSTextEditorWidget::semanticRehighlight()
{
m_semanticHighlighter->rehighlight(currentSource());
}
void QmlJSTextEditor::updateSemanticInfo(const SemanticInfo &semanticInfo)
void QmlJSTextEditorWidget::updateSemanticInfo(const SemanticInfo &semanticInfo)
{
if (semanticInfo.revision() != document()->revision()) {
// got outdated semantic info
@@ -1486,7 +1486,7 @@ void QmlJSTextEditor::updateSemanticInfo(const SemanticInfo &semanticInfo)
if (m_contextPane) {
Node *newNode = m_semanticInfo.declaringMemberNoProperties(position());
if (newNode) {
m_contextPane->apply(editableInterface(), semanticInfo.document, LookupContext::Ptr(), newNode, true);
m_contextPane->apply(editor(), semanticInfo.document, LookupContext::Ptr(), newNode, true);
m_cursorPositionTimer->start(); //update text marker
}
}
@@ -1501,17 +1501,17 @@ void QmlJSTextEditor::updateSemanticInfo(const SemanticInfo &semanticInfo)
setExtraSelections(CodeWarningsSelection, selections);
}
void QmlJSTextEditor::onRefactorMarkerClicked(const TextEditor::RefactorMarker &)
void QmlJSTextEditorWidget::onRefactorMarkerClicked(const TextEditor::RefactorMarker &)
{
showContextPane();
}
void QmlJSTextEditor::onCursorPositionChanged()
void QmlJSTextEditorWidget::onCursorPositionChanged()
{
m_cursorPositionTimer->start();
}
QModelIndex QmlJSTextEditor::indexForPosition(unsigned cursorPosition, const QModelIndex &rootIndex) const
QModelIndex QmlJSTextEditorWidget::indexForPosition(unsigned cursorPosition, const QModelIndex &rootIndex) const
{
QModelIndex lastIndex = rootIndex;
@@ -1535,16 +1535,16 @@ QModelIndex QmlJSTextEditor::indexForPosition(unsigned cursorPosition, const QMo
return lastIndex;
}
bool QmlJSTextEditor::hideContextPane()
bool QmlJSTextEditorWidget::hideContextPane()
{
bool b = (m_contextPane) && m_contextPane->widget()->isVisible();
if (b) {
m_contextPane->apply(editableInterface(), semanticInfo().document, LookupContext::Ptr(), 0, false);
m_contextPane->apply(editor(), semanticInfo().document, LookupContext::Ptr(), 0, false);
}
return b;
}
QVector<QString> QmlJSTextEditor::highlighterFormatCategories()
QVector<QString> QmlJSTextEditorWidget::highlighterFormatCategories()
{
/*
NumberFormat,
@@ -1568,7 +1568,7 @@ QVector<QString> QmlJSTextEditor::highlighterFormatCategories()
return categories;
}
SemanticHighlighterSource QmlJSTextEditor::currentSource(bool force)
SemanticHighlighterSource QmlJSTextEditorWidget::currentSource(bool force)
{
int line = 0, column = 0;
convertPosition(position(), &line, &column);

View File

@@ -137,13 +137,13 @@ private:
friend class Internal::SemanticHighlighter;
};
class QMLJSEDITOR_EXPORT QmlJSTextEditor : public TextEditor::BaseTextEditor
class QMLJSEDITOR_EXPORT QmlJSTextEditorWidget : public TextEditor::BaseTextEditorWidget
{
Q_OBJECT
public:
QmlJSTextEditor(QWidget *parent = 0);
~QmlJSTextEditor();
QmlJSTextEditorWidget(QWidget *parent = 0);
~QmlJSTextEditorWidget();
virtual void unCommentSelection();
@@ -205,9 +205,9 @@ protected:
void wheelEvent(QWheelEvent *event);
void resizeEvent(QResizeEvent *event);
void scrollContentsBy(int dx, int dy);
TextEditor::BaseTextEditorEditable *createEditableInterface();
TextEditor::BaseTextEditor *createEditor();
void createToolBar(QmlJSEditorEditable *editable);
TextEditor::BaseTextEditor::Link findLinkAt(const QTextCursor &cursor, bool resolveTarget = true);
TextEditor::BaseTextEditorWidget::Link findLinkAt(const QTextCursor &cursor, bool resolveTarget = true);
private:
bool isClosingBrace(const QList<QmlJS::Token> &tokens) const;

View File

@@ -47,8 +47,8 @@
namespace QmlJSEditor {
QmlJSEditorEditable::QmlJSEditorEditable(QmlJSTextEditor *editor)
: BaseTextEditorEditable(editor)
QmlJSEditorEditable::QmlJSEditorEditable(QmlJSTextEditorWidget *editor)
: BaseTextEditor(editor)
{
m_context.add(QmlJSEditor::Constants::C_QMLJSEDITOR_ID);
m_context.add(TextEditor::Constants::C_TEXTEDITOR);
@@ -87,7 +87,7 @@ QString QmlJSEditorEditable::preferredModeType() const
// if we are in other mode than edit or design, use the hard-coded default.
// because the editor opening decision is modal, it would be confusing to
// have the user also access to this failsafe setting.
if (editor()->mimeType() == QLatin1String(QmlJSEditor::Constants::QML_MIMETYPE)
if (editorWidget()->mimeType() == QLatin1String(QmlJSEditor::Constants::QML_MIMETYPE)
&& openInDesignMode())
return QLatin1String(Core::Constants::MODE_DESIGN_TYPE);
return QString();
@@ -97,7 +97,7 @@ void QmlJSEditorEditable::setTextCodec(QTextCodec *codec, TextCodecReason reason
{
if (reason != TextCodecOtherReason) // qml is defined to be utf8
return;
editor()->setTextCodec(codec);
editorWidget()->setTextCodec(codec);
}
} // namespace QmlJSEditor

View File

@@ -38,14 +38,14 @@
#include <texteditor/basetexteditor.h>
namespace QmlJSEditor {
class QmlJSTextEditor;
class QmlJSTextEditorWidget;
class QMLJSEDITOR_EXPORT QmlJSEditorEditable : public TextEditor::BaseTextEditorEditable
class QMLJSEDITOR_EXPORT QmlJSEditorEditable : public TextEditor::BaseTextEditor
{
Q_OBJECT
public:
explicit QmlJSEditorEditable(QmlJSTextEditor *);
explicit QmlJSEditorEditable(QmlJSTextEditorWidget *);
Core::Context context() const;
bool duplicateSupported() const { return true; }

View File

@@ -130,9 +130,9 @@ Core::IEditor *QmlJSEditorFactory::createEditor(QWidget *parent)
SLOT(updateEditorInfoBar(Core::IEditor*)));
}
}
QmlJSEditor::QmlJSTextEditor *rc = new QmlJSEditor::QmlJSTextEditor(parent);
QmlJSEditor::QmlJSTextEditorWidget *rc = new QmlJSEditor::QmlJSTextEditorWidget(parent);
QmlJSEditorPlugin::instance()->initializeEditor(rc);
return rc->editableInterface();
return rc->editor();
}
QStringList QmlJSEditorFactory::mimeTypes() const

View File

@@ -264,7 +264,7 @@ ExtensionSystem::IPlugin::ShutdownFlag QmlJSEditorPlugin::aboutToShutdown()
return IPlugin::aboutToShutdown();
}
void QmlJSEditorPlugin::initializeEditor(QmlJSEditor::QmlJSTextEditor *editor)
void QmlJSEditorPlugin::initializeEditor(QmlJSEditor::QmlJSTextEditorWidget *editor)
{
QTC_ASSERT(m_instance, /**/);
@@ -277,14 +277,14 @@ void QmlJSEditorPlugin::followSymbolUnderCursor()
{
Core::EditorManager *em = Core::EditorManager::instance();
if (QmlJSTextEditor *editor = qobject_cast<QmlJSTextEditor*>(em->currentEditor()->widget()))
if (QmlJSTextEditorWidget *editor = qobject_cast<QmlJSTextEditorWidget*>(em->currentEditor()->widget()))
editor->followSymbolUnderCursor();
}
void QmlJSEditorPlugin::findUsages()
{
Core::EditorManager *em = Core::EditorManager::instance();
if (QmlJSTextEditor *editor = qobject_cast<QmlJSTextEditor*>(em->currentEditor()->widget()))
if (QmlJSTextEditorWidget *editor = qobject_cast<QmlJSTextEditorWidget*>(em->currentEditor()->widget()))
editor->findUsages();
}
@@ -292,7 +292,7 @@ void QmlJSEditorPlugin::showContextPane()
{
Core::EditorManager *em = Core::EditorManager::instance();
if (QmlJSTextEditor *editor = qobject_cast<QmlJSTextEditor*>(em->currentEditor()->widget()))
if (QmlJSTextEditorWidget *editor = qobject_cast<QmlJSTextEditorWidget*>(em->currentEditor()->widget()))
editor->showContextPane();
}
@@ -311,7 +311,7 @@ Core::Command *QmlJSEditorPlugin::addToolAction(QAction *a, Core::ActionManager
QmlJSQuickFixCollector *QmlJSEditorPlugin::quickFixCollector() const
{ return m_quickFixCollector; }
void QmlJSEditorPlugin::quickFix(TextEditor::ITextEditable *editable)
void QmlJSEditorPlugin::quickFix(TextEditor::ITextEditor *editable)
{
m_currentTextEditable = editable;
quickFixNow();
@@ -323,9 +323,9 @@ void QmlJSEditorPlugin::quickFixNow()
return;
Core::EditorManager *em = Core::EditorManager::instance();
QmlJSTextEditor *currentEditor = qobject_cast<QmlJSTextEditor*>(em->currentEditor()->widget());
QmlJSTextEditorWidget *currentEditor = qobject_cast<QmlJSTextEditorWidget*>(em->currentEditor()->widget());
if (QmlJSTextEditor *editor = qobject_cast<QmlJSTextEditor*>(m_currentTextEditable->widget())) {
if (QmlJSTextEditorWidget *editor = qobject_cast<QmlJSTextEditorWidget*>(m_currentTextEditable->widget())) {
if (currentEditor == editor) {
if (editor->isOutdated()) {
// qDebug() << "TODO: outdated document" << editor->editorRevision() << editor->semanticInfo().revision();
@@ -344,7 +344,7 @@ void QmlJSEditorPlugin::currentEditorChanged(Core::IEditor *editor)
if (! editor)
return;
else if (QmlJSTextEditor *textEditor = qobject_cast<QmlJSTextEditor *>(editor->widget())) {
else if (QmlJSTextEditorWidget *textEditor = qobject_cast<QmlJSTextEditorWidget *>(editor->widget())) {
textEditor->forceSemanticRehighlight();
}
}

View File

@@ -53,7 +53,7 @@ class IEditor;
}
namespace TextEditor {
class ITextEditable;
class ITextEditor;
}
namespace QmlJS {
@@ -63,7 +63,7 @@ namespace QmlJS {
namespace QmlJSEditor {
class QmlFileWizard;
class QmlJSTextEditor;
class QmlJSTextEditorWidget;
namespace Internal {
@@ -90,7 +90,7 @@ public:
QmlJSQuickFixCollector *quickFixCollector() const;
void initializeEditor(QmlJSEditor::QmlJSTextEditor *editor);
void initializeEditor(QmlJSEditor::QmlJSTextEditorWidget *editor);
public Q_SLOTS:
void followSymbolUnderCursor();
@@ -98,7 +98,7 @@ public Q_SLOTS:
void showContextPane();
private Q_SLOTS:
void quickFix(TextEditor::ITextEditable *editable);
void quickFix(TextEditor::ITextEditor *editable);
void quickFixNow();
void currentEditorChanged(Core::IEditor *editor);
@@ -119,7 +119,7 @@ private:
QmlJSQuickFixCollector *m_quickFixCollector;
QTimer *m_quickFixTimer;
QPointer<TextEditor::ITextEditable> m_currentTextEditable;
QPointer<TextEditor::ITextEditor> m_currentTextEditable;
QmlTaskManager *m_qmlTaskManager;
};

View File

@@ -680,7 +680,7 @@ void FindReferences::searchFinished()
void FindReferences::openEditor(const Find::SearchResultItem &item)
{
if (item.path.size() > 0) {
TextEditor::BaseTextEditor::openEditorAt(item.path.first(), item.lineNumber, item.textMarkPos,
TextEditor::BaseTextEditorWidget::openEditorAt(item.path.first(), item.lineNumber, item.textMarkPos,
QString(),
Core::EditorManager::ModeSwitch);
} else {

View File

@@ -109,7 +109,7 @@ void HoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos)
if (!m_modelManager)
return;
QmlJSEditor::QmlJSTextEditor *qmlEditor = qobject_cast<QmlJSEditor::QmlJSTextEditor *>(editor->widget());
QmlJSEditor::QmlJSTextEditorWidget *qmlEditor = qobject_cast<QmlJSEditor::QmlJSTextEditorWidget *>(editor->widget());
if (!qmlEditor)
return;
@@ -138,10 +138,10 @@ void HoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos)
setLastHelpItemIdentified(helpItem);
}
bool HoverHandler::matchDiagnosticMessage(QmlJSEditor::QmlJSTextEditor *qmlEditor, int pos)
bool HoverHandler::matchDiagnosticMessage(QmlJSEditor::QmlJSTextEditorWidget *qmlEditor, int pos)
{
foreach (const QTextEdit::ExtraSelection &sel,
qmlEditor->extraSelections(TextEditor::BaseTextEditor::CodeWarningsSelection)) {
qmlEditor->extraSelections(TextEditor::BaseTextEditorWidget::CodeWarningsSelection)) {
if (pos >= sel.cursor.selectionStart() && pos <= sel.cursor.selectionEnd()) {
setToolTip(sel.format.toolTip());
return true;

View File

@@ -53,7 +53,7 @@ class ITextEditor;
}
namespace QmlJSEditor {
class QmlJSTextEditor;
class QmlJSTextEditorWidget;
namespace Internal {
@@ -72,7 +72,7 @@ private:
virtual void identifyMatch(TextEditor::ITextEditor *editor, int pos);
virtual void operateTooltip(TextEditor::ITextEditor *editor, const QPoint &point);
bool matchDiagnosticMessage(QmlJSEditor::QmlJSTextEditor *qmlEditor, int pos);
bool matchDiagnosticMessage(QmlJSEditor::QmlJSTextEditorWidget *qmlEditor, int pos);
bool matchColorItem(const QmlJS::LookupContext::Ptr &lookupContext,
const QmlJS::Document::Ptr &qmlDocument,
const QList<QmlJS::AST::Node *> &astPath,

View File

@@ -64,7 +64,7 @@ bool Indenter::isElectricCharacter(const QChar &ch) const
void Indenter::indentBlock(QTextDocument *doc,
const QTextBlock &block,
const QChar &typedChar,
TextEditor::BaseTextEditor *editor)
TextEditor::BaseTextEditorWidget *editor)
{
Q_UNUSED(doc)
Q_UNUSED(editor)

View File

@@ -49,7 +49,7 @@ public:
virtual void indentBlock(QTextDocument *doc,
const QTextBlock &block,
const QChar &typedChar,
TextEditor::BaseTextEditor *editor);
TextEditor::BaseTextEditorWidget *editor);
};
} // Internal

View File

@@ -125,7 +125,7 @@ QmlJSOutlineWidget::QmlJSOutlineWidget(QWidget *parent) :
setLayout(layout);
}
void QmlJSOutlineWidget::setEditor(QmlJSTextEditor *editor)
void QmlJSOutlineWidget::setEditor(QmlJSTextEditorWidget *editor)
{
m_editor = editor;
@@ -257,7 +257,7 @@ TextEditor::IOutlineWidget *QmlJSOutlineWidgetFactory::createWidget(Core::IEdito
QmlJSOutlineWidget *widget = new QmlJSOutlineWidget;
QmlJSEditorEditable *qmlJSEditable = qobject_cast<QmlJSEditorEditable*>(editor);
QmlJSTextEditor *qmlJSEditor = qobject_cast<QmlJSTextEditor*>(qmlJSEditable->widget());
QmlJSTextEditorWidget *qmlJSEditor = qobject_cast<QmlJSTextEditorWidget*>(qmlJSEditable->widget());
Q_ASSERT(qmlJSEditor);
widget->setEditor(qmlJSEditor);

View File

@@ -75,7 +75,7 @@ class QmlJSOutlineWidget : public TextEditor::IOutlineWidget
public:
QmlJSOutlineWidget(QWidget *parent = 0);
void setEditor(QmlJSTextEditor *editor);
void setEditor(QmlJSTextEditorWidget *editor);
// IOutlineWidget
virtual QList<QAction*> filterMenuActions() const;
@@ -96,7 +96,7 @@ private:
private:
QmlJSOutlineTreeView *m_treeView;
QmlJSOutlineFilterModel *m_filterModel;
QmlJSTextEditor *m_editor;
QmlJSTextEditorWidget *m_editor;
QAction *m_showBindingsAction;

View File

@@ -51,7 +51,7 @@ using namespace QmlJSTools;
using namespace TextEditor;
using TextEditor::RefactoringChanges;
QmlJSQuickFixState::QmlJSQuickFixState(TextEditor::BaseTextEditor *editor)
QmlJSQuickFixState::QmlJSQuickFixState(TextEditor::BaseTextEditorWidget *editor)
: QuickFixState(editor)
{
}
@@ -141,9 +141,9 @@ QmlJSQuickFixCollector::~QmlJSQuickFixCollector()
{
}
bool QmlJSQuickFixCollector::supportsEditor(TextEditor::ITextEditable *editable) const
bool QmlJSQuickFixCollector::supportsEditor(TextEditor::ITextEditor *editable) const
{
return qobject_cast<QmlJSTextEditor *>(editable->widget()) != 0;
return qobject_cast<QmlJSTextEditorWidget *>(editable->widget()) != 0;
}
bool QmlJSQuickFixCollector::supportsPolicy(TextEditor::CompletionPolicy policy) const
@@ -151,9 +151,9 @@ bool QmlJSQuickFixCollector::supportsPolicy(TextEditor::CompletionPolicy policy)
return policy == TextEditor::QuickFixCompletion;
}
TextEditor::QuickFixState *QmlJSQuickFixCollector::initializeCompletion(TextEditor::BaseTextEditor *editor)
TextEditor::QuickFixState *QmlJSQuickFixCollector::initializeCompletion(TextEditor::BaseTextEditorWidget *editor)
{
if (QmlJSTextEditor *qmljsEditor = qobject_cast<QmlJSTextEditor *>(editor)) {
if (QmlJSTextEditorWidget *qmljsEditor = qobject_cast<QmlJSTextEditorWidget *>(editor)) {
const SemanticInfo info = qmljsEditor->semanticInfo();
if (! info.isValid() || qmljsEditor->isOutdated()) {

View File

@@ -67,7 +67,7 @@ class QmlJSQuickFixState: public TextEditor::QuickFixState
public:
/// Creates a new state for the given editor.
QmlJSQuickFixState(TextEditor::BaseTextEditor *editor);
QmlJSQuickFixState(TextEditor::BaseTextEditorWidget *editor);
SemanticInfo semanticInfo() const;
@@ -152,9 +152,9 @@ public:
QmlJSQuickFixCollector();
virtual ~QmlJSQuickFixCollector();
virtual bool supportsEditor(TextEditor::ITextEditable *editor) const;
virtual bool supportsEditor(TextEditor::ITextEditor *editor) const;
virtual bool supportsPolicy(TextEditor::CompletionPolicy policy) const;
virtual TextEditor::QuickFixState *initializeCompletion(TextEditor::BaseTextEditor *editor);
virtual TextEditor::QuickFixState *initializeCompletion(TextEditor::BaseTextEditorWidget *editor);
virtual QList<TextEditor::QuickFixFactory *> quickFixFactories() const;

View File

@@ -66,11 +66,11 @@ QString QmlJSSnippetProvider::displayName() const
return QCoreApplication::translate("QmlJSEditor::Internal::QmlJSSnippetProvider", "QML");
}
void QmlJSSnippetProvider::decorateEditor(TextEditor::SnippetEditor *editor) const
void QmlJSSnippetProvider::decorateEditor(TextEditor::SnippetEditorWidget *editor) const
{
Highlighter *highlighter = new Highlighter;
const TextEditor::FontSettings &fs = TextEditor::TextEditorSettings::instance()->fontSettings();
highlighter->setFormats(fs.toTextCharFormats(QmlJSTextEditor::highlighterFormatCategories()));
highlighter->setFormats(fs.toTextCharFormats(QmlJSTextEditorWidget::highlighterFormatCategories()));
editor->setSyntaxHighlighter(highlighter);
editor->setIndenter(new Indenter);
editor->setAutoCompleter(new AutoCompleter);

View File

@@ -48,7 +48,7 @@ public:
public:
virtual QString groupId() const;
virtual QString displayName() const;
virtual void decorateEditor(TextEditor::SnippetEditor *editor) const;
virtual void decorateEditor(TextEditor::SnippetEditorWidget *editor) const;
};
} // Internal

View File

@@ -273,7 +273,7 @@ private:
int indent;
};
QmlOutlineModel::QmlOutlineModel(QmlJSTextEditor *editor) :
QmlOutlineModel::QmlOutlineModel(QmlJSTextEditorWidget *editor) :
QStandardItemModel(editor),
m_textEditor(editor)
{

View File

@@ -88,7 +88,7 @@ public:
NonElementBindingType // can be filtered out
};
QmlOutlineModel(QmlJSTextEditor *editor);
QmlOutlineModel(QmlJSTextEditorWidget *editor);
// QStandardItemModel
QStringList mimeTypes() const;
@@ -157,7 +157,7 @@ private:
QHash<QmlOutlineItem*,QIcon> m_itemToIcon;
QHash<QmlOutlineItem*,QmlJS::AST::Node*> m_itemToNode;
QHash<QmlOutlineItem*,QmlJS::AST::UiQualifiedId*> m_itemToIdNode;
QmlJSTextEditor *m_textEditor;
QmlJSTextEditorWidget *m_textEditor;
friend class QmlOutlineModelSync;

View File

@@ -130,7 +130,7 @@ QuickToolBar::~QuickToolBar()
m_widget.clear();
}
void QuickToolBar::apply(TextEditor::BaseTextEditorEditable *editor, Document::Ptr document, LookupContext::Ptr lookupContext, AST::Node *node, bool update, bool force)
void QuickToolBar::apply(TextEditor::BaseTextEditor *editor, Document::Ptr document, LookupContext::Ptr lookupContext, AST::Node *node, bool update, bool force)
{
if (!QuickToolBarSettings::get().enableContextPane && !force && !update) {
contextWidget()->hide();
@@ -209,7 +209,7 @@ void QuickToolBar::apply(TextEditor::BaseTextEditorEditable *editor, Document::P
QRegion reg;
if (line1 > -1 && line2 > -1)
reg = m_editor->editor()->translatedLineRegion(line1 - 1, line2);
reg = m_editor->editorWidget()->translatedLineRegion(line1 - 1, line2);
QRect rect;
rect.setHeight(widget()->height() + 10);
@@ -220,15 +220,15 @@ void QuickToolBar::apply(TextEditor::BaseTextEditorEditable *editor, Document::P
if (contextWidget()->acceptsType(m_prototypes)) {
m_node = 0;
PropertyReader propertyReader(document, initializer);
QTextCursor tc(editor->editor()->document());
QTextCursor tc(editor->editorWidget()->document());
tc.setPosition(offset);
QPoint p1 = editor->editor()->mapToParent(editor->editor()->viewport()->mapToParent(editor->editor()->cursorRect(tc).topLeft()) - QPoint(0, contextWidget()->height() + 10));
QPoint p1 = editor->editorWidget()->mapToParent(editor->editorWidget()->viewport()->mapToParent(editor->editorWidget()->cursorRect(tc).topLeft()) - QPoint(0, contextWidget()->height() + 10));
tc.setPosition(end);
QPoint p2 = editor->editor()->mapToParent(editor->editor()->viewport()->mapToParent(editor->editor()->cursorRect(tc).bottomLeft()) + QPoint(0, 10));
QPoint p2 = editor->editorWidget()->mapToParent(editor->editorWidget()->viewport()->mapToParent(editor->editorWidget()->cursorRect(tc).bottomLeft()) + QPoint(0, 10));
QPoint offset = QPoint(10, 0);
if (reg.boundingRect().width() < 400)
offset = QPoint(400 - reg.boundingRect().width() + 10 ,0);
QPoint p3 = editor->editor()->mapToParent(editor->editor()->viewport()->mapToParent(reg.boundingRect().topRight()) + offset);
QPoint p3 = editor->editorWidget()->mapToParent(editor->editorWidget()->viewport()->mapToParent(reg.boundingRect().topRight()) + offset);
p2.setX(p1.x());
contextWidget()->setType(m_prototypes);
if (!update)
@@ -255,7 +255,7 @@ void QuickToolBar::apply(TextEditor::BaseTextEditorEditable *editor, Document::P
}
bool QuickToolBar::isAvailable(TextEditor::BaseTextEditorEditable *, Document::Ptr document, AST::Node *node)
bool QuickToolBar::isAvailable(TextEditor::BaseTextEditor *, Document::Ptr document, AST::Node *node)
{
if (document.isNull())
return false;
@@ -330,7 +330,7 @@ void QuickToolBar::setProperty(const QString &propertyName, const QVariant &valu
int changeSetPos = changeSet.operationList().last().pos1;
int changeSetLength = changeSet.operationList().last().text.length();
QTextCursor tc = m_editor->editor()->textCursor();
QTextCursor tc = m_editor->editorWidget()->textCursor();
tc.beginEditBlock();
changeSet.apply(&tc);
@@ -338,17 +338,17 @@ void QuickToolBar::setProperty(const QString &propertyName, const QVariant &valu
m_editor->convertPosition(changeSetPos + changeSetLength, &endLine, &column); //get line
if (line > 0) {
TextEditor::TabSettings ts = m_editor->editor()->tabSettings();
TextEditor::TabSettings ts = m_editor->editorWidget()->tabSettings();
QmlJSIndenter indenter;
indenter.setTabSize(ts.m_tabSize);
indenter.setIndentSize(ts.m_indentSize);
for (int i=line;i<=endLine;i++) {
QTextBlock start = m_editor->editor()->document()->findBlockByNumber(i);
QTextBlock end = m_editor->editor()->document()->findBlockByNumber(i);
QTextBlock start = m_editor->editorWidget()->document()->findBlockByNumber(i);
QTextBlock end = m_editor->editorWidget()->document()->findBlockByNumber(i);
if (end.isValid()) {
const int indent = indenter.indentForBottomLine(m_editor->editor()->document()->begin(), end.next(), QChar::Null);
const int indent = indenter.indentForBottomLine(m_editor->editorWidget()->document()->begin(), end.next(), QChar::Null);
ts.indentLine(start, indent);
}
}
@@ -374,7 +374,7 @@ void QuickToolBar::removeProperty(const QString &propertyName)
Utils::ChangeSet changeSet;
Rewriter rewriter(m_doc->source(), &changeSet, m_propertyOrder);
rewriter.removeBindingByName(initializer, propertyName);
QTextCursor tc(m_editor->editor()->document());
QTextCursor tc(m_editor->editorWidget()->document());
changeSet.apply(&tc);
}
}
@@ -414,7 +414,7 @@ void QuickToolBar::onPropertyRemovedAndChange(const QString &remove, const QStri
if (!m_doc)
return;
QTextCursor tc(m_editor->editor()->document());
QTextCursor tc(m_editor->editorWidget()->document());
tc.beginEditBlock();
if (removeFirst) {

View File

@@ -37,7 +37,7 @@
#include <qmljs/qmljsicontextpane.h>
namespace TextEditor {
class BaseTextEditorEditable;
class BaseTextEditor;
}
namespace QmlEditorWidgets {
@@ -53,8 +53,8 @@ class QuickToolBar : public QmlJS::IContextPane
public:
QuickToolBar(QObject *parent = 0);
~QuickToolBar();
void apply(TextEditor::BaseTextEditorEditable *editor, QmlJS::Document::Ptr document, QmlJS::LookupContext::Ptr lookupContext, QmlJS::AST::Node *node, bool update, bool force = false);
bool isAvailable(TextEditor::BaseTextEditorEditable *editor, QmlJS::Document::Ptr document, QmlJS::AST::Node *node);
void apply(TextEditor::BaseTextEditor *editor, QmlJS::Document::Ptr document, QmlJS::LookupContext::Ptr lookupContext, QmlJS::AST::Node *node, bool update, bool force = false);
bool isAvailable(TextEditor::BaseTextEditor *editor, QmlJS::Document::Ptr document, QmlJS::AST::Node *node);
void setProperty(const QString &propertyName, const QVariant &value);
void removeProperty(const QString &propertyName);
void setEnabled(bool);
@@ -72,7 +72,7 @@ private:
QWeakPointer<QmlEditorWidgets::ContextPaneWidget> m_widget;
QmlJS::Document::Ptr m_doc;
QmlJS::AST::Node *m_node;
TextEditor::BaseTextEditorEditable *m_editor;
TextEditor::BaseTextEditor *m_editor;
bool m_blockWriting;
QStringList m_propertyOrder;
QStringList m_prototypes;