summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/bookmarks/bookmarkmanager.cpp3
-rw-r--r--src/plugins/clearcase/clearcaseplugin.cpp2
-rw-r--r--src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp2
-rw-r--r--src/plugins/coreplugin/documentmanager.cpp6
-rw-r--r--src/plugins/coreplugin/editmode.cpp5
-rw-r--r--src/plugins/coreplugin/editmode.h1
-rw-r--r--src/plugins/coreplugin/editormanager/editormanager.cpp90
-rw-r--r--src/plugins/coreplugin/editormanager/editormanager.h186
-rw-r--r--src/plugins/coreplugin/editormanager/editorview.cpp19
-rw-r--r--src/plugins/coreplugin/editormanager/openeditorsview.cpp8
-rw-r--r--src/plugins/coreplugin/editormanager/openeditorswindow.cpp2
-rw-r--r--src/plugins/coreplugin/editortoolbar.cpp13
-rw-r--r--src/plugins/coreplugin/generalsettings.cpp12
-rw-r--r--src/plugins/coreplugin/textdocument.cpp2
-rw-r--r--src/plugins/cppeditor/cppdoxygen_test.cpp2
-rw-r--r--src/plugins/cppeditor/cppoutline.cpp5
-rw-r--r--src/plugins/cppeditor/cppquickfix_test.cpp2
-rw-r--r--src/plugins/cppeditor/cpptypehierarchy.cpp2
-rw-r--r--src/plugins/cppeditor/fileandtokenactions_test.cpp27
-rw-r--r--src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp4
-rw-r--r--src/plugins/cpptools/cppcompletion_test.cpp2
-rw-r--r--src/plugins/cpptools/cppfilesettingspage.cpp3
-rw-r--r--src/plugins/cpptools/cppfindreferences.cpp2
-rw-r--r--src/plugins/cpptools/cpplocatorfilter_test.cpp2
-rw-r--r--src/plugins/cpptools/cppmodelmanager_test.cpp10
-rw-r--r--src/plugins/cpptools/cpppreprocessor.cpp3
-rw-r--r--src/plugins/cpptools/cpptoolseditorsupport.cpp2
-rw-r--r--src/plugins/cvs/cvsplugin.cpp2
-rw-r--r--src/plugins/debugger/debuggertooltipmanager.cpp2
-rw-r--r--src/plugins/debugger/disassembleragent.cpp3
-rw-r--r--src/plugins/debugger/imageviewer.cpp2
-rw-r--r--src/plugins/debugger/memoryagent.cpp4
-rw-r--r--src/plugins/debugger/qml/qmlengine.cpp4
-rw-r--r--src/plugins/debugger/qml/qmlinspectoradapter.cpp2
-rw-r--r--src/plugins/debugger/sourceagent.cpp3
-rw-r--r--src/plugins/designer/gotoslot_test.cpp2
-rw-r--r--src/plugins/fakevim/fakevim_test.cpp2
-rw-r--r--src/plugins/fakevim/fakevimplugin.cpp8
-rw-r--r--src/plugins/git/gitsubmiteditor.cpp2
-rw-r--r--src/plugins/macros/findmacrohandler.cpp3
-rw-r--r--src/plugins/macros/macromanager.cpp4
-rw-r--r--src/plugins/macros/texteditormacrohandler.cpp2
-rw-r--r--src/plugins/perforce/perforceplugin.cpp2
-rw-r--r--src/plugins/projectexplorer/editorconfiguration.cpp6
-rw-r--r--src/plugins/qmljseditor/qmljseditor.cpp5
-rw-r--r--src/plugins/qmljseditor/qmljsoutline.cpp5
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertool.cpp2
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp3
-rw-r--r--src/plugins/qnx/bardescriptordocument.cpp2
-rw-r--r--src/plugins/subversion/subversionplugin.cpp2
-rw-r--r--src/plugins/texteditor/basetexteditor.cpp15
-rw-r--r--src/plugins/texteditor/basetextmark.cpp3
-rw-r--r--src/plugins/texteditor/behaviorsettingspage.cpp3
-rw-r--r--src/plugins/texteditor/findincurrentfile.cpp2
-rw-r--r--src/plugins/texteditor/findinfiles.cpp2
-rw-r--r--src/plugins/texteditor/findinopenfiles.cpp6
-rw-r--r--src/plugins/texteditor/linenumberfilter.cpp5
-rw-r--r--src/plugins/texteditor/outlinefactory.cpp3
-rw-r--r--src/plugins/texteditor/refactoringchanges.cpp4
-rw-r--r--src/plugins/todo/todoitemsprovider.cpp4
-rw-r--r--src/plugins/vcsbase/vcsbaseeditor.cpp3
61 files changed, 245 insertions, 294 deletions
diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp
index 73373051c0..cedcf1542d 100644
--- a/src/plugins/bookmarks/bookmarkmanager.cpp
+++ b/src/plugins/bookmarks/bookmarkmanager.cpp
@@ -579,8 +579,7 @@ void BookmarkManager::documentPrevNext(bool next)
nextLine = markLine;
}
- Core::EditorManager *em = Core::EditorManager::instance();
- em->addCurrentPositionToNavigationHistory();
+ EditorManager::addCurrentPositionToNavigationHistory();
if (next) {
if (nextLine == -1)
editor->gotoLine(firstLine);
diff --git a/src/plugins/clearcase/clearcaseplugin.cpp b/src/plugins/clearcase/clearcaseplugin.cpp
index fe36c0e449..64cf2eb283 100644
--- a/src/plugins/clearcase/clearcaseplugin.cpp
+++ b/src/plugins/clearcase/clearcaseplugin.cpp
@@ -1350,7 +1350,7 @@ void ClearCasePlugin::describe(const QString &source, const QString &changeNr)
void ClearCasePlugin::checkInSelected()
{
m_submitActionTriggered = true;
- Core::EditorManager::instance()->closeEditor();
+ Core::EditorManager::closeEditor();
}
QString ClearCasePlugin::runCleartoolSync(const QString &workingDir,
diff --git a/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp b/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp
index e5c6b737dd..7ce8378dde 100644
--- a/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp
+++ b/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp
@@ -267,7 +267,7 @@ int ReadOnlyFilesDialog::exec()
}
break;
case RO_SaveAs:
- if (!EditorManager::instance()->saveDocumentAs(d->document)) {
+ if (!EditorManager::saveDocumentAs(d->document)) {
failedToMakeWritable << buttengroup.fileName;
continue;
}
diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp
index b9050460de..8ab45b23f3 100644
--- a/src/plugins/coreplugin/documentmanager.cpp
+++ b/src/plugins/coreplugin/documentmanager.cpp
@@ -646,7 +646,7 @@ static QList<IDocument *> saveModifiedFilesHelper(const QList<IDocument *> &docu
}
}
foreach (IDocument *document, documentsToSave) {
- if (!EditorManager::instance()->saveDocument(document)) {
+ if (!EditorManager::saveDocument(document)) {
if (cancelled)
*cancelled = true;
notSaved.append(document);
@@ -823,7 +823,7 @@ void DocumentManager::checkForReload()
d->m_blockActivated = true;
- IDocument::ReloadSetting defaultBehavior = EditorManager::instance()->reloadSetting();
+ IDocument::ReloadSetting defaultBehavior = EditorManager::reloadSetting();
Utils::ReloadPromptAnswer previousAnswer = Utils::ReloadCurrent;
QList<IDocument *> documentsToClose;
@@ -1340,7 +1340,7 @@ void DocumentManager::executeOpenWithMenuAction(QAction *action)
if (entry.editorFactory->id() == openEditor->id())
editorsOpenForFile.removeAll(openEditor);
}
- if (!EditorManager::instance()->closeEditors(editorsOpenForFile)) // don't open if cancel was pressed
+ if (!EditorManager::closeEditors(editorsOpenForFile)) // don't open if cancel was pressed
return;
}
diff --git a/src/plugins/coreplugin/editmode.cpp b/src/plugins/coreplugin/editmode.cpp
index 1a6072e978..ce77f78c69 100644
--- a/src/plugins/coreplugin/editmode.cpp
+++ b/src/plugins/coreplugin/editmode.cpp
@@ -49,7 +49,6 @@ EditMode::EditMode() :
m_splitter(new MiniSplitter),
m_rightSplitWidgetLayout(new QVBoxLayout)
{
- m_editorManager = EditorManager::instance();
setObjectName(QLatin1String("EditMode"));
setDisplayName(tr("Edit"));
setIcon(QIcon(QLatin1String(":/fancyactionbar/images/mode_Edit.png")));
@@ -84,7 +83,7 @@ EditMode::EditMode() :
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
this, SLOT(grabEditorManager(Core::IMode*)));
- m_splitter->setFocusProxy(m_editorManager);
+ m_splitter->setFocusProxy(EditorManager::instance());
setWidget(m_splitter);
setContext(Context(Constants::C_EDIT_MODE,
@@ -95,7 +94,7 @@ EditMode::EditMode() :
EditMode::~EditMode()
{
// Make sure the editor manager does not get deleted
- m_editorManager->setParent(0);
+ EditorManager::instance()->setParent(0);
delete m_splitter;
}
diff --git a/src/plugins/coreplugin/editmode.h b/src/plugins/coreplugin/editmode.h
index 83592731a3..2e65e5e5a7 100644
--- a/src/plugins/coreplugin/editmode.h
+++ b/src/plugins/coreplugin/editmode.h
@@ -55,7 +55,6 @@ private slots:
void grabEditorManager(Core::IMode *mode);
private:
- EditorManager *m_editorManager;
QSplitter *m_splitter;
QVBoxLayout *m_rightSplitWidgetLayout;
};
diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp
index 6a253e484a..f910f8da69 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.cpp
+++ b/src/plugins/coreplugin/editormanager/editormanager.cpp
@@ -96,31 +96,15 @@ namespace Internal {
class EditorClosingCoreListener : public ICoreListener
{
public:
- EditorClosingCoreListener(EditorManager *em);
- bool editorAboutToClose(IEditor *editor);
- bool coreAboutToClose();
-
-private:
- EditorManager *m_em;
+ bool editorAboutToClose(IEditor *) { return true; }
+ bool coreAboutToClose()
+ {
+ // Do not ask for files to save.
+ // MainWindow::closeEvent has already done that.
+ return EditorManager::closeAllEditors(false);
+ }
};
-EditorClosingCoreListener::EditorClosingCoreListener(EditorManager *em)
- : m_em(em)
-{
-}
-
-bool EditorClosingCoreListener::editorAboutToClose(IEditor *)
-{
- return true;
-}
-
-bool EditorClosingCoreListener::coreAboutToClose()
-{
- // Do not ask for files to save.
- // MainWindow::closeEvent has already done that.
- return m_em->closeAllEditors(false);
-}
-
} // namespace Internal
} // namespace Core
@@ -269,7 +253,7 @@ EditorManagerPrivate::~EditorManagerPrivate()
static EditorManager *m_instance = 0;
static EditorManagerPrivate *d;
-EditorManager *EditorManager::instance() { return m_instance; }
+QWidget *EditorManager::instance() { return m_instance; }
EditorManager::EditorManager(QWidget *parent) :
QWidget(parent)
@@ -477,7 +461,7 @@ EditorManager::~EditorManager()
void EditorManager::init()
{
- d->m_coreListener = new EditorClosingCoreListener(this);
+ d->m_coreListener = new EditorClosingCoreListener();
ExtensionSystem::PluginManager::addObject(d->m_coreListener);
d->m_openEditorsFactory = new OpenEditorsViewFactory();
@@ -489,7 +473,7 @@ void EditorManager::init()
VariableManager::registerVariable(kCurrentDocumentYPos,
tr("Y-coordinate of the current editor's upper left corner, relative to screen."));
connect(VariableManager::instance(), SIGNAL(variableUpdateRequested(QByteArray)),
- this, SLOT(updateVariable(QByteArray)));
+ m_instance, SLOT(updateVariable(QByteArray)));
}
void EditorManager::updateAutoSave()
@@ -530,7 +514,7 @@ void EditorManager::handleContextChange(const QList<Core::IContext *> &context)
// the locator line edit) first activates the window and sets focus to its focus widget.
// Only afterwards the focus is shifted to the widget that received the click.
d->m_scheduledCurrentEditor = editor;
- QTimer::singleShot(0, this, SLOT(setCurrentEditorFromContextChange()));
+ QTimer::singleShot(0, m_instance, SLOT(setCurrentEditorFromContextChange()));
} else {
updateActions();
}
@@ -555,7 +539,7 @@ void EditorManager::setCurrentEditor(IEditor *editor, bool ignoreNavigationHisto
}
updateActions();
updateWindowTitle();
- emit currentEditorChanged(editor);
+ emit m_instance->currentEditorChanged(editor);
}
@@ -578,7 +562,7 @@ void EditorManager::setCurrentView(Internal::EditorView *view)
}
}
-Internal::EditorView *EditorManager::currentEditorView() const
+Internal::EditorView *EditorManager::currentEditorView()
{
EditorView *view = d->m_currentView;
if (!view) {
@@ -656,12 +640,12 @@ void EditorManager::emptyView(Core::Internal::EditorView *view)
view->removeEditor(editor);
continue; // don't close the editor
}
- emit editorAboutToClose(editor);
+ emit m_instance->editorAboutToClose(editor);
removeEditor(editor);
view->removeEditor(editor);
}
if (!editors.isEmpty()) {
- emit editorsClosed(editors);
+ emit m_instance->editorsClosed(editors);
foreach (IEditor *editor, editors) {
delete editor;
}
@@ -1078,7 +1062,7 @@ bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool ask
// remove the editors
foreach (IEditor *editor, acceptedEditors) {
- emit editorAboutToClose(editor);
+ emit m_instance->editorAboutToClose(editor);
if (!editor->document()->filePath().isEmpty()
&& !editor->document()->isTemporary()) {
QByteArray state = editor->saveState();
@@ -1127,7 +1111,7 @@ bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool ask
}
}
- emit editorsClosed(acceptedEditors.toList());
+ emit m_instance->editorsClosed(acceptedEditors.toList());
foreach (IEditor *editor, acceptedEditors) {
delete editor;
@@ -1141,7 +1125,7 @@ bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool ask
}
if (!currentEditor()) {
- emit currentEditorChanged(0);
+ emit m_instance->currentEditorChanged(0);
updateActions();
updateWindowTitle();
}
@@ -1149,7 +1133,7 @@ bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool ask
return !closingFailed;
}
-Core::IEditor *EditorManager::pickUnusedEditor(EditorView **foundView) const
+Core::IEditor *EditorManager::pickUnusedEditor(EditorView **foundView)
{
foreach (IEditor *editor,
d->m_documentModel->editorsForDocuments(d->m_documentModel->openedDocuments())) {
@@ -1413,13 +1397,13 @@ void EditorManager::addEditor(IEditor *editor)
if (!isTemporary)
DocumentManager::addToRecentFiles(editor->document()->filePath(), editor->id());
}
- emit editorOpened(editor);
+ emit m_instance->editorOpened(editor);
}
// Run the OpenWithDialog and return the editor id
// selected by the user.
Core::Id EditorManager::getOpenWithEditorId(const QString &fileName,
- bool *isExternalEditor) const
+ bool *isExternalEditor)
{
// Collect editors that can open the file
MimeType mt = ICore::mimeDatabase()->findByFile(fileName);
@@ -1619,7 +1603,7 @@ bool EditorManager::openExternalEditor(const QString &fileName, const Core::Id &
return ok;
}
-QStringList EditorManager::getOpenFileNames() const
+QStringList EditorManager::getOpenFileNames()
{
QString selectedFilter;
const QString &fileFilters = ICore::mimeDatabase()->allFiltersString(&selectedFilter);
@@ -1945,12 +1929,12 @@ void EditorManager::updateMakeWritableWarning()
InfoBarEntry info(Id(kMakeWritableWarning),
tr("<b>Warning:</b> This file was not opened in %1 yet.")
.arg(versionControl->displayName()));
- info.setCustomButtonInfo(tr("Open"), this, SLOT(vcsOpenCurrentEditor()));
+ info.setCustomButtonInfo(tr("Open"), m_instance, SLOT(vcsOpenCurrentEditor()));
document->infoBar()->addInfo(info);
} else {
InfoBarEntry info(Id(kMakeWritableWarning),
tr("<b>Warning:</b> You are changing a read-only file."));
- info.setCustomButtonInfo(tr("Make Writable"), this, SLOT(makeCurrentEditorWritable()));
+ info.setCustomButtonInfo(tr("Make Writable"), m_instance, SLOT(makeCurrentEditorWritable()));
document->infoBar()->addInfo(info);
}
} else {
@@ -1984,10 +1968,10 @@ void EditorManager::updateActions()
if (curDocument) {
if (HostOsInfo::isMacHost())
- window()->setWindowModified(curDocument->isModified());
+ m_instance->window()->setWindowModified(curDocument->isModified());
updateMakeWritableWarning();
} else /* curEditor */ if (HostOsInfo::isMacHost()) {
- window()->setWindowModified(false);
+ m_instance->window()->setWindowModified(false);
}
foreach (SplitterOrView *root, d->m_root)
@@ -2031,7 +2015,7 @@ void EditorManager::setCloseSplitEnabled(SplitterOrView *splitterOrView, bool en
}
}
-bool EditorManager::hasSplitter() const
+bool EditorManager::hasSplitter()
{
EditorView *view = currentEditorView();
QTC_ASSERT(view, return false);
@@ -2040,7 +2024,7 @@ bool EditorManager::hasSplitter() const
return root->isSplitter();
}
-QList<IEditor*> EditorManager::visibleEditors() const
+QList<IEditor*> EditorManager::visibleEditors()
{
QList<IEditor *> editors;
foreach (SplitterOrView *root, d->m_root) {
@@ -2098,12 +2082,12 @@ void EditorManager::goForwardInNavigationHistory()
updateActions();
}
-OpenEditorsWindow *EditorManager::windowPopup() const
+OpenEditorsWindow *EditorManager::windowPopup()
{
return d->m_windowPopup;
}
-void EditorManager::showPopupOrSelectDocument() const
+void EditorManager::showPopupOrSelectDocument()
{
if (QApplication::keyboardModifiers() == Qt::NoModifier) {
windowPopup()->selectAndHide();
@@ -2134,7 +2118,7 @@ void EditorManager::showPopupOrSelectDocument() const
}
// Save state of all non-teporary editors.
-QByteArray EditorManager::saveState() const
+QByteArray EditorManager::saveState()
{
QByteArray bytes;
QDataStream stream(&bytes, QIODevice::WriteOnly);
@@ -2323,7 +2307,7 @@ void EditorManager::setReloadSetting(IDocument::ReloadSetting behavior)
d->m_reloadSetting = behavior;
}
-IDocument::ReloadSetting EditorManager::reloadSetting() const
+IDocument::ReloadSetting EditorManager::reloadSetting()
{
return d->m_reloadSetting;
}
@@ -2334,7 +2318,7 @@ void EditorManager::setAutoSaveEnabled(bool enabled)
updateAutoSave();
}
-bool EditorManager::autoSaveEnabled() const
+bool EditorManager::autoSaveEnabled()
{
return d->m_autoSaveEnabled;
}
@@ -2345,12 +2329,12 @@ void EditorManager::setAutoSaveInterval(int interval)
updateAutoSave();
}
-int EditorManager::autoSaveInterval() const
+int EditorManager::autoSaveInterval()
{
return d->m_autoSaveInterval;
}
-QTextCodec *EditorManager::defaultTextCodec() const
+QTextCodec *EditorManager::defaultTextCodec()
{
QSettings *settings = Core::ICore::settings();
if (QTextCodec *candidate = QTextCodec::codecForName(
@@ -2368,7 +2352,7 @@ Core::IEditor *EditorManager::duplicateEditor(Core::IEditor *editor)
IEditor *duplicate = editor->duplicate(0);
duplicate->restoreState(editor->saveState());
- emit editorCreated(duplicate, duplicate->document()->filePath());
+ emit m_instance->editorCreated(duplicate, duplicate->document()->filePath());
addEditor(duplicate);
return duplicate;
}
@@ -2502,7 +2486,7 @@ void EditorManager::setWindowTitleAddition(const QString &addition)
updateWindowTitle();
}
-QString EditorManager::windowTitleAddition() const
+QString EditorManager::windowTitleAddition()
{
return d->m_titleAddition;
}
diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h
index bddc88cf6b..0ccb060f3f 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.h
+++ b/src/plugins/coreplugin/editormanager/editormanager.h
@@ -95,7 +95,7 @@ public:
typedef QList<IEditorFactory *> EditorFactoryList;
typedef QList<IExternalEditor *> ExternalEditorList;
- static EditorManager *instance();
+ static QWidget *instance();
static EditorToolBar *createToolBar(QWidget *parent = 0);
@@ -119,74 +119,74 @@ public:
static bool openExternalEditor(const QString &fileName, const Id &editorId);
- QStringList getOpenFileNames() const;
- Id getOpenWithEditorId(const QString &fileName, bool *isExternalEditor = 0) const;
+ static QStringList getOpenFileNames();
+ static Id getOpenWithEditorId(const QString &fileName, bool *isExternalEditor = 0);
static IDocument *currentDocument();
static IEditor *currentEditor();
- QList<IEditor *> visibleEditors() const;
+ static QList<IEditor *> visibleEditors();
static void activateEditor(IEditor *editor, OpenEditorFlags flags = 0);
- void activateEditorForEntry(DocumentModel::Entry *entry, OpenEditorFlags flags = 0);
- IEditor *activateEditorForDocument(IDocument *document, OpenEditorFlags flags = 0);
- IEditor *activateEditorForDocument(Internal::EditorView *view, IDocument *document, OpenEditorFlags flags = 0);
+ static void activateEditorForEntry(DocumentModel::Entry *entry, OpenEditorFlags flags = 0);
+ static IEditor *activateEditorForDocument(IDocument *document, OpenEditorFlags flags = 0);
+ static IEditor *activateEditorForDocument(Internal::EditorView *view, IDocument *document, OpenEditorFlags flags = 0);
static DocumentModel *documentModel();
static bool closeDocuments(const QList<IDocument *> &documents, bool askAboutModifiedEditors = true);
- void closeEditor(DocumentModel::Entry *entry);
- void closeOtherEditors(IDocument *document);
+ static void closeEditor(DocumentModel::Entry *entry);
+ static void closeOtherEditors(IDocument *document);
- void addCurrentPositionToNavigationHistory(IEditor *editor = 0, const QByteArray &saveState = QByteArray());
- void cutForwardNavigationHistory();
+ static void addCurrentPositionToNavigationHistory(IEditor *editor = 0, const QByteArray &saveState = QByteArray());
+ static void cutForwardNavigationHistory();
- bool saveEditor(IEditor *editor);
+ static bool saveEditor(IEditor *editor);
- bool closeEditors(const QList<IEditor *> &editorsToClose, bool askAboutModifiedEditors = true);
- void closeEditor(IEditor *editor, bool askAboutModifiedEditors = true);
+ static bool closeEditors(const QList<IEditor *> &editorsToClose, bool askAboutModifiedEditors = true);
+ static void closeEditor(IEditor *editor, bool askAboutModifiedEditors = true);
- MakeWritableResult makeFileWritable(IDocument *document);
+ static MakeWritableResult makeFileWritable(IDocument *document);
- QByteArray saveState() const;
- bool restoreState(const QByteArray &state);
- bool hasSplitter() const;
+ static QByteArray saveState();
+ static bool restoreState(const QByteArray &state);
+ static bool hasSplitter();
- void saveSettings();
- void readSettings();
+ static void saveSettings();
+ static void readSettings();
- Internal::OpenEditorsWindow *windowPopup() const;
- void showPopupOrSelectDocument() const;
+ static Internal::OpenEditorsWindow *windowPopup();
+ static void showPopupOrSelectDocument();
- void showEditorStatusBar(const QString &id,
+ static void showEditorStatusBar(const QString &id,
const QString &infoText,
const QString &buttonText = QString(),
QObject *object = 0, const char *member = 0);
- void hideEditorStatusBar(const QString &id);
+ static void hideEditorStatusBar(const QString &id);
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;
+ static void setReloadSetting(IDocument::ReloadSetting behavior);
+ static IDocument::ReloadSetting reloadSetting();
- void setAutoSaveEnabled(bool enabled);
- bool autoSaveEnabled() const;
- void setAutoSaveInterval(int interval);
- int autoSaveInterval() const;
+ static void setAutoSaveEnabled(bool enabled);
+ static bool autoSaveEnabled();
+ static void setAutoSaveInterval(int interval);
+ static int autoSaveInterval();
static bool isAutoSaveFile(const QString &fileName);
- QTextCodec *defaultTextCodec() const;
+ static QTextCodec *defaultTextCodec();
static qint64 maxTextFileSize();
- void setWindowTitleAddition(const QString &addition);
- QString windowTitleAddition() const;
+ static void setWindowTitleAddition(const QString &addition);
+ static QString windowTitleAddition();
static void setWindowTitleVcsTopic(const QString &topic);
static QString windowTitleVcsTopic();
- void addSaveAndCloseEditorActions(QMenu *contextMenu, DocumentModel::Entry *entry);
- void addNativeDirActions(QMenu *contextMenu, DocumentModel::Entry *entry);
+ static void addSaveAndCloseEditorActions(QMenu *contextMenu, DocumentModel::Entry *entry);
+ static void addNativeDirActions(QMenu *contextMenu, DocumentModel::Entry *entry);
signals:
void currentEditorChanged(Core::IEditor *editor);
@@ -197,88 +197,88 @@ signals:
void editorsClosed(QList<Core::IEditor *> editors);
public slots:
- bool closeAllEditors(bool askAboutModifiedEditors = true);
+ static bool closeAllEditors(bool askAboutModifiedEditors = true);
- bool saveDocument(Core::IDocument *documentParam = 0);
- bool saveDocumentAs(Core::IDocument *documentParam = 0);
- void revertToSaved();
- void revertToSaved(IDocument *document);
- void closeEditor();
- void closeOtherEditors();
- void doEscapeKeyFocusMoveMagic();
+ static bool saveDocument(Core::IDocument *documentParam = 0);
+ static bool saveDocumentAs(Core::IDocument *documentParam = 0);
+ static void revertToSaved();
+ static void revertToSaved(IDocument *document);
+ static void closeEditor();
+ static void closeOtherEditors();
+ static void doEscapeKeyFocusMoveMagic();
private slots:
- void gotoNextDocHistory();
- void gotoPreviousDocHistory();
- void handleContextChange(const QList<Core::IContext *> &context);
- void updateActions();
- void makeCurrentEditorWritable();
- void vcsOpenCurrentEditor();
- void updateWindowTitle();
+ static void gotoNextDocHistory();
+ static void gotoPreviousDocHistory();
+ static void handleContextChange(const QList<Core::IContext *> &context);
+ static void updateActions();
+ static void makeCurrentEditorWritable();
+ static void vcsOpenCurrentEditor();
+ static void updateWindowTitle();
void handleDocumentStateChange();
- void updateVariable(const QByteArray &variable);
- void autoSave();
+ static void updateVariable(const QByteArray &variable);
+ static void autoSave();
- void saveDocumentFromContextMenu();
- void saveDocumentAsFromContextMenu();
- void revertToSavedFromContextMenu();
+ static void saveDocumentFromContextMenu();
+ static void saveDocumentAsFromContextMenu();
+ static void revertToSavedFromContextMenu();
- void closeEditorFromContextMenu();
- void closeOtherEditorsFromContextMenu();
+ static void closeEditorFromContextMenu();
+ static void closeOtherEditorsFromContextMenu();
- void showInGraphicalShell();
- void openTerminal();
+ static void showInGraphicalShell();
+ static void openTerminal();
- void rootDestroyed(QObject *root);
- void setCurrentEditorFromContextChange();
+ static void rootDestroyed(QObject *root);
+ static void setCurrentEditorFromContextChange();
- void gotoNextSplit();
+ static void gotoNextSplit();
public slots:
- void goBackInNavigationHistory();
- void goForwardInNavigationHistory();
- void split(Qt::Orientation orientation);
- void split();
- void splitSideBySide();
- void splitNewWindow();
- void removeCurrentSplit();
- void removeAllSplits();
- void gotoOtherSplit();
+ static void goBackInNavigationHistory();
+ static void goForwardInNavigationHistory();
+ static void split(Qt::Orientation orientation);
+ static void split();
+ static void splitSideBySide();
+ static void splitNewWindow();
+ static void removeCurrentSplit();
+ static void removeAllSplits();
+ static void gotoOtherSplit();
private:
explicit EditorManager(QWidget *parent);
- virtual ~EditorManager();
- void init();
+ ~EditorManager();
+ static void init();
static IEditor *createEditor(const Id &id = Id(), const QString &fileName = QString());
- void addEditor(IEditor *editor);
- void removeEditor(IEditor *editor);
+ static void addEditor(IEditor *editor);
+ static void removeEditor(IEditor *editor);
- void restoreEditorState(IEditor *editor);
+ static void restoreEditorState(IEditor *editor);
- IEditor *placeEditor(Internal::EditorView *view, IEditor *editor);
- IEditor *duplicateEditor(IEditor *editor);
- IEditor *activateEditor(Internal::EditorView *view, IEditor *editor, OpenEditorFlags flags = 0);
- void activateEditorForEntry(Internal::EditorView *view, DocumentModel::Entry *entry, OpenEditorFlags flags = 0);
- void activateView(Internal::EditorView *view);
- IEditor *openEditor(Internal::EditorView *view, const QString &fileName,
+ static IEditor *placeEditor(Internal::EditorView *view, IEditor *editor);
+ static IEditor *duplicateEditor(IEditor *editor);
+ static IEditor *activateEditor(Internal::EditorView *view, IEditor *editor, OpenEditorFlags flags = 0);
+ static void activateEditorForEntry(Internal::EditorView *view, DocumentModel::Entry *entry, OpenEditorFlags flags = 0);
+ static void activateView(Internal::EditorView *view);
+ static IEditor *openEditor(Internal::EditorView *view, const QString &fileName,
const Id &id = Id(), OpenEditorFlags flags = 0, bool *newEditor = 0);
- void setCurrentEditor(IEditor *editor, bool ignoreNavigationHistory = false);
- void setCurrentView(Internal::EditorView *view);
- Internal::EditorView *currentEditorView() const;
+ static void setCurrentEditor(IEditor *editor, bool ignoreNavigationHistory = false);
+ static void setCurrentView(Internal::EditorView *view);
+ static Internal::EditorView *currentEditorView();
static Internal::EditorView *viewForEditor(IEditor *editor);
static Internal::SplitterOrView *findRoot(const Internal::EditorView *view, int *rootIndex = 0);
- void closeView(Internal::EditorView *view);
- void emptyView(Internal::EditorView *view);
+ static void closeView(Internal::EditorView *view);
+ static void emptyView(Internal::EditorView *view);
static void splitNewWindow(Internal::EditorView *view);
- IEditor *pickUnusedEditor(Internal::EditorView **foundView = 0) const;
- void addDocumentToRecentFiles(IDocument *document);
- void updateAutoSave();
- void setCloseSplitEnabled(Internal::SplitterOrView *splitterOrView, bool enable);
- void updateMakeWritableWarning();
- void setupSaveActions(IDocument *document, QAction *saveAction, QAction *saveAsAction, QAction *revertToSavedAction);
+ static IEditor *pickUnusedEditor(Internal::EditorView **foundView = 0);
+ static void addDocumentToRecentFiles(IDocument *document);
+ static void updateAutoSave();
+ static void setCloseSplitEnabled(Internal::SplitterOrView *splitterOrView, bool enable);
+ static void updateMakeWritableWarning();
+ static void setupSaveActions(IDocument *document, QAction *saveAction, QAction *saveAsAction, QAction *revertToSavedAction);
friend class Core::Internal::MainWindow;
friend class Core::Internal::SplitterOrView;
diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp
index f7d6f7c22e..92dd15208c 100644
--- a/src/plugins/coreplugin/editormanager/editorview.cpp
+++ b/src/plugins/coreplugin/editormanager/editorview.cpp
@@ -303,36 +303,33 @@ IEditor *EditorView::currentEditor() const
void EditorView::listSelectionActivated(int index)
{
- EditorManager::instance()->activateEditorForEntry(
+ EditorManager::activateEditorForEntry(
this, EditorManager::documentModel()->documentAtRow(index));
}
void EditorView::splitHorizontally()
{
- EditorManager *editorManager = EditorManager::instance();
if (m_parentSplitterOrView)
m_parentSplitterOrView->split(Qt::Vertical);
- editorManager->updateActions();
+ EditorManager::updateActions();
}
void EditorView::splitVertically()
{
- EditorManager *editorManager = EditorManager::instance();
if (m_parentSplitterOrView)
m_parentSplitterOrView->split(Qt::Horizontal);
- editorManager->updateActions();
+ EditorManager::updateActions();
}
void EditorView::splitNewWindow()
{
- EditorManager::instance()->splitNewWindow(this);
+ EditorManager::splitNewWindow(this);
}
void EditorView::closeSplit()
{
- EditorManager *editorManager = EditorManager::instance();
- editorManager->closeView(this);
- editorManager->updateActions();
+ EditorManager::closeView(this);
+ EditorManager::updateActions();
}
void EditorView::setParentSplitterOrView(SplitterOrView *splitterOrView)
@@ -539,7 +536,7 @@ SplitterOrView::~SplitterOrView()
delete m_layout;
m_layout = 0;
if (m_view)
- EditorManager::instance()->emptyView(m_view);
+ EditorManager::emptyView(m_view);
delete m_view;
m_view = 0;
delete m_splitter;
@@ -641,7 +638,7 @@ void SplitterOrView::split(Qt::Orientation orientation)
void SplitterOrView::unsplitAll()
{
QTC_ASSERT(m_splitter, return);
- EditorView *currentView = EditorManager::instance()->currentEditorView();
+ EditorView *currentView = EditorManager::currentEditorView();
if (currentView) {
currentView->parentSplitterOrView()->takeView();
currentView->setParentSplitterOrView(this);
diff --git a/src/plugins/coreplugin/editormanager/openeditorsview.cpp b/src/plugins/coreplugin/editormanager/openeditorsview.cpp
index 086ba6d855..e869482903 100644
--- a/src/plugins/coreplugin/editormanager/openeditorsview.cpp
+++ b/src/plugins/coreplugin/editormanager/openeditorsview.cpp
@@ -192,13 +192,13 @@ void OpenEditorsWidget::handleClicked(const QModelIndex &index)
void OpenEditorsWidget::activateEditor(const QModelIndex &index)
{
selectionModel()->select(index, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
- EditorManager::instance()->activateEditorForEntry(
+ EditorManager::activateEditorForEntry(
EditorManager::documentModel()->documentAtRow(m_model->mapToSource(index).row()));
}
void OpenEditorsWidget::closeEditor(const QModelIndex &index)
{
- EditorManager::instance()->closeEditor(
+ EditorManager::closeEditor(
EditorManager::documentModel()->documentAtRow(m_model->mapToSource(index).row()));
// work around selection changes
updateCurrentItem(EditorManager::currentEditor());
@@ -210,9 +210,9 @@ void OpenEditorsWidget::contextMenuRequested(QPoint pos)
QModelIndex editorIndex = indexAt(pos);
DocumentModel::Entry *entry = EditorManager::documentModel()->documentAtRow(
m_model->mapToSource(editorIndex).row());
- EditorManager::instance()->addSaveAndCloseEditorActions(&contextMenu, entry);
+ EditorManager::addSaveAndCloseEditorActions(&contextMenu, entry);
contextMenu.addSeparator();
- EditorManager::instance()->addNativeDirActions(&contextMenu, entry);
+ EditorManager::addNativeDirActions(&contextMenu, entry);
contextMenu.exec(mapToGlobal(pos));
}
diff --git a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp
index cdd88cc29d..21dc7b8722 100644
--- a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp
+++ b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp
@@ -225,7 +225,7 @@ 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::activateEditorForDocument(view, document);
} else {
if (!EditorManager::openEditor(
item->toolTip(0), item->data(0, Qt::UserRole+2).value<Core::Id>())) {
diff --git a/src/plugins/coreplugin/editortoolbar.cpp b/src/plugins/coreplugin/editortoolbar.cpp
index b7e0e9b8ab..4d95ddcf25 100644
--- a/src/plugins/coreplugin/editortoolbar.cpp
+++ b/src/plugins/coreplugin/editortoolbar.cpp
@@ -238,7 +238,7 @@ void EditorToolBar::closeEditor()
return;
if (d->m_isStandalone)
- EditorManager::instance()->closeEditor(current);
+ EditorManager::closeEditor(current);
emit closeClicked();
}
@@ -278,7 +278,7 @@ void EditorToolBar::setToolbarCreationFlags(ToolbarCreationFlags flags)
{
d->m_isStandalone = flags & FlagsStandalone;
if (d->m_isStandalone) {
- EditorManager *em = EditorManager::instance();
+ QWidget *em = EditorManager::instance();
connect(em, SIGNAL(currentEditorChanged(Core::IEditor*)), SLOT(updateEditorListSelection(Core::IEditor*)));
disconnect(d->m_editorList, SIGNAL(activated(int)), this, SIGNAL(listSelectionActivated(int)));
@@ -309,8 +309,7 @@ void EditorToolBar::updateEditorListSelection(IEditor *newSelection)
void EditorToolBar::changeActiveEditor(int row)
{
- EditorManager *em = EditorManager::instance();
- em->activateEditorForEntry(d->m_editorsListModel->documentAtRow(row));
+ EditorManager::activateEditorForEntry(d->m_editorsListModel->documentAtRow(row));
}
void EditorToolBar::listContextMenu(QPoint pos)
@@ -323,9 +322,9 @@ void EditorToolBar::listContextMenu(QPoint pos)
QMenu menu;
QAction *copyPath = menu.addAction(tr("Copy Full Path to Clipboard"));
menu.addSeparator();
- EditorManager::instance()->addSaveAndCloseEditorActions(&menu, entry);
+ EditorManager::addSaveAndCloseEditorActions(&menu, entry);
menu.addSeparator();
- EditorManager::instance()->addNativeDirActions(&menu, entry);
+ EditorManager::addNativeDirActions(&menu, entry);
QAction *result = menu.exec(d->m_editorList->mapToGlobal(pos));
if (result == copyPath)
QApplication::clipboard()->setText(QDir::toNativeSeparators(fileName));
@@ -334,7 +333,7 @@ void EditorToolBar::listContextMenu(QPoint pos)
void EditorToolBar::makeEditorWritable()
{
if (IDocument *current = EditorManager::currentDocument())
- EditorManager::instance()->makeFileWritable(current);
+ EditorManager::makeFileWritable(current);
}
void EditorToolBar::setCanGoBack(bool canGoBack)
diff --git a/src/plugins/coreplugin/generalsettings.cpp b/src/plugins/coreplugin/generalsettings.cpp
index ead28c556a..e052a77ca4 100644
--- a/src/plugins/coreplugin/generalsettings.cpp
+++ b/src/plugins/coreplugin/generalsettings.cpp
@@ -110,7 +110,7 @@ QWidget *GeneralSettings::createPage(QWidget *parent)
fillLanguageBox();
m_page->colorButton->setColor(StyleHelper::requestedBaseColor());
- m_page->reloadBehavior->setCurrentIndex(EditorManager::instance()->reloadSetting());
+ m_page->reloadBehavior->setCurrentIndex(EditorManager::reloadSetting());
if (HostOsInfo::isAnyUnixHost()) {
QSettings *settings = Core::ICore::settings();
const QStringList availableTerminals = ConsoleProcess::availableTerminalEmulators();
@@ -135,8 +135,8 @@ QWidget *GeneralSettings::createPage(QWidget *parent)
m_page->helpExternalFileBrowserButton->hide();
}
- m_page->autoSaveCheckBox->setChecked(EditorManager::instance()->autoSaveEnabled());
- m_page->autoSaveInterval->setValue(EditorManager::instance()->autoSaveInterval());
+ m_page->autoSaveCheckBox->setChecked(EditorManager::autoSaveEnabled());
+ m_page->autoSaveInterval->setValue(EditorManager::autoSaveInterval());
m_page->resetWarningsButton->setEnabled(Core::InfoBar::anyGloballySuppressed());
connect(m_page->resetColorButton, SIGNAL(clicked()),
@@ -179,7 +179,7 @@ void GeneralSettings::apply()
setLanguage(m_page->languageBox->itemData(currentIndex, Qt::UserRole).toString());
// Apply the new base color if accepted
StyleHelper::setBaseColor(m_page->colorButton->color());
- EditorManager::instance()->setReloadSetting(IDocument::ReloadSetting(m_page->reloadBehavior->currentIndex()));
+ EditorManager::setReloadSetting(IDocument::ReloadSetting(m_page->reloadBehavior->currentIndex()));
if (HostOsInfo::isAnyUnixHost()) {
ConsoleProcess::setTerminalEmulator(Core::ICore::settings(),
m_page->terminalComboBox->lineEdit()->text());
@@ -188,8 +188,8 @@ void GeneralSettings::apply()
m_page->externalFileBrowserEdit->text());
}
}
- EditorManager::instance()->setAutoSaveEnabled(m_page->autoSaveCheckBox->isChecked());
- EditorManager::instance()->setAutoSaveInterval(m_page->autoSaveInterval->value());
+ EditorManager::setAutoSaveEnabled(m_page->autoSaveCheckBox->isChecked());
+ EditorManager::setAutoSaveInterval(m_page->autoSaveInterval->value());
}
void GeneralSettings::finish()
diff --git a/src/plugins/coreplugin/textdocument.cpp b/src/plugins/coreplugin/textdocument.cpp
index c083cf2eb2..4f2bdf0b23 100644
--- a/src/plugins/coreplugin/textdocument.cpp
+++ b/src/plugins/coreplugin/textdocument.cpp
@@ -64,7 +64,7 @@ public:
TextDocument::TextDocument(QObject *parent) :
IDocument(parent), d(new Internal::TextDocumentPrivate)
{
- setCodec(Core::EditorManager::instance()->defaultTextCodec());
+ setCodec(Core::EditorManager::defaultTextCodec());
}
TextDocument::~TextDocument()
diff --git a/src/plugins/cppeditor/cppdoxygen_test.cpp b/src/plugins/cppeditor/cppdoxygen_test.cpp
index c5821b39f5..8feffc6579 100644
--- a/src/plugins/cppeditor/cppdoxygen_test.cpp
+++ b/src/plugins/cppeditor/cppdoxygen_test.cpp
@@ -115,7 +115,7 @@ TestCase::TestCase(const QByteArray &input)
TestCase::~TestCase()
{
- EditorManager::instance()->closeEditor(editor, false);
+ EditorManager::closeEditor(editor, false);
QCoreApplication::processEvents(); // process any pending events
// Remove the test file from the code-model
diff --git a/src/plugins/cppeditor/cppoutline.cpp b/src/plugins/cppeditor/cppoutline.cpp
index ff0bbd997c..2a47c1ef25 100644
--- a/src/plugins/cppeditor/cppoutline.cpp
+++ b/src/plugins/cppeditor/cppoutline.cpp
@@ -171,9 +171,8 @@ void CppOutlineWidget::updateTextCursor(const QModelIndex &proxyIndex)
if (debug)
qDebug() << "CppOutline - moving cursor to" << symbol->line() << symbol->column() - 1;
- Core::EditorManager *editorManager = Core::EditorManager::instance();
- editorManager->cutForwardNavigationHistory();
- editorManager->addCurrentPositionToNavigationHistory();
+ Core::EditorManager::cutForwardNavigationHistory();
+ Core::EditorManager::addCurrentPositionToNavigationHistory();
// line has to be 1 based, column 0 based!
m_editor->gotoLine(symbol->line(), symbol->column() - 1);
diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp
index 0960ade79e..76f0efafcb 100644
--- a/src/plugins/cppeditor/cppquickfix_test.cpp
+++ b/src/plugins/cppeditor/cppquickfix_test.cpp
@@ -264,7 +264,7 @@ TestCase::~TestCase()
if (testFile->editor)
editorsToClose << testFile->editor;
}
- EditorManager::instance()->closeEditors(editorsToClose, false);
+ EditorManager::closeEditors(editorsToClose, false);
QCoreApplication::processEvents(); // process any pending events
// Remove the test files from the code-model
diff --git a/src/plugins/cppeditor/cpptypehierarchy.cpp b/src/plugins/cppeditor/cpptypehierarchy.cpp
index 2fd3c6185b..992623565a 100644
--- a/src/plugins/cppeditor/cpptypehierarchy.cpp
+++ b/src/plugins/cppeditor/cpptypehierarchy.cpp
@@ -165,7 +165,7 @@ void CppTypeHierarchyWidget::perform()
{
showNoTypeHierarchyLabel();
- CPPEditor *editor = qobject_cast<CPPEditor *>(Core::EditorManager::instance()->currentEditor());
+ CPPEditor *editor = qobject_cast<CPPEditor *>(Core::EditorManager::currentEditor());
if (!editor)
return;
diff --git a/src/plugins/cppeditor/fileandtokenactions_test.cpp b/src/plugins/cppeditor/fileandtokenactions_test.cpp
index fe3468c9d1..34ae708b66 100644
--- a/src/plugins/cppeditor/fileandtokenactions_test.cpp
+++ b/src/plugins/cppeditor/fileandtokenactions_test.cpp
@@ -299,9 +299,8 @@ void TestActionsTestCase::moveWordCamelCaseToToken(TranslationUnit *translationU
void TestActionsTestCase::undoAllChangesAndCloseAllEditors()
{
- EditorManager *em = EditorManager::instance();
undoChangesInAllEditorWidgets();
- em->closeAllEditors(/*askAboutModifiedEditors =*/ false);
+ EditorManager::closeAllEditors(/*askAboutModifiedEditors =*/ false);
QApplication::processEvents();
QCOMPARE(EditorManager::documentModel()->openedDocuments().size(), 0);
}
@@ -332,10 +331,8 @@ public:
void FollowSymbolUnderCursorTokenAction::run(CPPEditorWidget *editorWidget)
{
- EditorManager *em = EditorManager::instance();
-
// Follow link
- IEditor *editorBefore = em->currentEditor();
+ IEditor *editorBefore = EditorManager::currentEditor();
const int originalLine = editorBefore->currentLine();
const int originalColumn = editorBefore->currentColumn();
editorWidget->openLinkUnderCursor();
@@ -343,9 +340,9 @@ void FollowSymbolUnderCursorTokenAction::run(CPPEditorWidget *editorWidget)
QApplication::processEvents();
// Go back
- IEditor *editorAfter = em->currentEditor();
+ IEditor *editorAfter = EditorManager::currentEditor();
if (editorAfter != editorBefore)
- em->goBackInNavigationHistory();
+ EditorManager::goBackInNavigationHistory();
else
editorBefore->gotoLine(originalLine, originalColumn);
QApplication::processEvents();
@@ -360,19 +357,17 @@ public:
void SwitchDeclarationDefinitionTokenAction::run(CPPEditorWidget *)
{
- EditorManager *em = EditorManager::instance();
-
// Switch Declaration/Definition
- IEditor *editorBefore = em->currentEditor();
+ IEditor *editorBefore = EditorManager::currentEditor();
const int originalLine = editorBefore->currentLine();
const int originalColumn = editorBefore->currentColumn();
CppEditor::Internal::CppEditorPlugin::instance()->switchDeclarationDefinition();
QApplication::processEvents();
// Go back
- IEditor *editorAfter = em->currentEditor();
+ IEditor *editorAfter = EditorManager::currentEditor();
if (editorAfter != editorBefore)
- em->goBackInNavigationHistory();
+ EditorManager::goBackInNavigationHistory();
else
editorBefore->gotoLine(originalLine, originalColumn);
QApplication::processEvents();
@@ -500,17 +495,15 @@ public:
void SwitchHeaderSourceFileAction::run(CPPEditorWidget *)
{
- EditorManager *em = EditorManager::instance();
-
// Switch Header/Source
- IEditor *editorBefore = em->currentEditor();
+ IEditor *editorBefore = EditorManager::currentEditor();
CppTools::Internal::CppToolsPlugin::instance()->switchHeaderSource();
QApplication::processEvents();
// Go back
- IEditor *editorAfter = em->currentEditor();
+ IEditor *editorAfter = EditorManager::currentEditor();
if (editorAfter != editorBefore)
- em->goBackInNavigationHistory();
+ EditorManager::goBackInNavigationHistory();
QApplication::processEvents();
}
diff --git a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
index 8d69042692..dae9e0aacc 100644
--- a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
+++ b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
@@ -251,7 +251,7 @@ TestCase::~TestCase()
if (testFile->editor)
editorsToClose << testFile->editor;
}
- EditorManager::instance()->closeEditors(editorsToClose, false);
+ EditorManager::closeEditors(editorsToClose, false);
QCoreApplication::processEvents(); // process any pending events
// Remove the test files from the code-model
@@ -308,7 +308,7 @@ void TestCase::run(bool expectedFail)
QCoreApplication::processEvents();
// Compare
- IEditor *currentEditor = EditorManager::instance()->currentEditor();
+ IEditor *currentEditor = EditorManager::currentEditor();
BaseTextEditor *currentTextEditor = dynamic_cast<BaseTextEditor*>(currentEditor);
QVERIFY(currentTextEditor);
diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp
index 9948577029..4248d9d431 100644
--- a/src/plugins/cpptools/cppcompletion_test.cpp
+++ b/src/plugins/cpptools/cppcompletion_test.cpp
@@ -91,7 +91,7 @@ public:
~CompletionTestCase()
{
- EditorManager::instance()->closeEditors(QList<IEditor*>() << editor,
+ EditorManager::closeEditors(QList<IEditor*>() << editor,
/*askAboutModifiedEditors=*/ false);
cmm->GC();
QVERIFY(cmm->snapshot().isEmpty());
diff --git a/src/plugins/cpptools/cppfilesettingspage.cpp b/src/plugins/cpptools/cppfilesettingspage.cpp
index 1c0c49904d..fcc5f28861 100644
--- a/src/plugins/cpptools/cppfilesettingspage.cpp
+++ b/src/plugins/cpptools/cppfilesettingspage.cpp
@@ -205,9 +205,8 @@ QString CppFileSettings::licenseTemplate(const QString &fileName, const QString
return QString();
}
- QTextCodec *codec = Core::EditorManager::instance()->defaultTextCodec();
QTextStream licenseStream(&file);
- licenseStream.setCodec(codec);
+ licenseStream.setCodec(Core::EditorManager::defaultTextCodec());
licenseStream.setAutoDetectUnicode(true);
QString license = licenseStream.readAll();
diff --git a/src/plugins/cpptools/cppfindreferences.cpp b/src/plugins/cpptools/cppfindreferences.cpp
index 1a945a730c..bf566c60cf 100644
--- a/src/plugins/cpptools/cppfindreferences.cpp
+++ b/src/plugins/cpptools/cppfindreferences.cpp
@@ -61,7 +61,7 @@ static QString getSource(const QString &fileName,
QString fileContents;
Utils::TextFileFormat format;
QString error;
- QTextCodec *defaultCodec = Core::EditorManager::instance()->defaultTextCodec();
+ QTextCodec *defaultCodec = Core::EditorManager::defaultTextCodec();
Utils::TextFileFormat::ReadResult result = Utils::TextFileFormat::readFile(
fileName, defaultCodec, &fileContents, &format, &error);
if (result != Utils::TextFileFormat::ReadSuccess)
diff --git a/src/plugins/cpptools/cpplocatorfilter_test.cpp b/src/plugins/cpptools/cpplocatorfilter_test.cpp
index 9d2e9e8c7e..682b78cd5b 100644
--- a/src/plugins/cpptools/cpplocatorfilter_test.cpp
+++ b/src/plugins/cpptools/cpplocatorfilter_test.cpp
@@ -125,7 +125,7 @@ private:
virtual void doAfterLocatorRun()
{
- EditorManager::instance()->closeEditor(m_editor, /*askAboutModifiedEditors=*/ false);
+ EditorManager::closeEditor(m_editor, /*askAboutModifiedEditors=*/ false);
QCoreApplication::processEvents();
QVERIFY(EditorManager::documentModel()->openedDocuments().isEmpty());
m_modelManager->GC();
diff --git a/src/plugins/cpptools/cppmodelmanager_test.cpp b/src/plugins/cpptools/cppmodelmanager_test.cpp
index 3490909312..bdcbf25419 100644
--- a/src/plugins/cpptools/cppmodelmanager_test.cpp
+++ b/src/plugins/cpptools/cppmodelmanager_test.cpp
@@ -712,12 +712,11 @@ void CppToolsPlugin::test_modelmanager_gc_if_last_cppeditor_closed()
MyTestDataDir testDataDirectory(QLatin1String("testdata_guiproject1"));
const QString file = testDataDirectory.file(QLatin1String("main.cpp"));
- Core::EditorManager *em = Core::EditorManager::instance();
CppModelManager *mm = CppModelManager::instance();
// Open a file in the editor
QCOMPARE(Core::EditorManager::documentModel()->openedDocuments().size(), 0);
- Core::IEditor *editor = em->openEditor(file);
+ Core::IEditor *editor = Core::EditorManager::openEditor(file);
QVERIFY(editor);
QCOMPARE(Core::EditorManager::documentModel()->openedDocuments().size(), 1);
QVERIFY(mm->isCppEditor(editor));
@@ -727,7 +726,7 @@ void CppToolsPlugin::test_modelmanager_gc_if_last_cppeditor_closed()
QVERIFY(mm->snapshot().contains(file));
// Close file/editor
- em->closeEditor(editor, /*askAboutModifiedEditors=*/ false);
+ Core::EditorManager::closeEditor(editor, /*askAboutModifiedEditors=*/ false);
helper.waitForFinishedGc();
// Check: File is removed from the snapshpt
@@ -743,12 +742,11 @@ void CppToolsPlugin::test_modelmanager_dont_gc_opened_files()
MyTestDataDir testDataDirectory(QLatin1String("testdata_guiproject1"));
const QString file = testDataDirectory.file(QLatin1String("main.cpp"));
- Core::EditorManager *em = Core::EditorManager::instance();
CppModelManager *mm = CppModelManager::instance();
// Open a file in the editor
QCOMPARE(Core::EditorManager::documentModel()->openedDocuments().size(), 0);
- Core::IEditor *editor = em->openEditor(file);
+ Core::IEditor *editor = Core::EditorManager::openEditor(file);
QVERIFY(editor);
QCOMPARE(Core::EditorManager::documentModel()->openedDocuments().size(), 1);
QVERIFY(mm->isCppEditor(editor));
@@ -765,7 +763,7 @@ void CppToolsPlugin::test_modelmanager_dont_gc_opened_files()
QVERIFY(mm->snapshot().contains(file));
// Close editor
- em->closeEditors(QList<Core::IEditor*>() << editor);
+ Core::EditorManager::closeEditors(QList<Core::IEditor*>() << editor);
helper.waitForFinishedGc();
QVERIFY(mm->snapshot().isEmpty());
}
diff --git a/src/plugins/cpptools/cpppreprocessor.cpp b/src/plugins/cpptools/cpppreprocessor.cpp
index 649d3d6bc9..417363db3c 100644
--- a/src/plugins/cpptools/cpppreprocessor.cpp
+++ b/src/plugins/cpptools/cpppreprocessor.cpp
@@ -171,9 +171,8 @@ void CppPreprocessor::getFileContents(const QString &absoluteFilePath,
QFile file(absoluteFilePath);
if (file.open(QFile::ReadOnly | QFile::Text)) {
- QTextCodec *defaultCodec = Core::EditorManager::instance()->defaultTextCodec();
QTextStream stream(&file);
- stream.setCodec(defaultCodec);
+ stream.setCodec(Core::EditorManager::defaultTextCodec());
if (contents)
*contents = stream.readAll();
if (revision)
diff --git a/src/plugins/cpptools/cpptoolseditorsupport.cpp b/src/plugins/cpptools/cpptoolseditorsupport.cpp
index e99338bc4a..6bb8bfbc04 100644
--- a/src/plugins/cpptools/cpptoolseditorsupport.cpp
+++ b/src/plugins/cpptools/cpptoolseditorsupport.cpp
@@ -305,7 +305,7 @@ void CppEditorSupport::startHighlighting()
// Start highlighting only if the editor is or would be visible
// (in case another mode is active) in the edit mode.
- if (!Core::EditorManager::instance()->visibleEditors().contains(m_textEditor))
+ if (!Core::EditorManager::visibleEditors().contains(m_textEditor))
return;
if (m_highlightingSupport->requiresSemanticInfo()) {
diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp
index f02744c5b9..7ed99b96e3 100644
--- a/src/plugins/cvs/cvsplugin.cpp
+++ b/src/plugins/cvs/cvsplugin.cpp
@@ -1216,7 +1216,7 @@ bool CvsPlugin::describe(const QString &repositoryPath,
void CvsPlugin::submitCurrentLog()
{
m_submitActionTriggered = true;
- EditorManager::instance()->closeEditor(EditorManager::currentEditor());
+ EditorManager::closeEditor(EditorManager::currentEditor());
}
// Run CVS. At this point, file arguments must be relative to
diff --git a/src/plugins/debugger/debuggertooltipmanager.cpp b/src/plugins/debugger/debuggertooltipmanager.cpp
index 2457f02ca9..0650fddd1a 100644
--- a/src/plugins/debugger/debuggertooltipmanager.cpp
+++ b/src/plugins/debugger/debuggertooltipmanager.cpp
@@ -1359,7 +1359,7 @@ void DebuggerToolTipManager::debugModeEntered()
m_debugModeActive = true;
QWidget *topLevel = ICore::mainWindow()->topLevelWidget();
topLevel->installEventFilter(this);
- EditorManager *em = EditorManager::instance();
+ QObject *em = EditorManager::instance();
connect(em, SIGNAL(currentEditorChanged(Core::IEditor*)),
this, SLOT(slotUpdateVisibleToolTips()));
connect(em, SIGNAL(editorOpened(Core::IEditor*)),
diff --git a/src/plugins/debugger/disassembleragent.cpp b/src/plugins/debugger/disassembleragent.cpp
index a587e4f36c..f2b388acbb 100644
--- a/src/plugins/debugger/disassembleragent.cpp
+++ b/src/plugins/debugger/disassembleragent.cpp
@@ -124,8 +124,7 @@ DisassemblerAgentPrivate::DisassemblerAgentPrivate()
DisassemblerAgentPrivate::~DisassemblerAgentPrivate()
{
- if (editor)
- EditorManager::instance()->closeEditor(editor);
+ EditorManager::closeEditor(editor);
editor = 0;
delete locationMark;
qDeleteAll(breakpointMarks);
diff --git a/src/plugins/debugger/imageviewer.cpp b/src/plugins/debugger/imageviewer.cpp
index e7cfd169f7..e7fe110a83 100644
--- a/src/plugins/debugger/imageviewer.cpp
+++ b/src/plugins/debugger/imageviewer.cpp
@@ -139,7 +139,7 @@ static void openImageViewer(const QImage &image)
fileName = temporaryFile.fileName();
temporaryFile.close();
}
- if (Core::IEditor *e = Core::EditorManager::instance()->openEditor(fileName))
+ if (Core::IEditor *e = Core::EditorManager::openEditor(fileName))
e->document()->setProperty(Debugger::Constants::OPENED_BY_DEBUGGER, QVariant(true));
}
diff --git a/src/plugins/debugger/memoryagent.cpp b/src/plugins/debugger/memoryagent.cpp
index 84f952d3ae..ce2eaedc3c 100644
--- a/src/plugins/debugger/memoryagent.cpp
+++ b/src/plugins/debugger/memoryagent.cpp
@@ -110,7 +110,7 @@ void MemoryAgent::closeEditors()
foreach (QPointer<IEditor> editor, m_editors)
if (editor)
editors.append(editor.data());
- EditorManager::instance()->closeEditors(editors);
+ EditorManager::closeEditors(editors);
m_editors.clear();
}
@@ -254,7 +254,7 @@ void MemoryAgent::updateContents()
bool MemoryAgent::hasVisibleEditor() const
{
- QList<IEditor *> visible = EditorManager::instance()->visibleEditors();
+ QList<IEditor *> visible = EditorManager::visibleEditors();
foreach (QPointer<IEditor> editor, m_editors)
if (visible.contains(editor.data()))
return true;
diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp
index 08d93457eb..29f2178984 100644
--- a/src/plugins/debugger/qml/qmlengine.cpp
+++ b/src/plugins/debugger/qml/qmlengine.cpp
@@ -342,7 +342,7 @@ QmlEngine::~QmlEngine()
if (textEditPtr)
editorsToClose << textEditPtr.data();
}
- Core::EditorManager::instance()->closeEditors(editorsToClose);
+ Core::EditorManager::closeEditors(editorsToClose);
}
void QmlEngine::notifyInferiorSetupOk()
@@ -539,7 +539,7 @@ void QmlEngine::gotoLocation(const Location &location)
//Check if there are open documents with the same title
foreach (Core::IDocument *document, Core::EditorManager::documentModel()->openedDocuments()) {
if (document->displayName() == titlePattern) {
- Core::EditorManager::instance()->activateEditorForDocument(document);
+ Core::EditorManager::activateEditorForDocument(document);
return;
}
}
diff --git a/src/plugins/debugger/qml/qmlinspectoradapter.cpp b/src/plugins/debugger/qml/qmlinspectoradapter.cpp
index ade2eedcf0..37650cd8a7 100644
--- a/src/plugins/debugger/qml/qmlinspectoradapter.cpp
+++ b/src/plugins/debugger/qml/qmlinspectoradapter.cpp
@@ -438,7 +438,6 @@ void QmlInspectorAdapter::setActiveEngineClient(BaseEngineDebugClient *client)
void QmlInspectorAdapter::initializePreviews()
{
- Core::EditorManager *em = Core::EditorManager::instance();
QmlJS::ModelManagerInterface *modelManager
= QmlJS::ModelManagerInterface::instance();
if (modelManager) {
@@ -446,6 +445,7 @@ void QmlInspectorAdapter::initializePreviews()
if (!m_listeningToEditorManager) {
m_listeningToEditorManager = true;
+ QObject *em = Core::EditorManager::instance();
connect(em, SIGNAL(editorAboutToClose(Core::IEditor*)),
this, SLOT(removePreviewForEditor(Core::IEditor*)));
connect(em, SIGNAL(editorOpened(Core::IEditor*)),
diff --git a/src/plugins/debugger/sourceagent.cpp b/src/plugins/debugger/sourceagent.cpp
index b5bb5c8345..210528bf13 100644
--- a/src/plugins/debugger/sourceagent.cpp
+++ b/src/plugins/debugger/sourceagent.cpp
@@ -76,8 +76,7 @@ SourceAgentPrivate::SourceAgentPrivate()
SourceAgentPrivate::~SourceAgentPrivate()
{
- if (editor)
- EditorManager::instance()->closeEditor(editor);
+ EditorManager::closeEditor(editor);
editor = 0;
delete locationMark;
}
diff --git a/src/plugins/designer/gotoslot_test.cpp b/src/plugins/designer/gotoslot_test.cpp
index a74fc84e16..ef9ed56828 100644
--- a/src/plugins/designer/gotoslot_test.cpp
+++ b/src/plugins/designer/gotoslot_test.cpp
@@ -134,7 +134,7 @@ public:
private:
void cleanup()
{
- EditorManager::instance()->closeAllEditors(/*askAboutModifiedEditors =*/ false);
+ EditorManager::closeAllEditors(/*askAboutModifiedEditors =*/ false);
QVERIFY(EditorManager::documentModel()->openedDocuments().isEmpty());
m_modelManager->GC();
diff --git a/src/plugins/fakevim/fakevim_test.cpp b/src/plugins/fakevim/fakevim_test.cpp
index 4a78decf99..0447d0508c 100644
--- a/src/plugins/fakevim/fakevim_test.cpp
+++ b/src/plugins/fakevim/fakevim_test.cpp
@@ -280,7 +280,7 @@ void FakeVimPlugin::setup(TestData *data)
void FakeVimPlugin::cleanup()
{
- Core::EditorManager::instance()->closeAllEditors(false);
+ Core::EditorManager::closeAllEditors(false);
}
diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp
index a50a28fbbf..24006eefd7 100644
--- a/src/plugins/fakevim/fakevimplugin.cpp
+++ b/src/plugins/fakevim/fakevimplugin.cpp
@@ -1356,7 +1356,7 @@ void FakeVimPluginPrivate::moveSomewhere(DistFunction f, int count)
IEditor *bestEditor = 0;
int repeat = count;
- QList<IEditor *> editors = EditorManager::instance()->visibleEditors();
+ QList<IEditor *> editors = EditorManager::visibleEditors();
while (repeat < 0 || repeat-- > 0) {
editors.removeOne(currentEditor);
int bestValue = -1;
@@ -1389,7 +1389,7 @@ void FakeVimPluginPrivate::moveSomewhere(DistFunction f, int count)
void FakeVimPluginPrivate::keepOnlyWindow()
{
IEditor *currentEditor = EditorManager::currentEditor();
- QList<IEditor *> editors = EditorManager::instance()->visibleEditors();
+ QList<IEditor *> editors = EditorManager::visibleEditors();
editors.removeOne(currentEditor);
foreach (IEditor *editor, editors) {
@@ -1988,7 +1988,7 @@ void FakeVimPluginPrivate::changeSelection(const QList<QTextEdit::ExtraSelection
void FakeVimPluginPrivate::highlightMatches(const QString &needle)
{
- foreach (IEditor *editor, EditorManager::instance()->visibleEditors()) {
+ foreach (IEditor *editor, EditorManager::visibleEditors()) {
QWidget *w = editor->widget();
Find::IFindSupport *find = Aggregation::query<Find::IFindSupport>(w);
if (find != 0)
@@ -2011,7 +2011,7 @@ void FakeVimPluginPrivate::switchToFile(int n)
n = n % size;
if (n < 0)
n += size;
- EditorManager::instance()->activateEditorForEntry(EditorManager::documentModel()->documents().at(n));
+ EditorManager::activateEditorForEntry(EditorManager::documentModel()->documents().at(n));
}
ExCommandMap &FakeVimExCommandsPage::exCommandMap()
diff --git a/src/plugins/git/gitsubmiteditor.cpp b/src/plugins/git/gitsubmiteditor.cpp
index 4862ae4149..7cd2ad9e93 100644
--- a/src/plugins/git/gitsubmiteditor.cpp
+++ b/src/plugins/git/gitsubmiteditor.cpp
@@ -179,7 +179,7 @@ void GitSubmitEditor::updateFileModel()
} else {
VcsBase::VcsBaseOutputWindow::instance()->appendError(errorMessage);
m_forceClose = true;
- Core::EditorManager::instance()->closeEditor(this);
+ Core::EditorManager::closeEditor(this);
}
}
diff --git a/src/plugins/macros/findmacrohandler.cpp b/src/plugins/macros/findmacrohandler.cpp
index faf7965d8c..829475cb17 100644
--- a/src/plugins/macros/findmacrohandler.cpp
+++ b/src/plugins/macros/findmacrohandler.cpp
@@ -60,8 +60,7 @@ static const quint8 RESET = 5;
FindMacroHandler::FindMacroHandler():
IMacroHandler()
{
- const Core::EditorManager *editorManager = Core::EditorManager::instance();
- connect(editorManager, SIGNAL(currentEditorChanged(Core::IEditor*)),
+ connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
this, SLOT(changeEditor(Core::IEditor*)));
}
diff --git a/src/plugins/macros/macromanager.cpp b/src/plugins/macros/macromanager.cpp
index 12f9f55f5f..32a57c418d 100644
--- a/src/plugins/macros/macromanager.cpp
+++ b/src/plugins/macros/macromanager.cpp
@@ -290,7 +290,7 @@ void MacroManager::startMacro()
QString executeShortcut = Core::ActionManager::command(Constants::EXECUTE_LAST_MACRO)->defaultKeySequence().toString();
QString help = tr("Macro mode. Type \"%1\" to stop recording and \"%2\" to play it")
.arg(endShortcut).arg(executeShortcut);
- Core::EditorManager::instance()->showEditorStatusBar(
+ Core::EditorManager::showEditorStatusBar(
QLatin1String(Constants::M_STATUS_BUFFER),
help,
tr("Stop Recording Macro"), this, SLOT(endMacro()));
@@ -298,7 +298,7 @@ void MacroManager::startMacro()
void MacroManager::endMacro()
{
- Core::EditorManager::instance()->hideEditorStatusBar(QLatin1String(Constants::M_STATUS_BUFFER));
+ Core::EditorManager::hideEditorStatusBar(QLatin1String(Constants::M_STATUS_BUFFER));
Core::ActionManager::command(Constants::START_MACRO)->action()->setEnabled(true);
Core::ActionManager::command(Constants::END_MACRO)->action()->setEnabled(false);
diff --git a/src/plugins/macros/texteditormacrohandler.cpp b/src/plugins/macros/texteditormacrohandler.cpp
index 6a9aa1affa..8d156eac9e 100644
--- a/src/plugins/macros/texteditormacrohandler.cpp
+++ b/src/plugins/macros/texteditormacrohandler.cpp
@@ -61,7 +61,7 @@ static quint8 COUNT = 5;
TextEditorMacroHandler::TextEditorMacroHandler():
IMacroHandler()
{
- const Core::EditorManager *editorManager = Core::EditorManager::instance();
+ const QObject *editorManager = Core::EditorManager::instance();
connect(editorManager, SIGNAL(currentEditorChanged(Core::IEditor*)),
this, SLOT(changeEditor(Core::IEditor*)));
connect(editorManager, SIGNAL(editorAboutToClose(Core::IEditor*)),
diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp
index 95adbfbdbf..0e19f1c31e 100644
--- a/src/plugins/perforce/perforceplugin.cpp
+++ b/src/plugins/perforce/perforceplugin.cpp
@@ -1294,7 +1294,7 @@ void PerforcePlugin::describe(const QString & source, const QString &n)
void PerforcePlugin::submitCurrentLog()
{
m_submitActionTriggered = true;
- Core::EditorManager::instance()->closeEditor(Core::EditorManager::currentEditor());
+ Core::EditorManager::closeEditor(Core::EditorManager::currentEditor());
}
void PerforcePlugin::cleanCommitMessageFile()
diff --git a/src/plugins/projectexplorer/editorconfiguration.cpp b/src/plugins/projectexplorer/editorconfiguration.cpp
index 104e1df798..c3b47a1044 100644
--- a/src/plugins/projectexplorer/editorconfiguration.cpp
+++ b/src/plugins/projectexplorer/editorconfiguration.cpp
@@ -67,7 +67,7 @@ struct EditorConfigurationPrivate
, m_storageSettings(TextEditorSettings::instance()->storageSettings())
, m_behaviorSettings(TextEditorSettings::instance()->behaviorSettings())
, m_extraEncodingSettings(TextEditorSettings::instance()->extraEncodingSettings())
- , m_textCodec(Core::EditorManager::instance()->defaultTextCodec())
+ , m_textCodec(Core::EditorManager::defaultTextCodec())
{
}
@@ -129,7 +129,7 @@ void EditorConfiguration::cloneGlobalSettings()
setStorageSettings(textEditorSettings->storageSettings());
setBehaviorSettings(textEditorSettings->behaviorSettings());
setExtraEncodingSettings(textEditorSettings->extraEncodingSettings());
- d->m_textCodec = Core::EditorManager::instance()->defaultTextCodec();
+ d->m_textCodec = Core::EditorManager::defaultTextCodec();
}
QTextCodec *EditorConfiguration::textCodec() const
@@ -208,7 +208,7 @@ void EditorConfiguration::fromMap(const QVariantMap &map)
const QByteArray &codecName = map.value(kCodec, d->m_textCodec->name()).toByteArray();
d->m_textCodec = QTextCodec::codecForName(codecName);
if (!d->m_textCodec)
- d->m_textCodec = Core::EditorManager::instance()->defaultTextCodec();
+ d->m_textCodec = Core::EditorManager::defaultTextCodec();
const int codeStyleCount = map.value(kCodeStyleCount, 0).toInt();
for (int i = 0; i < codeStyleCount; ++i) {
diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp
index c6e3b27630..8f0f4eafab 100644
--- a/src/plugins/qmljseditor/qmljseditor.cpp
+++ b/src/plugins/qmljseditor/qmljseditor.cpp
@@ -692,9 +692,8 @@ void QmlJSTextEditorWidget::jumpToOutlineElement(int /*index*/)
if (!location.isValid())
return;
- Core::EditorManager *editorManager = Core::EditorManager::instance();
- editorManager->cutForwardNavigationHistory();
- editorManager->addCurrentPositionToNavigationHistory();
+ Core::EditorManager::cutForwardNavigationHistory();
+ Core::EditorManager::addCurrentPositionToNavigationHistory();
QTextCursor cursor = textCursor();
cursor.setPosition(location.offset);
diff --git a/src/plugins/qmljseditor/qmljsoutline.cpp b/src/plugins/qmljseditor/qmljsoutline.cpp
index 544f5419c7..d9d49853a2 100644
--- a/src/plugins/qmljseditor/qmljsoutline.cpp
+++ b/src/plugins/qmljseditor/qmljsoutline.cpp
@@ -217,9 +217,8 @@ void QmlJSOutlineWidget::updateTextCursor(const QModelIndex &index)
if (location.offset >= textLength)
return;
- Core::EditorManager *editorManager = Core::EditorManager::instance();
- editorManager->cutForwardNavigationHistory();
- editorManager->addCurrentPositionToNavigationHistory();
+ Core::EditorManager::cutForwardNavigationHistory();
+ Core::EditorManager::addCurrentPositionToNavigationHistory();
QTextCursor textCursor = m_editor->textCursor();
m_blockCursorSync = true;
diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp
index ed9235d623..c1f34f1951 100644
--- a/src/plugins/qmlprofiler/qmlprofilertool.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp
@@ -363,7 +363,7 @@ void QmlProfilerTool::gotoSourceLocation(const QString &fileUrl, int lineNumber,
TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor*>(editor);
if (textEditor) {
- EditorManager::instance()->addCurrentPositionToNavigationHistory();
+ EditorManager::addCurrentPositionToNavigationHistory();
// textEditor counts columns starting with 0, but the ASTs store the
// location starting with 1, therefore the -1 in the call to gotoLine
textEditor->gotoLine(lineNumber, columnNumber - 1);
diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp
index b908ee3221..58f11579be 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp
+++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp
@@ -90,8 +90,7 @@ QString QmlProjectRunConfiguration::disabledReason() const
void QmlProjectRunConfiguration::ctor()
{
// reset default settings in constructor
- EditorManager *em = Core::EditorManager::instance();
- connect(em, SIGNAL(currentEditorChanged(Core::IEditor*)),
+ connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
this, SLOT(changeCurrentFile(Core::IEditor*)));
connect(target(), SIGNAL(kitChanged()),
diff --git a/src/plugins/qnx/bardescriptordocument.cpp b/src/plugins/qnx/bardescriptordocument.cpp
index 200f5e7ce5..1a11c70c6a 100644
--- a/src/plugins/qnx/bardescriptordocument.cpp
+++ b/src/plugins/qnx/bardescriptordocument.cpp
@@ -78,7 +78,7 @@ BarDescriptorDocument::BarDescriptorDocument(BarDescriptorEditorWidget *editorWi
if (QTextCodec *defaultUTF8 = QTextCodec::codecForName("UTF-8"))
setCodec(defaultUTF8);
else
- setCodec(Core::EditorManager::instance()->defaultTextCodec());
+ setCodec(Core::EditorManager::defaultTextCodec());
}
BarDescriptorDocument::~BarDescriptorDocument()
diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp
index 4a173e3bf6..da17e539a1 100644
--- a/src/plugins/subversion/subversionplugin.cpp
+++ b/src/plugins/subversion/subversionplugin.cpp
@@ -1074,7 +1074,7 @@ void SubversionPlugin::slotDescribe()
void SubversionPlugin::submitCurrentLog()
{
m_submitActionTriggered = true;
- Core::EditorManager::instance()->closeEditors(QList<Core::IEditor*>()
+ Core::EditorManager::closeEditors(QList<Core::IEditor*>()
<< Core::EditorManager::currentEditor());
}
diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp
index 15db797efc..ea86ec3a20 100644
--- a/src/plugins/texteditor/basetexteditor.cpp
+++ b/src/plugins/texteditor/basetexteditor.cpp
@@ -521,7 +521,7 @@ void BaseTextEditorWidget::selectEncoding()
break; }
case CodecSelector::Save:
doc->setCodec(codecSelector.selectedCodec());
- Core::EditorManager::instance()->saveEditor(editor());
+ Core::EditorManager::saveEditor(editor());
updateTextCodecLabel();
break;
case CodecSelector::Cancel:
@@ -4004,7 +4004,7 @@ void BaseTextEditorWidget::slotCursorPositionChanged()
<< "indent:" << BaseTextDocumentLayout::userData(textCursor().block())->foldingIndent();
#endif
if (!d->m_contentsChanged && d->m_lastCursorChangeWasInteresting) {
- Core::EditorManager::instance()->addCurrentPositionToNavigationHistory(editor(), d->m_tempNavigationState);
+ Core::EditorManager::addCurrentPositionToNavigationHistory(editor(), d->m_tempNavigationState);
d->m_lastCursorChangeWasInteresting = false;
} else if (d->m_contentsChanged) {
saveCurrentCursorPositionForNavigation();
@@ -4170,11 +4170,11 @@ void BaseTextEditorWidget::mouseMoveEvent(QMouseEvent *e)
static bool handleForwardBackwardMouseButtons(QMouseEvent *e)
{
if (e->button() == Qt::XButton1) {
- Core::EditorManager::instance()->goBackInNavigationHistory();
+ Core::EditorManager::goBackInNavigationHistory();
return true;
}
if (e->button() == Qt::XButton2) {
- Core::EditorManager::instance()->goForwardInNavigationHistory();
+ Core::EditorManager::goForwardInNavigationHistory();
return true;
}
@@ -4224,7 +4224,7 @@ void BaseTextEditorWidget::mouseReleaseEvent(QMouseEvent *e)
&& e->button() == Qt::LeftButton
) {
- Core::EditorManager::instance()->addCurrentPositionToNavigationHistory();
+ Core::EditorManager::addCurrentPositionToNavigationHistory();
bool inNextSplit = ((e->modifiers() & Qt::AltModifier) && !alwaysOpenLinksInNextSplit())
|| (alwaysOpenLinksInNextSplit() && !(e->modifiers() & Qt::AltModifier));
if (openLink(findLinkAt(cursorForPosition(e->pos())), inNextSplit)) {
@@ -4815,11 +4815,10 @@ bool BaseTextEditorWidget::openLink(const Link &link, bool inNextSplit)
if (!link.hasValidTarget())
return false;
- Core::EditorManager *editorManager = Core::EditorManager::instance();
if (inNextSplit) {
- editorManager->gotoOtherSplit();
+ Core::EditorManager::gotoOtherSplit();
} else if (baseTextDocument()->filePath() == link.targetFileName) {
- editorManager->addCurrentPositionToNavigationHistory();
+ Core::EditorManager::addCurrentPositionToNavigationHistory();
gotoLine(link.targetLine, link.targetColumn);
setFocus();
return true;
diff --git a/src/plugins/texteditor/basetextmark.cpp b/src/plugins/texteditor/basetextmark.cpp
index e4558341d4..fc8e5f6a83 100644
--- a/src/plugins/texteditor/basetextmark.cpp
+++ b/src/plugins/texteditor/basetextmark.cpp
@@ -44,8 +44,7 @@ using namespace TextEditor::Internal;
BaseTextMarkRegistry::BaseTextMarkRegistry(QObject *parent)
: QObject(parent)
{
- Core::EditorManager *em = Core::EditorManager::instance();
- connect(em, SIGNAL(editorOpened(Core::IEditor*)),
+ connect(Core::EditorManager::instance(), SIGNAL(editorOpened(Core::IEditor*)),
SLOT(editorOpened(Core::IEditor*)));
Core::DocumentManager *dm = Core::DocumentManager::instance();
diff --git a/src/plugins/texteditor/behaviorsettingspage.cpp b/src/plugins/texteditor/behaviorsettingspage.cpp
index eac693c00b..63134da656 100644
--- a/src/plugins/texteditor/behaviorsettingspage.cpp
+++ b/src/plugins/texteditor/behaviorsettingspage.cpp
@@ -222,8 +222,7 @@ void BehaviorSettingsPage::settingsToUI()
d->m_page->behaviorWidget->setAssignedStorageSettings(d->m_storageSettings);
d->m_page->behaviorWidget->setAssignedBehaviorSettings(d->m_behaviorSettings);
d->m_page->behaviorWidget->setAssignedExtraEncodingSettings(d->m_extraEncodingSettings);
- d->m_page->behaviorWidget->setAssignedCodec(
- Core::EditorManager::instance()->defaultTextCodec());
+ d->m_page->behaviorWidget->setAssignedCodec(Core::EditorManager::defaultTextCodec());
}
void BehaviorSettingsPage::finish()
diff --git a/src/plugins/texteditor/findincurrentfile.cpp b/src/plugins/texteditor/findincurrentfile.cpp
index a01144fd3e..87e2c86179 100644
--- a/src/plugins/texteditor/findincurrentfile.cpp
+++ b/src/plugins/texteditor/findincurrentfile.cpp
@@ -67,7 +67,7 @@ Utils::FileIterator *FindInCurrentFile::files(const QStringList &nameFilters,
QMap<QString, QTextCodec *> openEditorEncodings = ITextEditor::openedTextDocumentEncodings();
QTextCodec *codec = openEditorEncodings.value(fileName);
if (!codec)
- codec = Core::EditorManager::instance()->defaultTextCodec();
+ codec = Core::EditorManager::defaultTextCodec();
return new Utils::FileIterator(QStringList() << fileName, QList<QTextCodec *>() << codec);
}
diff --git a/src/plugins/texteditor/findinfiles.cpp b/src/plugins/texteditor/findinfiles.cpp
index f555b6fce3..2b67ea3c3b 100644
--- a/src/plugins/texteditor/findinfiles.cpp
+++ b/src/plugins/texteditor/findinfiles.cpp
@@ -75,7 +75,7 @@ Utils::FileIterator *FindInFiles::files(const QStringList &nameFilters,
{
return new Utils::SubDirFileIterator(QStringList() << additionalParameters.toString(),
nameFilters,
- Core::EditorManager::instance()->defaultTextCodec());
+ Core::EditorManager::defaultTextCodec());
}
QVariant FindInFiles::additionalParameters() const
diff --git a/src/plugins/texteditor/findinopenfiles.cpp b/src/plugins/texteditor/findinopenfiles.cpp
index 8f3d258465..7a882056d3 100644
--- a/src/plugins/texteditor/findinopenfiles.cpp
+++ b/src/plugins/texteditor/findinopenfiles.cpp
@@ -43,9 +43,9 @@ using namespace TextEditor::Internal;
FindInOpenFiles::FindInOpenFiles()
{
- connect(Core::ICore::instance()->editorManager(), SIGNAL(editorOpened(Core::IEditor*)),
+ connect(Core::EditorManager::instance(), SIGNAL(editorOpened(Core::IEditor*)),
this, SLOT(updateEnabledState()));
- connect(Core::ICore::instance()->editorManager(), SIGNAL(editorsClosed(QList<Core::IEditor*>)),
+ connect(Core::EditorManager::instance(), SIGNAL(editorsClosed(QList<Core::IEditor*>)),
this, SLOT(updateEnabledState()));
}
@@ -74,7 +74,7 @@ Utils::FileIterator *FindInOpenFiles::files(const QStringList &nameFilters,
fileNames.append(fileName);
QTextCodec *codec = openEditorEncodings.value(fileName);
if (!codec)
- codec = Core::EditorManager::instance()->defaultTextCodec();
+ codec = Core::EditorManager::defaultTextCodec();
codecs.append(codec);
}
}
diff --git a/src/plugins/texteditor/linenumberfilter.cpp b/src/plugins/texteditor/linenumberfilter.cpp
index d5f44e7cd7..1247f96d02 100644
--- a/src/plugins/texteditor/linenumberfilter.cpp
+++ b/src/plugins/texteditor/linenumberfilter.cpp
@@ -91,8 +91,7 @@ void LineNumberFilter::accept(FilterEntry selection) const
{
ITextEditor *editor = currentTextEditor();
if (editor) {
- Core::EditorManager *editorManager = Core::EditorManager::instance();
- editorManager->addCurrentPositionToNavigationHistory();
+ EditorManager::addCurrentPositionToNavigationHistory();
LineColumn data = selection.internalData.value<LineColumn>();
if (data.first < 1) { // jump to column in same line
int currLine, currColumn;
@@ -100,7 +99,7 @@ void LineNumberFilter::accept(FilterEntry selection) const
data.first = currLine;
}
editor->gotoLine(data.first, data.second);
- Core::EditorManager::activateEditor(editor);
+ EditorManager::activateEditor(editor);
}
}
diff --git a/src/plugins/texteditor/outlinefactory.cpp b/src/plugins/texteditor/outlinefactory.cpp
index c2eaad2675..d4c5bbd7d1 100644
--- a/src/plugins/texteditor/outlinefactory.cpp
+++ b/src/plugins/texteditor/outlinefactory.cpp
@@ -71,8 +71,7 @@ OutlineWidgetStack::OutlineWidgetStack(OutlineFactory *factory) :
m_filterMenu = new QMenu(m_filterButton);
m_filterButton->setMenu(m_filterMenu);
- Core::EditorManager *editorManager = Core::EditorManager::instance();
- connect(editorManager, SIGNAL(currentEditorChanged(Core::IEditor*)),
+ connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
this, SLOT(updateCurrentEditor(Core::IEditor*)));
updateCurrentEditor(Core::EditorManager::currentEditor());
}
diff --git a/src/plugins/texteditor/refactoringchanges.cpp b/src/plugins/texteditor/refactoringchanges.cpp
index 4d1cf13688..57dd3a9a81 100644
--- a/src/plugins/texteditor/refactoringchanges.cpp
+++ b/src/plugins/texteditor/refactoringchanges.cpp
@@ -94,7 +94,7 @@ bool RefactoringChanges::createFile(const QString &fileName, const QString &cont
// Write the file to disk:
Utils::TextFileFormat format;
- format.codec = Core::EditorManager::instance()->defaultTextCodec();
+ format.codec = Core::EditorManager::defaultTextCodec();
QString error;
bool saveOk = format.writeFile(fileName, document->toPlainText(), &error);
delete document;
@@ -207,7 +207,7 @@ QTextDocument *RefactoringFile::mutableDocument() const
QString fileContents;
if (!m_fileName.isEmpty()) {
QString error;
- QTextCodec *defaultCodec = Core::EditorManager::instance()->defaultTextCodec();
+ QTextCodec *defaultCodec = Core::EditorManager::defaultTextCodec();
Utils::TextFileFormat::ReadResult result = Utils::TextFileFormat::readFile(
m_fileName, defaultCodec,
&fileContents, &m_textFileFormat,
diff --git a/src/plugins/todo/todoitemsprovider.cpp b/src/plugins/todo/todoitemsprovider.cpp
index eb491cc4e4..670b126b0c 100644
--- a/src/plugins/todo/todoitemsprovider.cpp
+++ b/src/plugins/todo/todoitemsprovider.cpp
@@ -160,10 +160,8 @@ void TodoItemsProvider::setupStartupProjectBinding()
void TodoItemsProvider::setupCurrentEditorBinding()
{
- Core::EditorManager *editorManager = Core::EditorManager::instance();
-
m_currentEditor = Core::EditorManager::currentEditor();
- connect(editorManager, SIGNAL(currentEditorChanged(Core::IEditor*)),
+ connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
SLOT(currentEditorChanged(Core::IEditor*)));
}
diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp
index b2f24db908..8eb380c5a8 100644
--- a/src/plugins/vcsbase/vcsbaseeditor.cpp
+++ b/src/plugins/vcsbase/vcsbaseeditor.cpp
@@ -878,8 +878,7 @@ void VcsBaseEditorWidget::slotJumpToEntry(int index)
int currentLine, currentColumn;
convertPosition(position(), &currentLine, &currentColumn);
if (lineNumber != currentLine) {
- Core::EditorManager *editorManager = Core::EditorManager::instance();
- editorManager->addCurrentPositionToNavigationHistory();
+ Core::EditorManager::addCurrentPositionToNavigationHistory();
gotoLine(lineNumber, 0);
}
}