Commit 21bf0046 authored by hjk's avatar hjk Committed by hjk

editormanager: simplify use of interface

Less code on the user side, same meaning.

Change-Id: I14e54a5d2ed8e024a51cce74eaf7c8419ad544be
Reviewed-by: default avatarEike Ziller <eike.ziller@nokia.com>
parent 2ef2532b
......@@ -73,10 +73,7 @@ static void moveCursorToEndOfName(QTextCursor *tc)
// We cannot depend on this since CppEditor plugin code is internal and requires building the implementation files ourselves
CPlusPlus::Symbol *AnalyzerUtils::findSymbolUnderCursor()
{
EditorManager *editorManager = EditorManager::instance();
if (!editorManager)
return 0;
IEditor *editor = editorManager->currentEditor();
IEditor *editor = EditorManager::currentEditor();
if (!editor)
return 0;
TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor);
......
......@@ -569,9 +569,9 @@ void BazaarPlugin::showCommitWidget(const QList<VcsBase::VcsBaseClient::StatusIt
return;
}
Core::IEditor *editor = Core::ICore::editorManager()->openEditor(m_changeLog->fileName(),
Constants::COMMIT_ID,
Core::EditorManager::ModeSwitch);
Core::IEditor *editor = Core::EditorManager::openEditor(m_changeLog->fileName(),
Constants::COMMIT_ID,
Core::EditorManager::ModeSwitch);
if (!editor) {
outputWindow->appendError(tr("Unable to create an editor for the commit."));
return;
......
......@@ -594,10 +594,7 @@ void BookmarkManager::prev()
TextEditor::ITextEditor *BookmarkManager::currentTextEditor() const
{
Core::EditorManager *em = Core::EditorManager::instance();
Core::IEditor *currEditor = em->currentEditor();
if (!currEditor)
return 0;
Core::IEditor *currEditor = EditorManager::currentEditor();
return qobject_cast<TextEditor::ITextEditor *>(currEditor);
}
......
......@@ -309,8 +309,7 @@ void Manager::gotoLocations(const QList<QVariant> &list)
bool currentPositionAvailable = false;
// what is open now?
Core::IEditor *editor = Core::EditorManager::instance()->currentEditor();
if (editor) {
if (Core::IEditor *editor = Core::EditorManager::currentEditor()) {
// get current file name
Core::IDocument *document = editor->document();
if (document)
......
......@@ -654,10 +654,9 @@ bool BaseFileWizard::postGenerateFiles(const QWizard *, const GeneratedFiles &l,
bool BaseFileWizard::postGenerateOpenEditors(const GeneratedFiles &l, QString *errorMessage)
{
Core::EditorManager *em = Core::EditorManager::instance();
foreach(const Core::GeneratedFile &file, l) {
if (file.attributes() & Core::GeneratedFile::OpenEditorAttribute) {
if (!em->openEditor(file.path(), file.editorId(), Core::EditorManager::ModeSwitch )) {
if (!Core::EditorManager::openEditor(file.path(), file.editorId(), Core::EditorManager::ModeSwitch )) {
if (errorMessage)
*errorMessage = tr("Failed to open an editor for '%1'.").arg(QDir::toNativeSeparators(file.path()));
return false;
......
......@@ -1095,9 +1095,9 @@ void DocumentManager::syncWithEditor(Core::IContext *context)
if (!context)
return;
Core::IEditor *editor = Core::EditorManager::instance()->currentEditor();
if (editor && (editor->widget() == context->widget()) &&
!editor->isTemporary())
Core::IEditor *editor = Core::EditorManager::currentEditor();
if (editor && editor->widget() == context->widget()
&& !editor->isTemporary())
setCurrentFile(editor->document()->fileName());
}
......@@ -1333,8 +1333,8 @@ void DocumentManager::populateOpenWithMenu(QMenu *menu, const QString &fileName)
bool anyMatches = false;
if (const MimeType mt = ICore::mimeDatabase()->findByFile(QFileInfo(fileName))) {
const EditorFactoryList factories = ICore::editorManager()->editorFactories(mt, false);
const ExternalEditorList externalEditors = ICore::editorManager()->externalEditors(mt, false);
const EditorFactoryList factories = EditorManager::editorFactories(mt, false);
const ExternalEditorList externalEditors = EditorManager::externalEditors(mt, false);
anyMatches = !factories.empty() || !externalEditors.empty();
if (anyMatches) {
// Add all suitable editors
......@@ -1363,11 +1363,11 @@ void DocumentManager::populateOpenWithMenu(QMenu *menu, const QString &fileName)
void DocumentManager::executeOpenWithMenuAction(QAction *action)
{
QTC_ASSERT(action, return);
EditorManager *em = EditorManager::instance();
const QVariant data = action->data();
OpenWithEntry entry = qVariantValue<OpenWithEntry>(data);
if (entry.editorFactory) {
// close any open editors that have this file open, but have a different type.
EditorManager *em = EditorManager::instance();
QList<IEditor *> editorsOpenForFile = em->editorsForFileName(entry.fileName);
if (!editorsOpenForFile.isEmpty()) {
foreach (IEditor *openEditor, editorsOpenForFile) {
......@@ -1378,11 +1378,11 @@ void DocumentManager::executeOpenWithMenuAction(QAction *action)
return;
}
em->openEditor(entry.fileName, entry.editorFactory->id(), EditorManager::ModeSwitch);
EditorManager::openEditor(entry.fileName, entry.editorFactory->id(), EditorManager::ModeSwitch);
return;
}
if (entry.externalEditor)
em->openExternalEditor(entry.fileName, entry.externalEditor->id());
EditorManager::openExternalEditor(entry.fileName, entry.externalEditor->id());
}
void DocumentManager::slotExecuteOpenWithMenuAction(QAction *action)
......
......@@ -111,6 +111,6 @@ void EditMode::grabEditorManager(Core::IMode *mode)
if (mode != this)
return;
if (m_editorManager->currentEditor())
m_editorManager->currentEditor()->widget()->setFocus();
if (EditorManager::currentEditor())
EditorManager::currentEditor()->widget()->setFocus();
}
......@@ -634,9 +634,9 @@ QList<IEditor *> EditorManager::editorsForDocument(IDocument *document) const
return found;
}
IEditor *EditorManager::currentEditor() const
IEditor *EditorManager::currentEditor()
{
return d->m_currentEditor;
return m_instance->d->m_currentEditor;
}
void EditorManager::emptyView(Core::Internal::EditorView *view)
......@@ -1047,12 +1047,12 @@ Core::IEditor *EditorManager::placeEditor(Core::Internal::EditorView *view, Core
void EditorManager::activateEditor(Core::IEditor *editor, OpenEditorFlags flags)
{
SplitterOrView *splitterOrView = d->m_splitter->findView(editor);
SplitterOrView *splitterOrView = m_instance->d->m_splitter->findView(editor);
EditorView *view = (splitterOrView ? splitterOrView->view() : 0);
// TODO an IEditor doesn't have to belong to a view, which makes this method a bit funny
if (!view)
view = currentEditorView();
activateEditor(view, editor, flags);
view = m_instance->currentEditorView();
m_instance->activateEditor(view, editor, flags);
}
Core::IEditor *EditorManager::activateEditor(Core::Internal::EditorView *view, Core::IEditor *editor, OpenEditorFlags flags)
......@@ -1124,7 +1124,7 @@ static void mimeTypeFactoryRecursion(const MimeDatabase *db,
}
EditorManager::EditorFactoryList
EditorManager::editorFactories(const MimeType &mimeType, bool bestMatchOnly) const
EditorManager::editorFactories(const MimeType &mimeType, bool bestMatchOnly)
{
EditorFactoryList rc;
const EditorFactoryList allFactories = pluginManager()->getObjects<IEditorFactory>();
......@@ -1135,7 +1135,7 @@ EditorManager::EditorFactoryList
}
EditorManager::ExternalEditorList
EditorManager::externalEditors(const MimeType &mimeType, bool bestMatchOnly) const
EditorManager::externalEditors(const MimeType &mimeType, bool bestMatchOnly)
{
ExternalEditorList rc;
const ExternalEditorList allEditors = pluginManager()->getObjects<IExternalEditor>();
......@@ -1187,11 +1187,11 @@ IEditor *EditorManager::createEditor(const Id &editorId, const QString &fileName
return 0;
}
IEditor *editor = factories.front()->createEditor(this);
IEditor *editor = factories.front()->createEditor(m_instance);
if (editor)
connect(editor, SIGNAL(changed()), this, SLOT(handleEditorStateChange()));
connect(editor, SIGNAL(changed()), m_instance, SLOT(handleEditorStateChange()));
if (editor)
emit editorCreated(editor, fileName);
emit m_instance->editorCreated(editor, fileName);
return editor;
}
......@@ -1257,7 +1257,7 @@ Core::Id EditorManager::getOpenWithEditorId(const QString &fileName,
IEditor *EditorManager::openEditor(const QString &fileName, const Id &editorId,
OpenEditorFlags flags, bool *newEditor)
{
return openEditor(currentEditorView(), fileName, editorId, flags, newEditor);
return m_instance->openEditor(m_instance->currentEditorView(), fileName, editorId, flags, newEditor);
}
int extractLineNumber(QString *fileName)
......@@ -1408,7 +1408,7 @@ IEditor *EditorManager::openEditorWithContents(const Id &editorId,
if (base.contains(dollar)) {
int i = 1;
QSet<QString> docnames;
foreach (IEditor *editor, openedEditors()) {
foreach (IEditor *editor, m_instance->openedEditors()) {
QString name = editor->document()->fileName();
if (name.isEmpty()) {
name = editor->displayName();
......@@ -1445,7 +1445,7 @@ IEditor *EditorManager::openEditorWithContents(const Id &editorId,
title = edt->displayName();
edt->setDisplayName(title);
addEditor(edt);
m_instance->addEditor(edt);
QApplication::restoreOverrideCursor();
return edt;
}
......
......@@ -117,12 +117,12 @@ public:
};
Q_DECLARE_FLAGS(OpenEditorFlags, OpenEditorFlag)
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);
IEditor *openEditorWithContents(const Id &editorId,
static IEditor *openEditorWithContents(const Id &editorId,
QString *titlePattern = 0, const QString &contents = QString());
bool openExternalEditor(const QString &fileName, const Id &editorId);
static bool openExternalEditor(const QString &fileName, const Id &editorId);
QStringList getOpenFileNames() const;
Id getOpenWithEditorId(const QString &fileName, bool *isExternalEditor = 0) const;
......@@ -131,11 +131,11 @@ public:
QList<IEditor *> editorsForFileName(const QString &filename) const;
QList<IEditor *> editorsForDocument(IDocument *document) const;
IEditor *currentEditor() const;
static IEditor *currentEditor();
QList<IEditor *> visibleEditors() const;
QList<IEditor*> openedEditors() const;
void activateEditor(IEditor *editor, OpenEditorFlags flags = 0);
static void activateEditor(IEditor *editor, OpenEditorFlags flags = 0);
void activateEditorForIndex(const QModelIndex &index, OpenEditorFlags = 0);
IEditor *activateEditorForDocument(Internal::EditorView *view, IDocument *document, OpenEditorFlags flags = 0);
......@@ -170,8 +170,8 @@ public:
void hideEditorStatusBar(const QString &id);
EditorFactoryList editorFactories(const MimeType &mimeType, bool bestMatchOnly = true) const;
ExternalEditorList externalEditors(const MimeType &mimeType, bool bestMatchOnly = true) const;
static EditorFactoryList editorFactories(const MimeType &mimeType, bool bestMatchOnly = true);
static ExternalEditorList externalEditors(const MimeType &mimeType, bool bestMatchOnly = true);
void setReloadSetting(IDocument::ReloadSetting behavior);
IDocument::ReloadSetting reloadSetting() const;
......@@ -238,7 +238,7 @@ public slots:
private:
QList<IDocument *> documentsForEditors(QList<IEditor *> editors) const;
IEditor *createEditor(const Id &id = Id(), const QString &fileName = QString());
static IEditor *createEditor(const Id &id = Id(), const QString &fileName = QString());
void addEditor(IEditor *editor, bool isDuplicate = false);
void removeEditor(IEditor *editor);
......
......@@ -798,7 +798,6 @@ QByteArray SplitterOrView::saveState() const
<< static_cast<SplitterOrView*>(m_splitter->widget(1))->saveState();
} else {
IEditor* e = editor();
EditorManager *em = ICore::editorManager();
// don't save state of temporary or ad-hoc editors
if (e && (e->isTemporary() || e->document()->fileName().isEmpty())) {
......@@ -814,7 +813,7 @@ QByteArray SplitterOrView::saveState() const
if (!e) {
stream << QByteArray("empty");
} else if (e == em->currentEditor()) {
} else if (e == EditorManager::currentEditor()) {
stream << QByteArray("currenteditor")
<< e->document()->fileName() << e->id().toString() << e->saveState();
} else {
......
......@@ -37,6 +37,6 @@
Core::IDocument *Core::IEditorFactory::open(const QString &fileName)
{
Core::IEditor *iface = Core::EditorManager::instance()->openEditor(fileName, id());
Core::IEditor *iface = Core::EditorManager::openEditor(fileName, id());
return iface ? iface->document() : 0;
}
......@@ -199,7 +199,7 @@ void OpenEditorsWidget::closeEditor(const QModelIndex &index)
{
EditorManager::instance()->closeEditor(index);
// work around selection changes
updateCurrentItem(EditorManager::instance()->currentEditor());
updateCurrentItem(EditorManager::currentEditor());
}
void OpenEditorsWidget::contextMenuRequested(QPoint pos)
......
......@@ -284,7 +284,7 @@ void OpenEditorsWindow::selectEditor(QTreeWidgetItem *item)
EditorView *view = item->data(0, Qt::UserRole+1).value<EditorView*>();
EditorManager::instance()->activateEditorForDocument(view, document, EditorManager::ModeSwitch);
} else {
if (!EditorManager::instance()->openEditor(
if (!EditorManager::openEditor(
item->toolTip(0), item->data(0, Qt::UserRole+2).value<Core::Id>(),
Core::EditorManager::ModeSwitch)) {
EditorManager::instance()->openedEditorsModel()->removeEditor(item->toolTip(0));
......
......@@ -245,15 +245,12 @@ void EditorToolBar::setCloseSplitIcon(const QIcon &icon)
void EditorToolBar::closeEditor()
{
if (!currentEditor())
IEditor *current = EditorManager::currentEditor();
if (!current)
return;
if (d->m_isStandalone) {
EditorManager *em = ICore::editorManager();
if (IEditor *editor = currentEditor()) {
em->closeEditor(editor);
}
}
if (d->m_isStandalone)
EditorManager::instance()->closeEditor(current);
emit closeClicked();
}
......@@ -349,8 +346,8 @@ void EditorToolBar::listContextMenu(QPoint pos)
void EditorToolBar::makeEditorWritable()
{
if (currentEditor())
ICore::editorManager()->makeFileWritable(currentEditor()->document());
if (IEditor *current = EditorManager::currentEditor())
EditorManager::instance()->makeFileWritable(current->document());
}
void EditorToolBar::setCanGoBack(bool canGoBack)
......@@ -372,15 +369,10 @@ void EditorToolBar::updateActionShortcuts()
d->m_closeSplitButton->setToolTip(am->command(Constants::REMOVE_CURRENT_SPLIT)->stringWithAppendedShortcut(tr("Remove Split")));
}
IEditor *EditorToolBar::currentEditor() const
{
return ICore::editorManager()->currentEditor();
}
void EditorToolBar::checkEditorStatus()
{
IEditor *editor = qobject_cast<IEditor *>(sender());
IEditor *current = currentEditor();
IEditor *current = EditorManager::currentEditor();
if (current == editor)
updateEditorStatus(editor);
......@@ -413,13 +405,13 @@ void EditorToolBar::updateEditorStatus(IEditor *editor)
d->m_lockButton->setEnabled(false);
d->m_lockButton->setToolTip(tr("File is writable"));
}
if (editor == currentEditor())
IEditor *current = EditorManager::currentEditor();
if (editor == current)
d->m_editorList->setToolTip(
currentEditor()->document()->fileName().isEmpty()
? currentEditor()->displayName()
current->document()->fileName().isEmpty()
? current->displayName()
: QDir::toNativeSeparators(editor->document()->fileName())
);
}
void EditorToolBar::setNavigationVisible(bool isVisible)
......
......@@ -107,7 +107,6 @@ private slots:
private:
void updateToolBar(QWidget *toolBar);
IEditor *currentEditor() const;
EditorToolBarPrivate *d;
};
......
......@@ -600,7 +600,7 @@ void ExternalToolRunner::run()
return;
}
if (m_tool->modifiesCurrentDocument()) {
if (IEditor *editor = EditorManager::instance()->currentEditor()) {
if (IEditor *editor = EditorManager::currentEditor()) {
m_expectedFileName = editor->document()->fileName();
bool cancelled = false;
DocumentManager::saveModifiedDocuments(QList<IDocument *>() << editor->document(), &cancelled);
......
......@@ -919,7 +919,7 @@ void MainWindow::openFiles(const QStringList &fileNames, ICore::OpenFilesFlags f
emFlags = EditorManager::ModeSwitch;
if (flags & ICore::CanContainLineNumbers)
emFlags |= EditorManager::CanContainLineNumber;
Core::IEditor *editor = editorManager()->openEditor(absoluteFilePath, Id(), emFlags);
Core::IEditor *editor = EditorManager::openEditor(absoluteFilePath, Id(), emFlags);
if (!editor && (flags & ICore::StopOnLoadFail))
return;
}
......@@ -931,7 +931,7 @@ void MainWindow::setFocusToEditor()
bool focusWasMovedToEditor = false;
// give focus to the editor if we have one
if (IEditor *editor = m_editorManager->currentEditor()) {
if (IEditor *editor = EditorManager::currentEditor()) {
if (qApp->focusWidget() != editor->widget()->focusWidget()) {
QWidget *w = editor->widget()->focusWidget();
if (!w)
......@@ -1055,9 +1055,9 @@ void MainWindow::openFileWith()
if (!editorId.isValid())
continue;
if (isExternal) {
editorManager()->openExternalEditor(fileName, editorId);
EditorManager::openExternalEditor(fileName, editorId);
} else {
editorManager()->openEditor(fileName, editorId, Core::EditorManager::ModeSwitch);
EditorManager::openEditor(fileName, editorId, Core::EditorManager::ModeSwitch);
}
}
}
......@@ -1352,7 +1352,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, Core::EditorManager::ModeSwitch);
EditorManager::openEditor(file.first, file.second, EditorManager::ModeSwitch);
}
}
......
......@@ -141,12 +141,12 @@ void MimeTypeSettingsModel::load()
foreach (const MimeType &mimeType, m_mimeTypes) {
QString value;
const QList<IEditorFactory *> factories =
ICore::editorManager()->editorFactories(mimeType);
EditorManager::editorFactories(mimeType);
if (!factories.isEmpty()) {
value = factories.front()->displayName();
} else {
const QList<IExternalEditor *> externalEditors =
ICore::editorManager()->externalEditors(mimeType);
EditorManager::externalEditors(mimeType);
if (!externalEditors.isEmpty())
value = externalEditors.front()->displayName();
else
......
......@@ -386,7 +386,7 @@ void OutputPaneManager::slotHide()
m_buttons.value(idx)->setChecked(false);
if (m_pageMap.value(idx))
m_pageMap.value(idx)->visibilityChanged(false);
if (IEditor *editor = Core::EditorManager::instance()->currentEditor()) {
if (IEditor *editor = Core::EditorManager::currentEditor()) {
QWidget *w = editor->widget()->focusWidget();
if (!w)
w = editor->widget();
......
......@@ -206,7 +206,7 @@ void CodepasterPlugin::postEditor()
{
QString data;
QString mimeType;
if (IEditor* editor = EditorManager::instance()->currentEditor()) {
if (IEditor *editor = EditorManager::currentEditor()) {
if (ITextEditor *textEditor = qobject_cast<ITextEditor *>(editor)) {
data = textEditor->selectedText();
if (data.isEmpty())
......@@ -365,7 +365,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::instance()->openEditor(fileName, Core::Id(), EditorManager::ModeSwitch);
Core::IEditor *editor = EditorManager::openEditor(fileName, Core::Id(), EditorManager::ModeSwitch);
QTC_ASSERT(editor, return);
editor->setDisplayName(titleDescription);
}
......
......@@ -688,7 +688,7 @@ void CPPEditorWidget::onDocumentUpdated(Document::Ptr doc)
return;
if (! m_initialized ||
(Core::EditorManager::instance()->currentEditor() == editor()
(Core::EditorManager::currentEditor() == editor()
&& (!m_lastSemanticInfo.doc
|| !m_lastSemanticInfo.doc->translationUnit()->ast()
|| m_lastSemanticInfo.doc->fileName() != editorDocument()->fileName()))) {
......@@ -1869,7 +1869,7 @@ void CPPEditorWidget::updateSemanticInfo(const SemanticInfo &semanticInfo)
m_highlighter.cancel();
if (! semanticHighlighterDisabled && semanticInfo.doc) {
if (Core::EditorManager::instance()->currentEditor() == editor()) {
if (Core::EditorManager::currentEditor() == editor()) {
if (m_highlightingSupport) {
m_highlighter = m_highlightingSupport->highlightingFuture(semanticInfo.doc, semanticInfo.snapshot);
m_highlightRevision = semanticInfo.revision;
......@@ -2224,7 +2224,7 @@ void CPPEditorWidget::updateFunctionDeclDefLink()
void CPPEditorWidget::updateFunctionDeclDefLinkNow()
{
if (Core::EditorManager::instance()->currentEditor() != editor())
if (Core::EditorManager::currentEditor() != editor())
return;
if (m_declDefLink) {
// update the change marker
......
......@@ -339,24 +339,21 @@ ExtensionSystem::IPlugin::ShutdownFlag CppPlugin::aboutToShutdown()
void CppPlugin::switchDeclarationDefinition()
{
Core::EditorManager *em = Core::EditorManager::instance();
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(em->currentEditor()->widget());
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(Core::EditorManager::currentEditor()->widget());
if (editor)
editor->switchDeclarationDefinition();
}
void CppPlugin::renameSymbolUnderCursor()
{
Core::EditorManager *em = Core::EditorManager::instance();
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(em->currentEditor()->widget());
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(Core::EditorManager::currentEditor()->widget());
if (editor)
editor->renameSymbolUnderCursor();
}
void CppPlugin::findUsages()
{
Core::EditorManager *em = Core::EditorManager::instance();
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(em->currentEditor()->widget());
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(Core::EditorManager::currentEditor()->widget());
if (editor)
editor->findUsages();
}
......@@ -393,8 +390,7 @@ void CppPlugin::currentEditorChanged(Core::IEditor *editor)
void CppPlugin::openTypeHierarchy()
{
Core::EditorManager *em = Core::EditorManager::instance();
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(em->currentEditor()->widget());
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(Core::EditorManager::currentEditor()->widget());
if (editor) {
Core::NavigationWidget *navigation = Core::NavigationWidget::instance();
navigation->activateSubWidget(Core::Id(Constants::TYPE_HIERARCHY_ID));
......
......@@ -248,8 +248,7 @@ void CppTypeHierarchyWidget::onItemClicked(const QModelIndex &index)
// CppTypeHierarchyStackedWidget
CppTypeHierarchyStackedWidget::CppTypeHierarchyStackedWidget(QWidget *parent) :
QStackedWidget(parent),
m_typeHiearchyWidgetInstance(
new CppTypeHierarchyWidget(Core::EditorManager::instance()->currentEditor()))
m_typeHiearchyWidgetInstance(new CppTypeHierarchyWidget(Core::EditorManager::currentEditor()))
{
addWidget(m_typeHiearchyWidgetInstance);
......
......@@ -315,8 +315,8 @@ void CppFileSettingsWidget::slotEdit()
setLicenseTemplatePath(path);
}
// Edit (now) existing file with C++
Core::EditorManager::instance()->openEditor(path, CppEditor::Constants::CPPEDITOR_ID,
Core::EditorManager::ModeSwitch);
Core::EditorManager::openEditor(path, CppEditor::Constants::CPPEDITOR_ID,
Core::EditorManager::ModeSwitch);
}
// --------------- CppFileSettingsPage
......
......@@ -519,8 +519,8 @@ void CppFindReferences::openEditor(const Find::SearchResultItem &item)
Core::Id(),
Core::EditorManager::ModeSwitch);
} else {
Core::EditorManager::instance()->openEditor(QDir::fromNativeSeparators(item.text),
Core::Id(), Core::EditorManager::ModeSwitch);
Core::EditorManager::openEditor(QDir::fromNativeSeparators(item.text),
Core::Id(), Core::EditorManager::ModeSwitch);
}
}
......
......@@ -159,11 +159,10 @@ ExtensionSystem::IPlugin::ShutdownFlag CppToolsPlugin::aboutToShutdown()
void CppToolsPlugin::switchHeaderSource()
{
Core::EditorManager *editorManager = Core::EditorManager::instance();
Core::IEditor *editor = editorManager->currentEditor();
Core::IEditor *editor = Core::EditorManager::currentEditor();
QString otherFile = correspondingHeaderOrSource(editor->document()->fileName());
if (!otherFile.isEmpty())
editorManager->openEditor(otherFile);
Core::EditorManager::openEditor(otherFile);
}
static QStringList findFilesInProject(const QString &name,
......
......@@ -611,7 +611,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::instance()->activateEditor(existingEditor, EditorManager::ModeSwitch);
EditorManager::activateEditor(existingEditor, EditorManager::ModeSwitch);
setDiffBaseDirectory(existingEditor, p.workingDir);
return;
}
......@@ -635,8 +635,8 @@ void CvsPlugin::cvsDiff(const CvsDiffParameters &p)
CvsSubmitEditor *CvsPlugin::openCVSSubmitEditor(const QString &fileName)
{
IEditor *editor = EditorManager::instance()->openEditor(fileName, Constants::CVSCOMMITEDITOR_ID,
EditorManager::ModeSwitch);
IEditor *editor = EditorManager::openEditor(fileName, Constants::CVSCOMMITEDITOR_ID,
EditorManager::ModeSwitch);
CvsSubmitEditor *submitEditor = qobject_cast<CvsSubmitEditor*>(editor);
QTC_CHECK(submitEditor);
submitEditor->registerActions(m_submitUndoAction, m_submitRedoAction, m_submitCurrentLogAction, m_submitDiffAction);
......@@ -883,7 +883,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::instance()->activateEditor(editor, Core::EditorManager::ModeSwitch);
Core::EditorManager::activateEditor(editor, Core::EditorMan