Commit 4a24df38 authored by hjk's avatar hjk

EditorManager: Use static pattern, adjust surrounding code

Change-Id: I3255a0150cd9a730336456c5a9f986eb74fefbff
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent e1823072
......@@ -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);
......
......@@ -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,
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -55,7 +55,6 @@ private slots:
void grabEditorManager(Core::IMode *mode);
private:
EditorManager *m_editorManager;
QSplitter *m_splitter;
QVBoxLayout *m_rightSplitWidgetLayout;
};
......
......@@ -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);
......
......@@ -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));
}
......
......@@ -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>())) {
......
......@@ -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)
......
......@@ -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()
......
......@@ -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()
......
......@@ -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
......
......@@ -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);
......
......@@ -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
......
......@@ -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;
......
......@@ -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();
}
......
......@@ -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);
......
......@@ -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());
......
......@@ -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();
......
......@@ -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)
......
......@@ -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();
......
......@@ -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());
}
......@@ -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)
......
......@@ -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()) {
......
......@@ -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
......
......@@ -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*)),
......
......@@ -124,8 +124,7 @@ DisassemblerAgentPrivate::DisassemblerAgentPrivate()
DisassemblerAgentPrivate::~DisassemblerAgentPrivate()
{
if (editor)
EditorManager::instance()->closeEditor(editor);
EditorManager::closeEditor(editor);
editor = 0;
delete locationMark;
qDeleteAll(breakpointMarks);
......
......@@ -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));
}
......
......@@ -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;
......
......@@ -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;
}
}
......
......@@ -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*)),
......
......@@ -76,8 +76,7 @@ SourceAgentPrivate::SourceAgentPrivate()
SourceAgentPrivate::~SourceAgentPrivate()