forked from qt-creator/qt-creator
Move openEditorAt from BaseTextEditorWidget to EditorManager
More sensible place, gotoLine is a method in IEditor anyhow. Change-Id: I420a6bf17060c16e6f1a4f45e0bef89379fb6bf8 Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
@@ -39,7 +39,7 @@
|
|||||||
#include <coreplugin/actionmanager/command.h>
|
#include <coreplugin/actionmanager/command.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
#include <texteditor/basetexteditor.h>
|
#include <texteditor/itexteditor.h>
|
||||||
#include <utils/tooltip/tooltip.h>
|
#include <utils/tooltip/tooltip.h>
|
||||||
#include <utils/tooltip/tipcontents.h>
|
#include <utils/tooltip/tipcontents.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -508,7 +508,7 @@ Bookmark *BookmarkManager::bookmarkForIndex(const QModelIndex &index)
|
|||||||
bool BookmarkManager::gotoBookmark(Bookmark *bookmark)
|
bool BookmarkManager::gotoBookmark(Bookmark *bookmark)
|
||||||
{
|
{
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
if (ITextEditor *editor = qobject_cast<ITextEditor *>(BaseTextEditorWidget::openEditorAt(bookmark->filePath(),
|
if (ITextEditor *editor = qobject_cast<ITextEditor *>(EditorManager::openEditorAt(bookmark->filePath(),
|
||||||
bookmark->lineNumber()))) {
|
bookmark->lineNumber()))) {
|
||||||
return (editor->currentLine() == bookmark->lineNumber());
|
return (editor->currentLine() == bookmark->lineNumber());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,6 @@
|
|||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
#include <texteditor/basetexteditor.h>
|
|
||||||
#include <cpptools/cppmodelmanagerinterface.h>
|
#include <cpptools/cppmodelmanagerinterface.h>
|
||||||
#include <cpptools/cpptoolsconstants.h>
|
#include <cpptools/cpptoolsconstants.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
@@ -287,10 +286,7 @@ void Manager::onDocumentUpdated(CPlusPlus::Document::Ptr doc)
|
|||||||
|
|
||||||
void Manager::gotoLocation(const QString &fileName, int line, int column)
|
void Manager::gotoLocation(const QString &fileName, int line, int column)
|
||||||
{
|
{
|
||||||
bool newEditor = false;
|
Core::EditorManager::openEditorAt(fileName, line, column);
|
||||||
TextEditor::BaseTextEditorWidget::openEditorAt(fileName, line, column, Core::Id(),
|
|
||||||
Core::EditorManager::IgnoreNavigationHistory,
|
|
||||||
&newEditor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Manager::gotoLocations(const QList<QVariant> &list)
|
void Manager::gotoLocations(const QList<QVariant> &list)
|
||||||
|
|||||||
@@ -1419,6 +1419,19 @@ IEditor *EditorManager::openEditor(const QString &fileName, const Id &editorId,
|
|||||||
fileName, editorId, flags, newEditor);
|
fileName, editorId, flags, newEditor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IEditor *EditorManager::openEditorAt(const QString &fileName, int line, int column,
|
||||||
|
const Id &editorId, OpenEditorFlags flags, bool *newEditor)
|
||||||
|
{
|
||||||
|
m_instance->cutForwardNavigationHistory();
|
||||||
|
m_instance->addCurrentPositionToNavigationHistory();
|
||||||
|
OpenEditorFlags tempFlags = flags | IgnoreNavigationHistory;
|
||||||
|
Core::IEditor *editor = Core::EditorManager::openEditor(fileName, editorId,
|
||||||
|
tempFlags, newEditor);
|
||||||
|
if (editor && line != -1)
|
||||||
|
editor->gotoLine(line, column);
|
||||||
|
return editor;
|
||||||
|
}
|
||||||
|
|
||||||
static int extractLineNumber(QString *fileName)
|
static int extractLineNumber(QString *fileName)
|
||||||
{
|
{
|
||||||
int i = fileName->length() - 1;
|
int i = fileName->length() - 1;
|
||||||
|
|||||||
@@ -118,6 +118,9 @@ public:
|
|||||||
static QString splitLineNumber(QString *fileName);
|
static QString splitLineNumber(QString *fileName);
|
||||||
static IEditor *openEditor(const QString &fileName, const Id &editorId = Id(),
|
static IEditor *openEditor(const QString &fileName, const Id &editorId = Id(),
|
||||||
OpenEditorFlags flags = 0, bool *newEditor = 0);
|
OpenEditorFlags flags = 0, bool *newEditor = 0);
|
||||||
|
static IEditor *openEditorAt(const QString &fileName, int line, int column = 0,
|
||||||
|
const Id &editorId = Id(), OpenEditorFlags flags = 0,
|
||||||
|
bool *newEditor = 0);
|
||||||
static IEditor *openEditorWithContents(const Id &editorId,
|
static IEditor *openEditorWithContents(const Id &editorId,
|
||||||
QString *titlePattern = 0, const QString &contents = QString());
|
QString *titlePattern = 0, const QString &contents = QString());
|
||||||
|
|
||||||
|
|||||||
@@ -2002,7 +2002,7 @@ bool CPPEditorWidget::openCppEditorAt(const Link &link, bool inNextSplit)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TextEditor::BaseTextEditorWidget::openEditorAt(link.targetFileName,
|
return Core::EditorManager::openEditorAt(link.targetFileName,
|
||||||
link.targetLine,
|
link.targetLine,
|
||||||
link.targetColumn,
|
link.targetColumn,
|
||||||
Constants::CPPEDITOR_ID);
|
Constants::CPPEDITOR_ID);
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ private:
|
|||||||
if (!m_link.hasValidTarget())
|
if (!m_link.hasValidTarget())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TextEditor::BaseTextEditorWidget::openEditorAt(m_link.targetFileName,
|
Core::EditorManager::openEditorAt(m_link.targetFileName,
|
||||||
m_link.targetLine,
|
m_link.targetLine,
|
||||||
m_link.targetColumn,
|
m_link.targetColumn,
|
||||||
Constants::CPPEDITOR_ID);
|
Constants::CPPEDITOR_ID);
|
||||||
@@ -205,7 +205,7 @@ void CppTypeHierarchyWidget::onItemClicked(const QModelIndex &index)
|
|||||||
const TextEditor::BaseTextEditorWidget::Link link
|
const TextEditor::BaseTextEditorWidget::Link link
|
||||||
= index.data(LinkRole).value<TextEditor::BaseTextEditorWidget::Link>();
|
= index.data(LinkRole).value<TextEditor::BaseTextEditorWidget::Link>();
|
||||||
if (link.hasValidTarget())
|
if (link.hasValidTarget())
|
||||||
TextEditor::BaseTextEditorWidget::openEditorAt(link.targetFileName,
|
Core::EditorManager::openEditorAt(link.targetFileName,
|
||||||
link.targetLine,
|
link.targetLine,
|
||||||
link.targetColumn,
|
link.targetColumn,
|
||||||
Constants::CPPEDITOR_ID);
|
Constants::CPPEDITOR_ID);
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ QList<Locator::FilterEntry> CppCurrentDocumentFilter::matchesFor(QFutureInterfac
|
|||||||
void CppCurrentDocumentFilter::accept(Locator::FilterEntry selection) const
|
void CppCurrentDocumentFilter::accept(Locator::FilterEntry selection) const
|
||||||
{
|
{
|
||||||
ModelItemInfo info = qvariant_cast<CppTools::ModelItemInfo>(selection.internalData);
|
ModelItemInfo info = qvariant_cast<CppTools::ModelItemInfo>(selection.internalData);
|
||||||
TextEditor::BaseTextEditorWidget::openEditorAt(info.fileName, info.line, info.column,
|
Core::EditorManager::openEditorAt(info.fileName, info.line, info.column,
|
||||||
Core::Id(), Core::EditorManager::ModeSwitch);
|
Core::Id(), Core::EditorManager::ModeSwitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,11 +32,11 @@
|
|||||||
#include "cpptoolsconstants.h"
|
#include "cpptoolsconstants.h"
|
||||||
#include "cppmodelmanagerinterface.h"
|
#include "cppmodelmanagerinterface.h"
|
||||||
|
|
||||||
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/progressmanager/futureprogress.h>
|
#include <coreplugin/progressmanager/futureprogress.h>
|
||||||
#include <coreplugin/progressmanager/progressmanager.h>
|
#include <coreplugin/progressmanager/progressmanager.h>
|
||||||
#include <texteditor/basefilefind.h>
|
#include <texteditor/basefilefind.h>
|
||||||
#include <texteditor/basetexteditor.h>
|
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/runextensions.h>
|
#include <utils/runextensions.h>
|
||||||
@@ -509,7 +509,7 @@ void CppFindReferences::setPaused(bool paused)
|
|||||||
void CppFindReferences::openEditor(const Find::SearchResultItem &item)
|
void CppFindReferences::openEditor(const Find::SearchResultItem &item)
|
||||||
{
|
{
|
||||||
if (item.path.size() > 0) {
|
if (item.path.size() > 0) {
|
||||||
TextEditor::BaseTextEditorWidget::openEditorAt(QDir::fromNativeSeparators(item.path.first()),
|
Core::EditorManager::openEditorAt(QDir::fromNativeSeparators(item.path.first()),
|
||||||
item.lineNumber, item.textMarkPos,
|
item.lineNumber, item.textMarkPos,
|
||||||
Core::Id(),
|
Core::Id(),
|
||||||
Core::EditorManager::ModeSwitch);
|
Core::EditorManager::ModeSwitch);
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ QList<Locator::FilterEntry> CppLocatorFilter::matchesFor(QFutureInterface<Locato
|
|||||||
void CppLocatorFilter::accept(Locator::FilterEntry selection) const
|
void CppLocatorFilter::accept(Locator::FilterEntry selection) const
|
||||||
{
|
{
|
||||||
ModelItemInfo info = qvariant_cast<CppTools::ModelItemInfo>(selection.internalData);
|
ModelItemInfo info = qvariant_cast<CppTools::ModelItemInfo>(selection.internalData);
|
||||||
TextEditor::BaseTextEditorWidget::openEditorAt(info.fileName, info.line, info.column,
|
Core::EditorManager::openEditorAt(info.fileName, info.line, info.column,
|
||||||
Core::Id(), Core::EditorManager::ModeSwitch);
|
Core::Id(), Core::EditorManager::ModeSwitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ void SymbolsFindFilter::openEditor(const Find::SearchResultItem &item)
|
|||||||
if (!item.userData.canConvert<ModelItemInfo>())
|
if (!item.userData.canConvert<ModelItemInfo>())
|
||||||
return;
|
return;
|
||||||
ModelItemInfo info = item.userData.value<ModelItemInfo>();
|
ModelItemInfo info = item.userData.value<ModelItemInfo>();
|
||||||
TextEditor::BaseTextEditorWidget::openEditorAt(info.fileName,
|
Core::EditorManager::openEditorAt(info.fileName,
|
||||||
info.line,
|
info.line,
|
||||||
info.column);
|
info.column);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ static Document::Ptr findDefinition(Function *functionDeclaration, int *line)
|
|||||||
|
|
||||||
static inline ITextEditor *editableAt(const QString &fileName, int line, int column)
|
static inline ITextEditor *editableAt(const QString &fileName, int line, int column)
|
||||||
{
|
{
|
||||||
return qobject_cast<ITextEditor *>(TextEditor::BaseTextEditorWidget::openEditorAt(fileName, line, column));
|
return qobject_cast<ITextEditor *>(Core::EditorManager::openEditorAt(fileName, line, column));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addDeclaration(const Snapshot &snapshot,
|
static void addDeclaration(const Snapshot &snapshot,
|
||||||
@@ -626,7 +626,7 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// jump to function definition, position within code
|
// jump to function definition, position within code
|
||||||
TextEditor::BaseTextEditorWidget::openEditorAt(sourceDoc->fileName(), line + 2, indentation);
|
Core::EditorManager::openEditorAt(sourceDoc->fileName(), line + 2, indentation);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
|
|
||||||
#include <texteditor/basetexteditor.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
@@ -49,7 +49,7 @@ bool ShowInEditorTaskHandler::canHandle(const ProjectExplorer::Task &task) const
|
|||||||
void ShowInEditorTaskHandler::handle(const ProjectExplorer::Task &task)
|
void ShowInEditorTaskHandler::handle(const ProjectExplorer::Task &task)
|
||||||
{
|
{
|
||||||
QFileInfo fi(task.file.toFileInfo());
|
QFileInfo fi(task.file.toFileInfo());
|
||||||
TextEditor::BaseTextEditorWidget::openEditorAt(fi.filePath(), task.movedLine);
|
Core::EditorManager::openEditorAt(fi.filePath(), task.movedLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
QAction *ShowInEditorTaskHandler::createAction(QObject *parent) const
|
QAction *ShowInEditorTaskHandler::createAction(QObject *parent) const
|
||||||
|
|||||||
@@ -29,7 +29,6 @@
|
|||||||
|
|
||||||
#include "qmljsfindreferences.h"
|
#include "qmljsfindreferences.h"
|
||||||
|
|
||||||
#include <texteditor/basetexteditor.h>
|
|
||||||
#include <texteditor/basefilefind.h>
|
#include <texteditor/basefilefind.h>
|
||||||
#include <find/searchresultwindow.h>
|
#include <find/searchresultwindow.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
@@ -985,7 +984,7 @@ void FindReferences::setPaused(bool paused)
|
|||||||
void FindReferences::openEditor(const Find::SearchResultItem &item)
|
void FindReferences::openEditor(const Find::SearchResultItem &item)
|
||||||
{
|
{
|
||||||
if (item.path.size() > 0) {
|
if (item.path.size() > 0) {
|
||||||
TextEditor::BaseTextEditorWidget::openEditorAt(QDir::fromNativeSeparators(item.path.first()),
|
Core::EditorManager::openEditorAt(QDir::fromNativeSeparators(item.path.first()),
|
||||||
item.lineNumber, item.textMarkPos, Core::Id(),
|
item.lineNumber, item.textMarkPos, Core::Id(),
|
||||||
Core::EditorManager::ModeSwitch);
|
Core::EditorManager::ModeSwitch);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#include "qmlconsoleitemdelegate.h"
|
#include "qmlconsoleitemdelegate.h"
|
||||||
#include "qmlconsoleitemmodel.h"
|
#include "qmlconsoleitemmodel.h"
|
||||||
|
|
||||||
#include <texteditor/basetexteditor.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/manhattanstyle.h>
|
#include <coreplugin/manhattanstyle.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
|
||||||
@@ -231,7 +231,7 @@ void QmlConsoleView::onRowActivated(const QModelIndex &index)
|
|||||||
QFileInfo fi(filePath);
|
QFileInfo fi(filePath);
|
||||||
if (fi.exists() && fi.isFile() && fi.isReadable()) {
|
if (fi.exists() && fi.isFile() && fi.isReadable()) {
|
||||||
int line = model()->data(index, QmlConsoleItemModel::LineRole).toInt();
|
int line = model()->data(index, QmlConsoleItemModel::LineRole).toInt();
|
||||||
TextEditor::BaseTextEditorWidget::openEditorAt(fi.canonicalFilePath(), line);
|
Core::EditorManager::openEditorAt(fi.canonicalFilePath(), line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
#include "qmljsfunctionfilter.h"
|
#include "qmljsfunctionfilter.h"
|
||||||
#include "qmljslocatordata.h"
|
#include "qmljslocatordata.h"
|
||||||
|
|
||||||
#include <texteditor/basetexteditor.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
|
|
||||||
#include <QStringMatcher>
|
#include <QStringMatcher>
|
||||||
|
|
||||||
@@ -111,6 +111,6 @@ QList<Locator::FilterEntry> FunctionFilter::matchesFor(QFutureInterface<Locator:
|
|||||||
void FunctionFilter::accept(Locator::FilterEntry selection) const
|
void FunctionFilter::accept(Locator::FilterEntry selection) const
|
||||||
{
|
{
|
||||||
const LocatorData::Entry entry = qvariant_cast<LocatorData::Entry>(selection.internalData);
|
const LocatorData::Entry entry = qvariant_cast<LocatorData::Entry>(selection.internalData);
|
||||||
TextEditor::BaseTextEditorWidget::openEditorAt(entry.fileName, entry.line, entry.column,
|
Core::EditorManager::openEditorAt(entry.fileName, entry.line, entry.column,
|
||||||
Core::Id(), Core::EditorManager::ModeSwitch);
|
Core::Id(), Core::EditorManager::ModeSwitch);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,11 +29,12 @@
|
|||||||
|
|
||||||
#include "qtoutputformatter.h"
|
#include "qtoutputformatter.h"
|
||||||
|
|
||||||
#include <texteditor/basetexteditor.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
|
|
||||||
#include <QUrl>
|
#include <QPlainTextEdit>
|
||||||
#include <QTextCursor>
|
#include <QTextCursor>
|
||||||
|
#include <QUrl>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace QtSupport;
|
using namespace QtSupport;
|
||||||
@@ -195,7 +196,7 @@ void QtOutputFormatter::handleLink(const QString &href)
|
|||||||
const int line = qmlLineColumnLink.cap(2).toInt();
|
const int line = qmlLineColumnLink.cap(2).toInt();
|
||||||
const int column = qmlLineColumnLink.cap(3).toInt();
|
const int column = qmlLineColumnLink.cap(3).toInt();
|
||||||
|
|
||||||
TextEditor::BaseTextEditorWidget::openEditorAt(m_projectFinder.findFile(fileUrl), line, column - 1);
|
Core::EditorManager::openEditorAt(m_projectFinder.findFile(fileUrl), line, column - 1);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -206,7 +207,7 @@ void QtOutputFormatter::handleLink(const QString &href)
|
|||||||
if (qmlLineLink.indexIn(href) != -1) {
|
if (qmlLineLink.indexIn(href) != -1) {
|
||||||
const QUrl fileUrl = QUrl(qmlLineLink.cap(1));
|
const QUrl fileUrl = QUrl(qmlLineLink.cap(1));
|
||||||
const int line = qmlLineLink.cap(2).toInt();
|
const int line = qmlLineLink.cap(2).toInt();
|
||||||
TextEditor::BaseTextEditorWidget::openEditorAt(m_projectFinder.findFile(fileUrl), line);
|
Core::EditorManager::openEditorAt(m_projectFinder.findFile(fileUrl), line);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,7 +234,7 @@ void QtOutputFormatter::handleLink(const QString &href)
|
|||||||
|
|
||||||
if (!fileName.isEmpty()) {
|
if (!fileName.isEmpty()) {
|
||||||
fileName = m_projectFinder.findFile(QUrl::fromLocalFile(fileName));
|
fileName = m_projectFinder.findFile(QUrl::fromLocalFile(fileName));
|
||||||
TextEditor::BaseTextEditorWidget::openEditorAt(fileName, line, 0);
|
Core::EditorManager::openEditorAt(fileName, line, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,8 @@
|
|||||||
#include <coreplugin/progressmanager/futureprogress.h>
|
#include <coreplugin/progressmanager/futureprogress.h>
|
||||||
#include <coreplugin/dialogs/readonlyfilesdialog.h>
|
#include <coreplugin/dialogs/readonlyfilesdialog.h>
|
||||||
#include <coreplugin/documentmanager.h>
|
#include <coreplugin/documentmanager.h>
|
||||||
#include <texteditor/basetexteditor.h>
|
#include <find/ifindsupport.h>
|
||||||
|
#include <texteditor/itexteditor.h>
|
||||||
#include <texteditor/refactoringchanges.h>
|
#include <texteditor/refactoringchanges.h>
|
||||||
#include <utils/stylehelper.h>
|
#include <utils/stylehelper.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -309,7 +310,7 @@ void BaseFileFind::openEditor(const Find::SearchResultItem &item)
|
|||||||
SearchResult *result = qobject_cast<SearchResult *>(sender());
|
SearchResult *result = qobject_cast<SearchResult *>(sender());
|
||||||
Core::IEditor *openedEditor = 0;
|
Core::IEditor *openedEditor = 0;
|
||||||
if (item.path.size() > 0) {
|
if (item.path.size() > 0) {
|
||||||
openedEditor = TextEditor::BaseTextEditorWidget::openEditorAt(QDir::fromNativeSeparators(item.path.first()),
|
openedEditor = Core::EditorManager::openEditorAt(QDir::fromNativeSeparators(item.path.first()),
|
||||||
item.lineNumber,
|
item.lineNumber,
|
||||||
item.textMarkPos,
|
item.textMarkPos,
|
||||||
Core::Id(),
|
Core::Id(),
|
||||||
|
|||||||
@@ -154,25 +154,6 @@ private:
|
|||||||
|
|
||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
|
|
||||||
Core::IEditor *BaseTextEditorWidget::openEditorAt(const QString &fileName, int line, int column,
|
|
||||||
Core::Id editorKind,
|
|
||||||
Core::EditorManager::OpenEditorFlags flags,
|
|
||||||
bool *newEditor)
|
|
||||||
{
|
|
||||||
Core::EditorManager *editorManager = Core::EditorManager::instance();
|
|
||||||
editorManager->cutForwardNavigationHistory();
|
|
||||||
editorManager->addCurrentPositionToNavigationHistory();
|
|
||||||
Core::IEditor *editor = Core::EditorManager::openEditor(fileName, editorKind,
|
|
||||||
flags, newEditor);
|
|
||||||
TextEditor::ITextEditor *texteditor = qobject_cast<TextEditor::ITextEditor *>(editor);
|
|
||||||
if (texteditor && line != -1) {
|
|
||||||
texteditor->gotoLine(line, column);
|
|
||||||
return texteditor;
|
|
||||||
}
|
|
||||||
|
|
||||||
return editor;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString BaseTextEditorWidget::plainTextFromSelection(const QTextCursor &cursor) const
|
QString BaseTextEditorWidget::plainTextFromSelection(const QTextCursor &cursor) const
|
||||||
{
|
{
|
||||||
// Copy the selected text as plain text
|
// Copy the selected text as plain text
|
||||||
@@ -4918,9 +4899,8 @@ bool BaseTextEditorWidget::openLink(const Link &link, bool inNextSplit)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return openEditorAt(link.targetFileName, link.targetLine, link.targetColumn, Core::Id(),
|
return Core::EditorManager::openEditorAt(link.targetFileName, link.targetLine, link.targetColumn,
|
||||||
Core::EditorManager::IgnoreNavigationHistory
|
Core::Id(), Core::EditorManager::ModeSwitch);
|
||||||
| Core::EditorManager::ModeSwitch);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextEditorWidget::updateLink(QMouseEvent *e)
|
void BaseTextEditorWidget::updateLink(QMouseEvent *e)
|
||||||
|
|||||||
@@ -131,11 +131,6 @@ public:
|
|||||||
BaseTextEditorWidget(QWidget *parent);
|
BaseTextEditorWidget(QWidget *parent);
|
||||||
~BaseTextEditorWidget();
|
~BaseTextEditorWidget();
|
||||||
|
|
||||||
static Core::IEditor *openEditorAt(const QString &fileName, int line, int column = 0,
|
|
||||||
Core::Id editorId = Core::Id(),
|
|
||||||
Core::EditorManager::OpenEditorFlags flags = Core::EditorManager::IgnoreNavigationHistory,
|
|
||||||
bool *newEditor = 0);
|
|
||||||
|
|
||||||
const Utils::ChangeSet &changeSet() const;
|
const Utils::ChangeSet &changeSet() const;
|
||||||
void setChangeSet(const Utils::ChangeSet &changeSet);
|
void setChangeSet(const Utils::ChangeSet &changeSet);
|
||||||
|
|
||||||
|
|||||||
@@ -29,8 +29,6 @@
|
|||||||
|
|
||||||
#include "itexteditor.h"
|
#include "itexteditor.h"
|
||||||
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
|
||||||
|
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
|
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
@@ -66,7 +64,6 @@ QMap<QString, QTextCodec *> TextEditor::ITextEditor::openedTextEditorsEncodings(
|
|||||||
return workingCopy;
|
return workingCopy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ITextEditorDocument *ITextEditor::textDocument()
|
ITextEditorDocument *ITextEditor::textDocument()
|
||||||
{
|
{
|
||||||
return qobject_cast<ITextEditorDocument *>(document());
|
return qobject_cast<ITextEditorDocument *>(document());
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#include "itextmark.h"
|
#include "itextmark.h"
|
||||||
|
|
||||||
#include <coreplugin/textdocument.h>
|
#include <coreplugin/textdocument.h>
|
||||||
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/editormanager/ieditor.h>
|
#include <coreplugin/editormanager/ieditor.h>
|
||||||
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ BaseTextEditorWidget *RefactoringChanges::openEditor(const QString &fileName, bo
|
|||||||
// openEditorAt uses a 1-based line and a 0-based column!
|
// openEditorAt uses a 1-based line and a 0-based column!
|
||||||
column -= 1;
|
column -= 1;
|
||||||
}
|
}
|
||||||
Core::IEditor *editor = BaseTextEditorWidget::openEditorAt(
|
Core::IEditor *editor = Core::EditorManager::openEditorAt(
|
||||||
fileName, line, column, Core::Id(), flags);
|
fileName, line, column, Core::Id(), flags);
|
||||||
|
|
||||||
if (editor)
|
if (editor)
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
#include <cplusplus/Overview.h>
|
#include <cplusplus/Overview.h>
|
||||||
#include <cppeditor/cppeditorconstants.h>
|
#include <cppeditor/cppeditorconstants.h>
|
||||||
#include <extensionsystem/iplugin.h>
|
#include <extensionsystem/iplugin.h>
|
||||||
#include <texteditor/basetexteditor.h>
|
#include <texteditor/itexteditor.h>
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/fancymainwindow.h>
|
#include <utils/fancymainwindow.h>
|
||||||
@@ -322,7 +322,7 @@ void CallgrindToolPrivate::selectFunction(const Function *func)
|
|||||||
if (QFile::exists(func->file())) {
|
if (QFile::exists(func->file())) {
|
||||||
///TODO: custom position support?
|
///TODO: custom position support?
|
||||||
int line = func->lineNumber();
|
int line = func->lineNumber();
|
||||||
TextEditor::BaseTextEditorWidget::openEditorAt(func->file(), qMax(line, 0));
|
Core::EditorManager::openEditorAt(func->file(), qMax(line, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,9 +41,9 @@
|
|||||||
#include "xmlprotocol/suppression.h"
|
#include "xmlprotocol/suppression.h"
|
||||||
|
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <texteditor/basetexteditor.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@@ -52,6 +52,7 @@
|
|||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
|
#include <QContextMenuEvent>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QListView>
|
#include <QListView>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
@@ -432,7 +433,7 @@ void MemcheckErrorDelegate::openLinkInEditor(const QString &link)
|
|||||||
const int pathEnd = link.lastIndexOf(QLatin1Char(':'));
|
const int pathEnd = link.lastIndexOf(QLatin1Char(':'));
|
||||||
const QString path = link.mid(pathStart, pathEnd - pathStart);
|
const QString path = link.mid(pathStart, pathEnd - pathStart);
|
||||||
const int line = link.mid(pathEnd + 1).toInt(0);
|
const int line = link.mid(pathEnd + 1).toInt(0);
|
||||||
TextEditor::BaseTextEditorWidget::openEditorAt(path, qMax(line, 0));
|
Core::EditorManager::openEditorAt(path, qMax(line, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
MemcheckErrorView::MemcheckErrorView(QWidget *parent)
|
MemcheckErrorView::MemcheckErrorView(QWidget *parent)
|
||||||
|
|||||||
@@ -54,15 +54,14 @@
|
|||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
#include <projectexplorer/buildconfiguration.h>
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
|
|
||||||
#include <coreplugin/coreconstants.h>
|
|
||||||
#include <coreplugin/icore.h>
|
|
||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
|
||||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||||
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
#include <coreplugin/actionmanager/command.h>
|
#include <coreplugin/actionmanager/command.h>
|
||||||
|
#include <coreplugin/coreconstants.h>
|
||||||
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/id.h>
|
#include <coreplugin/id.h>
|
||||||
|
|
||||||
#include <texteditor/basetexteditor.h>
|
|
||||||
|
|
||||||
#include <utils/fancymainwindow.h>
|
#include <utils/fancymainwindow.h>
|
||||||
#include <utils/styledbar.h>
|
#include <utils/styledbar.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -502,7 +501,7 @@ void MemcheckTool::suppressionActionTriggered()
|
|||||||
const QString file = action->data().toString();
|
const QString file = action->data().toString();
|
||||||
QTC_ASSERT(!file.isEmpty(), return);
|
QTC_ASSERT(!file.isEmpty(), return);
|
||||||
|
|
||||||
TextEditor::BaseTextEditorWidget::openEditorAt(file, 0);
|
Core::EditorManager::openEditorAt(file, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemcheckTool::parserError(const Valgrind::XmlProtocol::Error &error)
|
void MemcheckTool::parserError(const Valgrind::XmlProtocol::Error &error)
|
||||||
|
|||||||
Reference in New Issue
Block a user