Commit 763b59aa authored by Friedemann Kleint's avatar Friedemann Kleint

Debugger: Fix debugger switching to edit mode.

... on clicking stack frames or disassembler/
memory views.

Introduce flags to openEditorAt, pass
EditorManager::NoModeSwitch where applicable.

Task-number: QTCREATORBUG-2278
parent 9374ba00
......@@ -297,7 +297,9 @@ void Manager::onDocumentUpdated(CPlusPlus::Document::Ptr doc)
void Manager::gotoLocation(const QString &fileName, int line, int column)
{
bool newEditor = false;
TextEditor::BaseTextEditor::openEditorAt(fileName, line, column, QString(), &newEditor);
TextEditor::BaseTextEditor::openEditorAt(fileName, line, column, QString(),
Core::EditorManager::IgnoreNavigationHistory,
&newEditor);
}
void Manager::gotoLocations(const QList<QVariant> &list)
......
......@@ -123,7 +123,7 @@ void MemoryViewAgent::createBinEditor(quint64 addr)
connect(editor->widget(), SIGNAL(endOfFileRequested(Core::IEditor *)),
this, SLOT(handleEndOfFileRequested(Core::IEditor*)));
m_editors << editor;
editorManager->activateEditor(editor);
editorManager->activateEditor(editor, Core::EditorManager::NoModeSwitch);
QMetaObject::invokeMethod(editor->widget(), "setNewWindowRequestAllowed");
QMetaObject::invokeMethod(editor->widget(), "setLazyData",
Q_ARG(quint64, addr), Q_ARG(int, DataRange), Q_ARG(int, BinBlockSize));
......@@ -147,7 +147,7 @@ void MemoryViewAgent::addLazyData(QObject *editorToken, quint64 addr,
{
Core::IEditor *editor = qobject_cast<Core::IEditor *>(editorToken);
if (editor && editor->widget()) {
Core::EditorManager::instance()->activateEditor(editor);
Core::EditorManager::instance()->activateEditor(editor, Core::EditorManager::NoModeSwitch);
QMetaObject::invokeMethod(editor->widget(), "addLazyData",
Q_ARG(quint64, addr / BinBlockSize), Q_ARG(QByteArray, ba));
}
......@@ -343,7 +343,7 @@ void DisassemblerViewAgent::setContents(const QString &contents)
d->configureMimeType();
}
editorManager->activateEditor(d->editor);
editorManager->activateEditor(d->editor, Core::EditorManager::NoModeSwitch);
plainTextEdit = qobject_cast<QPlainTextEdit *>(d->editor->widget());
if (plainTextEdit) {
......
......@@ -2345,7 +2345,9 @@ void DebuggerPluginPrivate::gotoLocation(const QString &file, int line, bool set
{
bool newEditor = false;
ITextEditor *editor =
BaseTextEditor::openEditorAt(file, line, 0, QString(), &newEditor);
BaseTextEditor::openEditorAt(file, line, 0, QString(),
Core::EditorManager::IgnoreNavigationHistory,
&newEditor);
if (!editor)
return;
if (newEditor)
......@@ -2575,7 +2577,9 @@ void DebuggerPlugin::gotoLocation(const QString &file, int line, bool setMarker)
{
bool newEditor = false;
ITextEditor *editor =
BaseTextEditor::openEditorAt(file, line, 0, QString(), &newEditor);
BaseTextEditor::openEditorAt(file, line, 0, QString(),
Core::EditorManager::IgnoreNavigationHistory|Core::EditorManager::NoModeSwitch,
&newEditor);
if (!editor)
return;
if (newEditor)
......
......@@ -140,18 +140,16 @@ protected:
} // namespace Internal
} // namespace TextEditor
ITextEditor *BaseTextEditor::openEditorAt(const QString &fileName,
int line,
int column,
const QString &editorKind,
bool *newEditor)
ITextEditor *BaseTextEditor::openEditorAt(const QString &fileName, int line, int column,
const QString &editorKind,
Core::EditorManager::OpenEditorFlags flags,
bool *newEditor)
{
Core::EditorManager *editorManager = Core::EditorManager::instance();
editorManager->cutForwardNavigationHistory();
editorManager->addCurrentPositionToNavigationHistory();
Core::IEditor *editor = editorManager->openEditor(fileName, editorKind,
Core::EditorManager::IgnoreNavigationHistory, newEditor);
flags, newEditor);
TextEditor::ITextEditor *texteditor = qobject_cast<TextEditor::ITextEditor *>(editor);
if (texteditor) {
texteditor->gotoLine(line, column);
......
......@@ -34,6 +34,8 @@
#include <find/ifindsupport.h>
#include <coreplugin/editormanager/editormanager.h>
#include <QtGui/QPlainTextEdit>
QT_BEGIN_NAMESPACE
......@@ -141,7 +143,8 @@ public:
~BaseTextEditor();
static ITextEditor *openEditorAt(const QString &fileName, int line, int column = 0,
const QString &editorId = QString(),
const QString &editorId = QString(),
Core::EditorManager::OpenEditorFlags flags = Core::EditorManager::IgnoreNavigationHistory,
bool *newEditor = 0);
const Utils::ChangeSet &changeSet() const;
......
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