Commit 1adab4c4 authored by Eike Ziller's avatar Eike Ziller
Browse files

Merge BaseTextEditorWidget::editorDocument() and ::baseTextDocument()



Doesn't really make sense to have the additional IDocument *editorDocument()
method.

Change-Id: I0a7420eb1afaa76f63c3f7e9c4b373acf624ffb9
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent e035ae6d
......@@ -713,7 +713,7 @@ void AndroidManifestEditorWidget::updateSdkVersions()
void AndroidManifestEditorWidget::updateInfoBar(const QString &errorMessage, int line, int column)
{
Core::InfoBar *infoBar = editorDocument()->infoBar();
Core::InfoBar *infoBar = baseTextDocument()->infoBar();
QString text;
if (line < 0)
text = tr("Could not parse file: '%1'.").arg(errorMessage);
......@@ -731,7 +731,7 @@ void AndroidManifestEditorWidget::updateInfoBar(const QString &errorMessage, int
void AndroidManifestEditorWidget::hideInfoBar()
{
Core::InfoBar *infoBar = editorDocument()->infoBar();
Core::InfoBar *infoBar = baseTextDocument()->infoBar();
infoBar->removeInfo(infoBarId);
m_timerParseCheck.stop();
}
......
......@@ -201,7 +201,7 @@ CMakeEditorWidget::Link CMakeEditorWidget::findLinkAt(const QTextCursor &cursor,
// TODO: Resolve variables
QDir dir(QFileInfo(editorDocument()->filePath()).absolutePath());
QDir dir(QFileInfo(baseTextDocument()->filePath()).absolutePath());
QString fileName = dir.filePath(buffer);
QFileInfo fi(fileName);
if (fi.exists()) {
......
......@@ -1077,7 +1077,7 @@ void CPPEditorWidget::updateOutlineNow()
return;
const Snapshot snapshot = m_modelManager->snapshot();
Document::Ptr document = snapshot.document(editorDocument()->filePath());
Document::Ptr document = snapshot.document(baseTextDocument()->filePath());
if (!document)
return;
......@@ -1672,7 +1672,7 @@ void CPPEditorWidget::updateSemanticInfo(const SemanticInfo &semanticInfo)
// We can use the semanticInfo's snapshot (and avoid locking), but not its
// document, since it doesn't contain expanded macros.
LookupContext context(semanticInfo.snapshot.document(editorDocument()->filePath()),
LookupContext context(semanticInfo.snapshot.document(baseTextDocument()->filePath()),
semanticInfo.snapshot);
SemanticInfo::LocalUseIterator it(semanticInfo.localUses);
......@@ -1841,7 +1841,7 @@ void CPPEditorWidget::onFunctionDeclDefLinkFound(QSharedPointer<FunctionDeclDefL
m_declDefLink = link;
Core::IDocument *targetDocument = Core::EditorManager::documentModel()->documentForFilePath(
m_declDefLink->targetFile->fileName());
if (editorDocument() != targetDocument) {
if (baseTextDocument() != targetDocument) {
if (TextEditor::BaseTextDocument *baseTextDocument = qobject_cast<TextEditor::BaseTextDocument *>(targetDocument))
connect(baseTextDocument->document(), SIGNAL(contentsChanged()),
this, SLOT(abortDeclDefLink()));
......@@ -1876,7 +1876,7 @@ void CPPEditorWidget::abortDeclDefLink()
Core::IDocument *targetDocument = Core::EditorManager::documentModel()->documentForFilePath(
m_declDefLink->targetFile->fileName());
if (editorDocument() != targetDocument) {
if (baseTextDocument() != targetDocument) {
if (TextEditor::BaseTextDocument *baseTextDocument = qobject_cast<TextEditor::BaseTextDocument *>(targetDocument))
disconnect(baseTextDocument->document(), SIGNAL(contentsChanged()),
this, SLOT(abortDeclDefLink()));
......
......@@ -85,7 +85,7 @@ void CppElementEvaluator::execute()
return;
const Snapshot &snapshot = m_modelManager->snapshot();
Document::Ptr doc = snapshot.document(m_editor->editorDocument()->filePath());
Document::Ptr doc = snapshot.document(m_editor->baseTextDocument()->filePath());
if (!doc)
return;
......
......@@ -544,7 +544,7 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
}
// Now we prefer the doc from the snapshot with macros expanded.
Document::Ptr doc = snapshot.document(m_widget->editorDocument()->filePath());
Document::Ptr doc = snapshot.document(m_widget->baseTextDocument()->filePath());
if (!doc) {
doc = documentFromSemanticInfo;
if (!doc)
......@@ -639,7 +639,7 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
if (Symbol *d = r.declaration()) {
if (d->isDeclaration() || d->isFunction()) {
const QString fileName = QString::fromUtf8(d->fileName(), d->fileNameLength());
if (m_widget->editorDocument()->filePath() == fileName) {
if (m_widget->baseTextDocument()->filePath() == fileName) {
if (unsigned(lineNumber) == d->line()
&& unsigned(positionInBlock) >= d->column()) { // TODO: check the end
result = r; // take the symbol under cursor.
......
......@@ -142,12 +142,12 @@ void CppIncludeHierarchyWidget::perform()
return;
m_model->clear();
m_model->buildHierarchy(m_editor, widget->editorDocument()->filePath());
m_model->buildHierarchy(m_editor, widget->baseTextDocument()->filePath());
if (m_model->isEmpty())
return;
m_inspectedFile->setup(widget->editorDocument()->displayName(),
widget->editorDocument()->filePath());
m_inspectedFile->setup(widget->baseTextDocument()->displayName(),
widget->baseTextDocument()->filePath());
//expand "Includes"
m_treeView->expand(m_model->index(0, 0));
......
......@@ -87,7 +87,7 @@ const IAssistProvider *CppQuickFixAssistProcessor::provider() const
CppQuickFixAssistInterface::CppQuickFixAssistInterface(CPPEditorWidget *editor,
TextEditor::AssistReason reason)
: DefaultAssistInterface(editor->document(), editor->position(),
editor->editorDocument()->filePath(), reason)
editor->baseTextDocument()->filePath(), reason)
, m_editor(editor)
, m_semanticInfo(editor->semanticInfo())
, m_snapshot(CppTools::CppModelManagerInterface::instance()->snapshot())
......
......@@ -436,8 +436,7 @@ void InvokeCompletionTokenAction::run(CPPEditorWidget *editorWidget)
// editorWidget->setFocus();
QApplication::processEvents();
BaseTextDocument *doc = qobject_cast<BaseTextDocument *>(editorWidget->editorDocument());
TestActionsTestCase::undoChangesInDocument(doc);
TestActionsTestCase::undoChangesInDocument(editorWidget->baseTextDocument());
}
class RunAllQuickFixesTokenAction : public TestActionsTestCase::AbstractAction
......
......@@ -101,7 +101,7 @@ public:
QStringList completions;
CppCompletionAssistInterface *ai
= new CppCompletionAssistInterface(editorWidget->document(), position,
editorWidget->editorDocument()->filePath(),
editorWidget->baseTextDocument()->filePath(),
ExplicitlyInvoked, snapshot,
QStringList(), QStringList());
CppCompletionAssistProcessor processor;
......
......@@ -713,7 +713,7 @@ void QmlLiveTextPreview::showSyncWarning(
foreach (TextEditor::BaseTextEditorWidget *editor, m_editors) {
if (editor) {
Core::InfoBar *infoBar = editor->editorDocument()->infoBar();
Core::InfoBar *infoBar = editor->baseTextDocument()->infoBar();
Core::InfoBarEntry info(Core::Id(INFO_OUT_OF_SYNC), errorMessage);
BaseToolsClient *toolsClient = m_inspectorAdapter->toolsClient();
if (toolsClient && toolsClient->supportReload())
......@@ -734,7 +734,7 @@ void QmlLiveTextPreview::removeOutofSyncInfo()
{
foreach (TextEditor::BaseTextEditorWidget *editor, m_editors) {
if (editor) {
Core::InfoBar *infoBar = editor->editorDocument()->infoBar();
Core::InfoBar *infoBar = editor->baseTextDocument()->infoBar();
infoBar->removeInfo(Core::Id(INFO_OUT_OF_SYNC));
}
}
......
......@@ -39,7 +39,6 @@ class QDesignerFormWindowInterface;
QT_END_NAMESPACE
namespace TextEditor {
class BaseTextDocument;
class PlainTextEditor;
}
......
......@@ -278,9 +278,9 @@ void GitEditor::init()
VcsBase::VcsBaseEditorWidget::init();
Core::Id editorId = editor()->id();
if (editorId == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID)
new GitSubmitHighlighter(baseTextDocument().data());
new GitSubmitHighlighter(baseTextDocument());
else if (editorId == Git::Constants::GIT_REBASE_EDITOR_ID)
new GitRebaseHighlighter(baseTextDocument().data());
new GitRebaseHighlighter(baseTextDocument());
}
void GitEditor::addDiffActions(QMenu *menu, const VcsBase::DiffChunk &chunk)
......
......@@ -157,7 +157,7 @@ GLSLTextEditorWidget::GLSLTextEditorWidget(QWidget *parent) :
connect(this, SIGNAL(textChanged()), this, SLOT(updateDocument()));
new Highlighter(baseTextDocument().data());
new Highlighter(baseTextDocument());
// if (m_modelManager) {
// m_semanticHighlighter->setModelManager(m_modelManager);
......
......@@ -59,7 +59,7 @@ EditorWidget::EditorWidget(QWidget *parent)
setCodeFoldingSupported(true);
setIndenter(new PythonIndenter());
new PythonHighlighter(baseTextDocument().data());
new PythonHighlighter(baseTextDocument());
}
EditorWidget::~EditorWidget()
......
......@@ -167,7 +167,7 @@ ProFileEditorWidget::Link ProFileEditorWidget::findLinkAt(const QTextCursor &cur
}
}
QDir dir(QFileInfo(editorDocument()->filePath()).absolutePath());
QDir dir(QFileInfo(baseTextDocument()->filePath()).absolutePath());
QString fileName = dir.filePath(buffer);
QFileInfo fi(fileName);
if (fi.exists()) {
......
......@@ -143,7 +143,7 @@ void QmakeManager::addLibrary()
ProFileEditorWidget *editor =
qobject_cast<ProFileEditorWidget*>(Core::EditorManager::currentEditor()->widget());
if (editor)
addLibrary(editor->editorDocument()->filePath(), editor);
addLibrary(editor->baseTextDocument()->filePath(), editor);
}
void QmakeManager::addLibraryContextMenu()
......
......@@ -610,7 +610,7 @@ void QmlJSTextEditorWidget::reparseDocumentNow()
{
m_updateDocumentTimer->stop();
const QString fileName = editorDocument()->filePath();
const QString fileName = baseTextDocument()->filePath();
m_modelManager->updateSourceFiles(QStringList() << fileName, false);
}
......@@ -652,7 +652,7 @@ static void appendExtraSelectionsForMessages(
void QmlJSTextEditorWidget::onDocumentUpdated(QmlJS::Document::Ptr doc)
{
if (editorDocument()->filePath() != doc->fileName())
if (baseTextDocument()->filePath() != doc->fileName())
return;
if (doc->editorRevision() != editorRevision()) {
......@@ -684,7 +684,7 @@ void QmlJSTextEditorWidget::onDocumentUpdated(QmlJS::Document::Ptr doc)
void QmlJSTextEditorWidget::modificationChanged(bool changed)
{
if (!changed && m_modelManager)
m_modelManager->fileChangedOnDisk(editorDocument()->filePath());
m_modelManager->fileChangedOnDisk(baseTextDocument()->filePath());
}
void QmlJSTextEditorWidget::jumpToOutlineElement(int /*index*/)
......@@ -1060,7 +1060,7 @@ void QmlJSTextEditorWidget::createToolBar(QmlJSEditor *editor)
connect(m_outlineCombo, SIGNAL(activated(int)), this, SLOT(jumpToOutlineElement(int)));
connect(this, SIGNAL(cursorPositionChanged()), m_updateOutlineIndexTimer, SLOT(start()));
connect(editorDocument(), SIGNAL(changed()), this, SLOT(updateFileName()));
connect(baseTextDocument(), SIGNAL(changed()), this, SLOT(updateFileName()));
editor->insertExtraToolBarWidget(TextEditor::BaseTextEditor::Left, m_outlineCombo);
}
......@@ -1150,12 +1150,12 @@ TextEditor::BaseTextEditorWidget::Link QmlJSTextEditorWidget::findLinkAt(const Q
void QmlJSTextEditorWidget::findUsages()
{
m_findReferences->findUsages(editorDocument()->filePath(), textCursor().position());
m_findReferences->findUsages(baseTextDocument()->filePath(), textCursor().position());
}
void QmlJSTextEditorWidget::renameUsages()
{
m_findReferences->renameUsages(editorDocument()->filePath(), textCursor().position());
m_findReferences->renameUsages(baseTextDocument()->filePath(), textCursor().position());
}
void QmlJSTextEditorWidget::showContextPane()
......
......@@ -48,7 +48,7 @@ using namespace Internal;
QmlJSQuickFixAssistInterface::QmlJSQuickFixAssistInterface(QmlJSTextEditorWidget *editor,
TextEditor::AssistReason reason)
: DefaultAssistInterface(editor->document(), editor->position(),
editor->editorDocument()->filePath(), reason)
editor->baseTextDocument()->filePath(), reason)
, m_editor(editor)
, m_semanticInfo(editor->semanticInfo())
, m_currentFile(QmlJSRefactoringChanges::file(m_editor, m_semanticInfo.document))
......
......@@ -568,7 +568,7 @@ void SemanticHighlighter::applyResults(int from, int to)
if (m_startRevision != m_editor->editorRevision())
return;
TextEditor::BaseTextDocument *baseTextDocument = m_editor->baseTextDocument().data();
TextEditor::BaseTextDocument *baseTextDocument = m_editor->baseTextDocument();
QTC_ASSERT(baseTextDocument, return);
TextEditor::SyntaxHighlighter *highlighter = qobject_cast<TextEditor::SyntaxHighlighter *>(baseTextDocument->syntaxHighlighter());
QTC_ASSERT(highlighter, return);
......@@ -584,7 +584,7 @@ void SemanticHighlighter::finished()
if (m_startRevision != m_editor->editorRevision())
return;
TextEditor::BaseTextDocument *baseTextDocument = m_editor->baseTextDocument().data();
TextEditor::BaseTextDocument *baseTextDocument = m_editor->baseTextDocument();
QTC_ASSERT(baseTextDocument, return);
TextEditor::SyntaxHighlighter *highlighter = qobject_cast<TextEditor::SyntaxHighlighter *>(baseTextDocument->syntaxHighlighter());
QTC_ASSERT(highlighter, return);
......
......@@ -220,7 +220,7 @@ TextEditor::BaseTextEditorWidget *BarDescriptorEditorWidget::sourceWidget() cons
void BarDescriptorEditorWidget::setFilePath(const QString &filePath)
{
Core::IDocument *doc = m_xmlSourceWidget->editorDocument();
Core::IDocument *doc = m_xmlSourceWidget->baseTextDocument();
if (doc) {
doc->setFilePath(filePath);
// setFilePath() call leads to a textChanged() signal emitted
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment