Commit 7c8db798 authored by Eike Ziller's avatar Eike Ziller

Switch less often to edit mode

This change
* Removes IMode::type, ModeManager::activateModeType, and
  IEditor::preferredModeType, and adds IEditor::isDesignModePreferred
  instead
* Adapts the mode switching code in EditorManager to handle multiple
  windows, for example switching to edit mode should only happen if
  the editor/view is in the main window. Otherwise the editor window
  should be raised and focused
* Renames EditorManager::NoActivate --> DoNotChangeCurrentEditor
* Reverts the EditorManager::ModeSwitch logic to switch mode or
  make the current editor visible by default, introducing
  DoNotMakeVisible flag instead
* Fixes a few instances where EditorManager::ModeSwitch should have been
  used

One non-trivial problem left: If you open a .ui file and switch to an
external editor window, edit mode is activated, because the current
editor no longer is a .ui file, which means that the design mode gets
deactivated.

Change-Id: I76c5c2391eb4090143b778fb103acff3a5a1ff41
Reviewed-by: default avatarDavid Schulz <david.schulz@digia.com>
parent f99ce422
......@@ -102,7 +102,6 @@ public:
setIcon(QIcon(QLatin1String(":/images/analyzer_mode.png")));
setPriority(P_MODE_ANALYZE);
setId(MODE_ANALYZE);
setType(MODE_EDIT_TYPE);
}
~AnalyzerMode()
......
......@@ -540,9 +540,7 @@ void BazaarPlugin::showCommitWidget(const QList<VcsBase::VcsBaseClient::StatusIt
return;
}
Core::IEditor *editor = Core::EditorManager::openEditor(saver.fileName(),
Constants::COMMIT_ID,
Core::EditorManager::ModeSwitch);
Core::IEditor *editor = Core::EditorManager::openEditor(saver.fileName(), Constants::COMMIT_ID);
if (!editor) {
outputWindow->appendError(tr("Unable to create an editor for the commit."));
return;
......
......@@ -687,9 +687,7 @@ QString ClearCasePlugin::ccGetFileActivity(const QString &workingDir, const QStr
ClearCaseSubmitEditor *ClearCasePlugin::openClearCaseSubmitEditor(const QString &fileName, bool isUcm)
{
Core::IEditor *editor =
Core::EditorManager::openEditor(fileName,
Constants::CLEARCASECHECKINEDITOR_ID,
Core::EditorManager::ModeSwitch);
Core::EditorManager::openEditor(fileName, Constants::CLEARCASECHECKINEDITOR_ID);
ClearCaseSubmitEditor *submitEditor = qobject_cast<ClearCaseSubmitEditor*>(editor);
QTC_CHECK(submitEditor);
submitEditor->registerActions(m_submitUndoAction, m_submitRedoAction, m_checkInSelectedAction, m_checkInDiffAction);
......@@ -932,7 +930,7 @@ void ClearCasePlugin::ccDiffWithPred(const QString &workingDir, const QStringLis
// Show in the same editor if diff has been executed before
if (Core::IEditor *existingEditor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) {
existingEditor->createNew(result);
Core::EditorManager::activateEditor(existingEditor, Core::EditorManager::ModeSwitch);
Core::EditorManager::activateEditor(existingEditor);
setDiffBaseDirectory(existingEditor, workingDir);
return;
}
......@@ -1192,7 +1190,7 @@ void ClearCasePlugin::history(const QString &workingDir,
const QString tag = VcsBase::VcsBaseEditorWidget::editorTag(VcsBase::LogOutput, workingDir, files);
if (Core::IEditor *editor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) {
editor->createNew(response.stdOut);
Core::EditorManager::activateEditor(editor, Core::EditorManager::ModeSwitch);
Core::EditorManager::activateEditor(editor);
} else {
const QString title = QString::fromLatin1("cc history %1").arg(id);
const QString source = VcsBase::VcsBaseEditorWidget::getSource(workingDir, files);
......@@ -1305,7 +1303,7 @@ void ClearCasePlugin::vcsAnnotate(const QString &workingDir, const QString &file
if (Core::IEditor *editor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) {
editor->createNew(res);
VcsBase::VcsBaseEditorWidget::gotoLineOfEditor(editor, lineNumber);
Core::EditorManager::activateEditor(editor, Core::EditorManager::ModeSwitch);
Core::EditorManager::activateEditor(editor);
} else {
const QString title = QString::fromLatin1("cc annotate %1").arg(id);
Core::IEditor *newEditor = showOutputInEditor(title, res, VcsBase::AnnotateOutput, source, codec);
......@@ -1341,7 +1339,7 @@ void ClearCasePlugin::describe(const QString &source, const QString &changeNr)
const QString tag = VcsBase::VcsBaseEditorWidget::editorTag(VcsBase::DiffOutput, source, QStringList(), changeNr);
if (Core::IEditor *editor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) {
editor->createNew(description);
Core::EditorManager::activateEditor(editor, Core::EditorManager::ModeSwitch);
Core::EditorManager::activateEditor(editor);
} else {
const QString title = QString::fromLatin1("cc describe %1").arg(id);
Core::IEditor *newEditor = showOutputInEditor(title, description, VcsBase::DiffOutput, source, codec);
......@@ -1413,7 +1411,7 @@ Core::IEditor *ClearCasePlugin::showOutputInEditor(const QString& title, const Q
if (codec)
e->setCodec(codec);
Core::IEditor *ie = e->editor();
Core::EditorManager::activateEditor(ie, Core::EditorManager::ModeSwitch);
Core::EditorManager::activateEditor(ie);
return ie;
}
......
......@@ -650,7 +650,7 @@ bool BaseFileWizard::postGenerateOpenEditors(const GeneratedFiles &l, QString *e
{
foreach (const Core::GeneratedFile &file, l) {
if (file.attributes() & Core::GeneratedFile::OpenEditorAttribute) {
if (!Core::EditorManager::openEditor(file.path(), file.editorId(), Core::EditorManager::ModeSwitch )) {
if (!Core::EditorManager::openEditor(file.path(), file.editorId())) {
if (errorMessage)
*errorMessage = tr("Failed to open an editor for '%1'.").arg(QDir::toNativeSeparators(file.path()));
return false;
......
......@@ -120,7 +120,6 @@ DesignMode::DesignMode()
setIcon(QIcon(QLatin1String(":/fancyactionbar/images/mode_Design.png")));
setPriority(Constants::P_MODE_DESIGN);
setId(Constants::MODE_DESIGN);
setType(Constants::MODE_DESIGN_TYPE);
ExtensionSystem::PluginManager::addObject(d->m_coreListener);
......
......@@ -1382,7 +1382,7 @@ void DocumentManager::executeOpenWithMenuAction(QAction *action)
return;
}
EditorManager::openEditor(entry.fileName, entry.editorFactory->id(), EditorManager::ModeSwitch);
EditorManager::openEditor(entry.fileName, entry.editorFactory->id());
return;
}
if (entry.externalEditor)
......
......@@ -55,7 +55,6 @@ EditMode::EditMode() :
setIcon(QIcon(QLatin1String(":/fancyactionbar/images/mode_Edit.png")));
setPriority(Constants::P_MODE_EDIT);
setId(Constants::MODE_EDIT);
setType(Constants::MODE_EDIT_TYPE);
m_rightSplitWidgetLayout->setSpacing(0);
m_rightSplitWidgetLayout->setMargin(0);
......
......@@ -698,15 +698,15 @@ void EditorManager::splitNewWindow(Internal::EditorView *view)
context->setContext(Context(Constants::C_EDITORMANAGER));
context->setWidget(splitter);
ICore::addContextObject(context);
m_instance->d->m_root.append(splitter);
m_instance->d->m_rootContext.append(context);
connect(splitter, SIGNAL(destroyed(QObject*)), m_instance, SLOT(rootDestroyed(QObject*)));
splitter->show();
ICore::raiseWindow(splitter);
if (newEditor)
m_instance->activateEditor(splitter->view(), newEditor, IgnoreNavigationHistory);
else
splitter->view()->setFocus();
m_instance->d->m_root.append(splitter);
m_instance->d->m_rootContext.append(context);
connect(splitter, SIGNAL(destroyed(QObject*)), m_instance, SLOT(rootDestroyed(QObject*)));
m_instance->updateActions();
}
......@@ -1049,15 +1049,15 @@ bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool ask
if (!newCurrent)
newCurrent = pickUnusedEditor();
if (newCurrent) {
activateEditor(view, newCurrent, NoActivate);
activateEditor(view, newCurrent, DoNotChangeCurrentEditor);
} else {
QModelIndex idx = d->m_editorModel->firstRestoredEditor();
if (idx.isValid()) {
activateEditorForIndex(view, idx, NoActivate);
activateEditorForIndex(view, idx, DoNotChangeCurrentEditor);
} else {
const QList<IEditor *> editors = d->m_editorModel->editors();
if (!editors.isEmpty())
activateEditor(view, editors.last(), NoActivate);
activateEditor(view, editors.last(), DoNotChangeCurrentEditor);
}
}
}
......@@ -1112,11 +1112,11 @@ void EditorManager::closeDuplicate(Core::IEditor *editor)
if (!newCurrent)
newCurrent = pickUnusedEditor();
if (newCurrent) {
activateEditor(view, newCurrent, NoActivate);
activateEditor(view, newCurrent, DoNotChangeCurrentEditor);
} else {
QModelIndex idx = d->m_editorModel->firstRestoredEditor();
if (idx.isValid())
activateEditorForIndex(view, idx, NoActivate);
activateEditorForIndex(view, idx, DoNotChangeCurrentEditor);
}
}
......@@ -1221,13 +1221,22 @@ Core::IEditor *EditorManager::activateEditor(Core::Internal::EditorView *view, C
editor = placeEditor(view, editor);
if (!(flags & NoActivate)) {
if (!(flags & DoNotChangeCurrentEditor)) {
setCurrentEditor(editor, (flags & IgnoreNavigationHistory));
if (flags & ModeSwitch)
switchToPreferedMode();
if (isVisible()) {
editor->widget()->setFocus();
ICore::raiseWindow(editor->widget());
if (!(flags & DoNotMakeVisible)) {
// switch to design mode?
if (editor->isDesignModePreferred()) {
ModeManager::activateMode(Core::Constants::MODE_DESIGN);
ModeManager::setFocusToCurrentMode();
} else {
int rootIndex;
findRoot(view, &rootIndex);
if (rootIndex == 0) // main window --> we might need to switch mode
if (!editor->widget()->isVisible())
ModeManager::activateMode(Core::Constants::MODE_EDIT);
editor->widget()->setFocus();
ICore::raiseWindow(editor->widget());
}
}
}
return editor;
......@@ -1572,22 +1581,6 @@ QStringList EditorManager::getOpenFileNames() const
}
/// Empty mode == figure out the correct mode from the editor
/// forcePrefered = true, switch to the mode even if the editor is visible in another mode
/// forcePrefered = false, only switch if it is not visible
void EditorManager::switchToPreferedMode()
{
Id preferedMode;
// Figure out preferred mode for editor
if (d->m_currentEditor)
preferedMode = d->m_currentEditor->preferredModeType();
if (!preferedMode.isValid())
preferedMode = Id(Constants::MODE_EDIT_TYPE);
ModeManager::activateModeType(preferedMode);
}
IEditor *EditorManager::openEditorWithContents(const Id &editorId,
QString *titlePattern,
const QString &contents)
......@@ -2191,7 +2184,7 @@ bool EditorManager::restoreState(const QByteArray &state)
continue;
QFileInfo rfi(autoSaveName(fileName));
if (rfi.exists() && fi.lastModified() < rfi.lastModified())
openEditor(fileName, id);
openEditor(fileName, id, DoNotMakeVisible);
else
d->m_editorModel->addRestoredEditor(fileName, displayName, id);
}
......
......@@ -107,9 +107,9 @@ public:
static EditorToolBar *createToolBar(QWidget *parent = 0);
enum OpenEditorFlag {
NoActivate = 1,
DoNotChangeCurrentEditor = 1,
IgnoreNavigationHistory = 2,
ModeSwitch = 4,
DoNotMakeVisible = 4,
CanContainLineNumber = 8,
OpenInOtherSplit = 16
};
......@@ -278,7 +278,6 @@ private:
static void splitNewWindow(Internal::EditorView *view);
IEditor *pickUnusedEditor() const;
void addDocumentToRecentFiles(IDocument *document);
void switchToPreferedMode();
void updateAutoSave();
void setCloseSplitEnabled(Internal::SplitterOrView *splitterOrView, bool enable);
void updateMakeWritableWarning();
......
......@@ -299,7 +299,7 @@ IEditor *EditorView::currentEditor() const
void EditorView::listSelectionActivated(int index)
{
QAbstractItemModel *model = EditorManager::instance()->openedEditorsModel();
EditorManager::instance()->activateEditorForIndex(this, model->index(index, 0), Core::EditorManager::ModeSwitch);
EditorManager::instance()->activateEditorForIndex(this, model->index(index, 0));
}
void EditorView::splitHorizontally()
......@@ -465,11 +465,11 @@ void EditorView::goBackInNavigationHistory()
IEditor *editor = 0;
if (location.document) {
editor = em->activateEditorForDocument(this, location.document,
EditorManager::IgnoreNavigationHistory | EditorManager::ModeSwitch);
EditorManager::IgnoreNavigationHistory);
}
if (!editor) {
editor = em->openEditor(this, location.fileName, location.id,
EditorManager::IgnoreNavigationHistory | EditorManager::ModeSwitch);
EditorManager::IgnoreNavigationHistory);
if (!editor) {
m_navigationHistory.removeAt(m_currentNavigationHistoryPosition);
continue;
......@@ -492,7 +492,7 @@ void EditorView::goForwardInNavigationHistory()
IEditor *editor = 0;
if (location.document) {
editor = em->activateEditorForDocument(this, location.document,
EditorManager::IgnoreNavigationHistory | EditorManager::ModeSwitch);
EditorManager::IgnoreNavigationHistory);
}
if (!editor) {
editor = em->openEditor(this, location.fileName, location.id, EditorManager::IgnoreNavigationHistory);
......@@ -784,13 +784,13 @@ void SplitterOrView::restoreState(const QByteArray &state)
if (!QFile::exists(fileName))
return;
IEditor *e = em->openEditor(view(), fileName, Id::fromString(id), Core::EditorManager::IgnoreNavigationHistory
| Core::EditorManager::NoActivate);
| Core::EditorManager::DoNotChangeCurrentEditor);
if (!e) {
QModelIndex idx = em->openedEditorsModel()->firstRestoredEditor();
if (idx.isValid())
em->activateEditorForIndex(view(), idx, Core::EditorManager::IgnoreNavigationHistory
| Core::EditorManager::NoActivate);
| Core::EditorManager::DoNotChangeCurrentEditor);
}
if (e) {
......
......@@ -68,7 +68,7 @@ public:
virtual QWidget *toolBar() = 0;
virtual Id preferredModeType() const { return Id(); }
virtual bool isDesignModePreferred() const { return false; }
signals:
void changed();
......
......@@ -189,7 +189,7 @@ void OpenEditorsWidget::handleClicked(const QModelIndex &index)
void OpenEditorsWidget::activateEditor(const QModelIndex &index)
{
selectionModel()->select(index, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
EditorManager::instance()->activateEditorForIndex(index, EditorManager::ModeSwitch);
EditorManager::instance()->activateEditorForIndex(index);
}
void OpenEditorsWidget::closeEditor(const QModelIndex &index)
......
......@@ -225,11 +225,10 @@ void OpenEditorsWindow::selectEditor(QTreeWidgetItem *item)
return;
if (IDocument *document = item->data(0, Qt::UserRole).value<IDocument*>()) {
EditorView *view = item->data(0, Qt::UserRole+1).value<EditorView*>();
EditorManager::instance()->activateEditorForDocument(view, document, EditorManager::ModeSwitch);
EditorManager::instance()->activateEditorForDocument(view, document);
} else {
if (!EditorManager::openEditor(
item->toolTip(0), item->data(0, Qt::UserRole+2).value<Core::Id>(),
Core::EditorManager::ModeSwitch)) {
item->toolTip(0), item->data(0, Qt::UserRole+2).value<Core::Id>())) {
EditorManager::instance()->openedEditorsModel()->removeEditor(item->toolTip(0));
delete item;
}
......
......@@ -311,7 +311,7 @@ void EditorToolBar::changeActiveEditor(int row)
{
EditorManager *em = ICore::editorManager();
QAbstractItemModel *model = d->m_editorList->model();
em->activateEditorForIndex(model->index(row, 0), EditorManager::ModeSwitch);
em->activateEditorForIndex(model->index(row, 0));
}
void EditorToolBar::listContextMenu(QPoint pos)
......
......@@ -49,7 +49,6 @@ public:
QIcon icon() const { return m_icon; }
int priority() const { return m_priority; }
Id id() const { return m_id; }
Id type() const { return m_type; }
bool isEnabled() const;
void setEnabled(bool enabled);
......@@ -57,7 +56,6 @@ public:
void setIcon(const QIcon &icon) { m_icon = icon; }
void setPriority(int priority) { m_priority = priority; }
void setId(Id id) { m_id = id; }
void setType(Id type) { m_type = type; }
signals:
void enabledStateChanged(bool enabled);
......@@ -67,7 +65,6 @@ private:
QIcon m_icon;
int m_priority;
Id m_id;
Id m_type;
bool m_isEnabled;
};
......
......@@ -861,8 +861,6 @@ IDocument *MainWindow::openFiles(const QStringList &fileNames, ICore::OpenFilesF
}
} else {
QFlags<EditorManager::OpenEditorFlag> emFlags;
if (flags & ICore::SwitchMode)
emFlags = EditorManager::ModeSwitch;
if (flags & ICore::CanContainLineNumbers)
emFlags |= EditorManager::CanContainLineNumber;
IEditor *editor = EditorManager::openEditor(absoluteFilePath, Id(), emFlags);
......@@ -1005,7 +1003,7 @@ void MainWindow::openFileWith()
if (isExternal)
EditorManager::openExternalEditor(fileName, editorId);
else
EditorManager::openEditor(fileName, editorId, Core::EditorManager::ModeSwitch);
EditorManager::openEditor(fileName, editorId);
}
}
......@@ -1289,7 +1287,7 @@ void MainWindow::openRecentFile()
{
if (const QAction *action = qobject_cast<const QAction*>(sender())) {
const DocumentManager::RecentFile file = action->data().value<DocumentManager::RecentFile>();
EditorManager::openEditor(file.first, file.second, EditorManager::ModeSwitch);
EditorManager::openEditor(file.first, file.second);
}
}
......
......@@ -150,21 +150,6 @@ IMode *ModeManager::mode(Id id)
return 0;
}
void ModeManager::activateModeType(Id type)
{
if (currentMode() && currentMode()->type() == type)
return;
int index = -1;
for (int i = 0; i < d->m_modes.count(); ++i) {
if (d->m_modes.at(i)->type() == type) {
index = i;
break;
}
}
if (index != -1)
d->m_modeStack->setCurrentIndex(index);
}
void ModeManager::slotActivateMode(int id)
{
m_instance->activateMode(Id::fromUniqueIdentifier(id));
......@@ -333,10 +318,10 @@ void ModeManager::setFocusToCurrentMode()
QWidget *widget = mode->widget();
if (widget) {
QWidget *focusWidget = widget->focusWidget();
if (focusWidget)
focusWidget->setFocus();
else
widget->setFocus();
if (!focusWidget)
focusWidget = widget;
focusWidget->setFocus();
ICore::raiseWindow(focusWidget);
}
}
......
......@@ -65,7 +65,6 @@ public:
static void addProjectSelector(QAction *action);
static void addWidget(QWidget *widget);
static void activateModeType(Id type);
static void activateMode(Id id);
static void setFocusToCurrentMode();
static bool isModeSelectorVisible();
......
......@@ -380,7 +380,7 @@ void CodepasterPlugin::finishFetch(const QString &titleDescription,
const QString fileName = saver.fileName();
m_fetchedSnippets.push_back(fileName);
// Open editor with title.
Core::IEditor *editor = EditorManager::openEditor(fileName, Core::Id(), EditorManager::ModeSwitch);
Core::IEditor *editor = EditorManager::openEditor(fileName);
QTC_ASSERT(editor, return);
editor->setDisplayName(titleDescription);
}
......
......@@ -1992,7 +1992,7 @@ bool CPPEditorWidget::openCppEditorAt(const Link &link, bool inNextSplit)
if (!link.hasValidTarget())
return false;
Core::EditorManager::OpenEditorFlags flags = Core::EditorManager::ModeSwitch;
Core::EditorManager::OpenEditorFlags flags;
if (inNextSplit)
flags |= Core::EditorManager::OpenInOtherSplit;
return Core::EditorManager::openEditorAt(link.targetFileName,
......
......@@ -110,8 +110,7 @@ QList<Locator::FilterEntry> CppCurrentDocumentFilter::matchesFor(QFutureInterfac
void CppCurrentDocumentFilter::accept(Locator::FilterEntry selection) const
{
ModelItemInfo info = qvariant_cast<CppTools::ModelItemInfo>(selection.internalData);
Core::EditorManager::openEditorAt(info.fileName, info.line, info.column,
Core::Id(), Core::EditorManager::ModeSwitch);
Core::EditorManager::openEditorAt(info.fileName, info.line, info.column);
}
void CppCurrentDocumentFilter::refresh(QFutureInterface<void> &future)
......
......@@ -305,8 +305,7 @@ void CppFileSettingsWidget::slotEdit()
setLicenseTemplatePath(path);
}
// Edit (now) existing file with C++
Core::EditorManager::openEditor(path, CppEditor::Constants::CPPEDITOR_ID,
Core::EditorManager::ModeSwitch);
Core::EditorManager::openEditor(path, CppEditor::Constants::CPPEDITOR_ID);
}
// --------------- CppFileSettingsPage
......
......@@ -510,12 +510,9 @@ void CppFindReferences::openEditor(const Find::SearchResultItem &item)
{
if (item.path.size() > 0) {
Core::EditorManager::openEditorAt(QDir::fromNativeSeparators(item.path.first()),
item.lineNumber, item.textMarkPos,
Core::Id(),
Core::EditorManager::ModeSwitch);
item.lineNumber, item.textMarkPos);
} else {
Core::EditorManager::openEditor(QDir::fromNativeSeparators(item.text),
Core::Id(), Core::EditorManager::ModeSwitch);
Core::EditorManager::openEditor(QDir::fromNativeSeparators(item.text));
}
}
......
......@@ -177,8 +177,7 @@ QList<Locator::FilterEntry> CppLocatorFilter::matchesFor(QFutureInterface<Locato
void CppLocatorFilter::accept(Locator::FilterEntry selection) const
{
ModelItemInfo info = qvariant_cast<CppTools::ModelItemInfo>(selection.internalData);
Core::EditorManager::openEditorAt(info.fileName, info.line, info.column,
Core::Id(), Core::EditorManager::ModeSwitch);
Core::EditorManager::openEditorAt(info.fileName, info.line, info.column);
}
void CppLocatorFilter::reset()
......
......@@ -164,8 +164,7 @@ void CppToolsPlugin::switchHeaderSourceInNextSplit()
QString otherFile = correspondingHeaderOrSource(
Core::EditorManager::currentEditor()->document()->fileName());
if (!otherFile.isEmpty())
Core::EditorManager::openEditor(otherFile, Core::Id(), Core::EditorManager::OpenInOtherSplit
| Core::EditorManager::ModeSwitch);
Core::EditorManager::openEditor(otherFile, Core::Id(), Core::EditorManager::OpenInOtherSplit);
}
static QStringList findFilesInProject(const QString &name,
......
......@@ -592,7 +592,7 @@ void CvsPlugin::cvsDiff(const CvsDiffParameters &p)
const QString tag = VcsBaseEditorWidget::editorTag(DiffOutput, p.workingDir, p.files);
if (IEditor *existingEditor = VcsBaseEditorWidget::locateEditorByTag(tag)) {
existingEditor->createNew(output);
EditorManager::activateEditor(existingEditor, EditorManager::ModeSwitch);
EditorManager::activateEditor(existingEditor);
setDiffBaseDirectory(existingEditor, p.workingDir);
return;
}
......@@ -615,8 +615,7 @@ void CvsPlugin::cvsDiff(const CvsDiffParameters &p)
CvsSubmitEditor *CvsPlugin::openCVSSubmitEditor(const QString &fileName)
{
IEditor *editor = EditorManager::openEditor(fileName, Constants::CVSCOMMITEDITOR_ID,
EditorManager::ModeSwitch);
IEditor *editor = EditorManager::openEditor(fileName, Constants::CVSCOMMITEDITOR_ID);
CvsSubmitEditor *submitEditor = qobject_cast<CvsSubmitEditor*>(editor);
QTC_CHECK(submitEditor);
submitEditor->registerActions(m_submitUndoAction, m_submitRedoAction, m_submitCurrentLogAction, m_submitDiffAction);
......@@ -861,7 +860,7 @@ void CvsPlugin::filelog(const QString &workingDir,
const QString tag = VcsBaseEditorWidget::editorTag(LogOutput, workingDir, files);
if (Core::IEditor *editor = VcsBaseEditorWidget::locateEditorByTag(tag)) {
editor->createNew(response.stdOut);
Core::EditorManager::activateEditor(editor, Core::EditorManager::ModeSwitch);
Core::EditorManager::activateEditor(editor);
} else {
const QString title = QString::fromLatin1("cvs log %1").arg(id);
Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, LogOutput, source, codec);
......@@ -1004,7 +1003,7 @@ void CvsPlugin::annotate(const QString &workingDir, const QString &file,
if (IEditor *editor = VcsBaseEditorWidget::locateEditorByTag(tag)) {
editor->createNew(response.stdOut);
VcsBaseEditorWidget::gotoLineOfEditor(editor, lineNumber);
EditorManager::activateEditor(editor, EditorManager::ModeSwitch);
EditorManager::activateEditor(editor);
} else {
const QString title = QString::fromLatin1("cvs annotate %1").arg(id);
IEditor *newEditor = showOutputInEditor(title, response.stdOut, AnnotateOutput, source, codec);
......@@ -1199,7 +1198,7 @@ bool CvsPlugin::describe(const QString &repositoryPath,
const QString commitId = entries.front().revisions.front().commitId;
if (IEditor *editor = VcsBaseEditorWidget::locateEditorByTag(commitId)) {
editor->createNew(output);
EditorManager::activateEditor(editor, EditorManager::ModeSwitch);
EditorManager::activateEditor(editor);
setDiffBaseDirectory(editor, repositoryPath);
} else {
const QString title = QString::fromLatin1("cvs describe %1").arg(commitId);
......@@ -1285,7 +1284,7 @@ IEditor *CvsPlugin::showOutputInEditor(const QString& title, const QString &outp
if (codec)
e->setCodec(codec);
IEditor *ie = e->editor();
EditorManager::activateEditor(ie, EditorManager::ModeSwitch);
EditorManager::activateEditor(ie);
return ie;
}
......
......@@ -508,7 +508,6 @@ public:
setIcon(QIcon(QLatin1String(":/fancyactionbar/images/mode_Debug.png")));
setPriority(85);
setId(MODE_DEBUG);
setType(CC::MODE_EDIT_TYPE);
}
~DebugMode()
......
......@@ -472,8 +472,7 @@ void QmlInspectorAdapter::jumpToObjectDefinitionInEditor(
{
const QString fileName = m_engine->toFileInProject(objSource.url());
Core::EditorManager::openEditorAt(fileName, objSource.lineNumber(),
0, Core::Id(), Core::EditorManager::ModeSwitch);
Core::EditorManager::openEditorAt(fileName, objSource.lineNumber());
if (debugId != -1 && debugId != m_currentSelectedDebugId) {