diff options
author | Eike Ziller <eike.ziller@digia.com> | 2013-07-12 16:38:37 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@digia.com> | 2013-07-15 07:57:58 +0200 |
commit | c32db575148632655cfe8c3a1516e2223b8e5001 (patch) | |
tree | f8297cbc616f40902e6303851fe1f399b7ce2dd2 | |
parent | aa981f4066b4fd698c7c0b80e2646bec628e0c69 (diff) | |
download | qt-creator-c32db575148632655cfe8c3a1516e2223b8e5001.tar.gz |
EditorManager: Remove unneeded methods
Change-Id: If3ab9414270df33fb6b0e269b628813e4c71e5c8
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
-rw-r--r-- | src/plugins/coreplugin/documentmanager.cpp | 12 | ||||
-rw-r--r-- | src/plugins/coreplugin/editormanager/editormanager.cpp | 17 | ||||
-rw-r--r-- | src/plugins/coreplugin/editormanager/editormanager.h | 2 |
3 files changed, 7 insertions, 24 deletions
diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp index a90ab6c250..dc81932f66 100644 --- a/src/plugins/coreplugin/documentmanager.cpp +++ b/src/plugins/coreplugin/documentmanager.cpp @@ -826,7 +826,7 @@ void DocumentManager::checkForReload() IDocument::ReloadSetting defaultBehavior = EditorManager::instance()->reloadSetting(); Utils::ReloadPromptAnswer previousAnswer = Utils::ReloadCurrent; - QList<IEditor*> editorsToClose; + QList<IDocument *> documentsToClose; QMap<IDocument*, QString> documentsToSave; // collect file information @@ -931,7 +931,7 @@ void DocumentManager::checkForReload() && type == IDocument::TypeRemoved && !document->isModified()) { // file removed, but unmodified files should be reloaded // so we close the file - editorsToClose << EditorManager::instance()->editorsForDocument(document); + documentsToClose << document; } else if (defaultBehavior == IDocument::IgnoreAll) { // content change or removed, but settings say ignore success = document->reload(&errorString, IDocument::FlagIgnore, type); @@ -943,7 +943,7 @@ void DocumentManager::checkForReload() if (document->reloadBehavior(trigger, type) == IDocument::BehaviorSilent) { // content change or removed, IDocument wants silent handling if (type == IDocument::TypeRemoved) - editorsToClose << EditorManager::instance()->editorsForDocument(document); + documentsToClose << document; else success = document->reload(&errorString, IDocument::FlagReload, type); // IDocument wants us to ask @@ -968,7 +968,7 @@ void DocumentManager::checkForReload() success = document->reload(&errorString, IDocument::FlagIgnore, IDocument::TypeContents); break; case Utils::CloseCurrent: - editorsToClose << EditorManager::instance()->editorsForDocument(document); + documentsToClose << document; break; } } @@ -992,7 +992,7 @@ void DocumentManager::checkForReload() break; } case Utils::FileDeletedClose: - editorsToClose << EditorManager::instance()->editorsForDocument(document); + documentsToClose << document; unhandled = false; break; } @@ -1016,7 +1016,7 @@ void DocumentManager::checkForReload() errorStrings.join(QLatin1String("\n"))); // handle deleted files - EditorManager::instance()->closeEditors(editorsToClose, false); + EditorManager::closeDocuments(documentsToClose, false); QMapIterator<IDocument *, QString> it(documentsToSave); while (it.hasNext()) { it.next(); diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 3db507faf2..6cc7a85bf0 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -638,16 +638,6 @@ QList<IEditor *> EditorManager::editorsForFileName(const QString &filename) cons return found; } -QList<IEditor *> EditorManager::editorsForDocument(IDocument *document) const -{ - QList<IEditor *> found; - foreach (IEditor *editor, openedEditors()) { - if (editor->document() == document) - found << editor; - } - return found; -} - IDocument *EditorManager::currentDocument() { return d->m_currentEditor ? d->m_currentEditor->document() : 0; @@ -1299,7 +1289,7 @@ IEditor *EditorManager::activateEditorForDocument(IDocument *document, OpenEdito Core::IEditor *EditorManager::activateEditorForDocument(Core::Internal::EditorView *view, Core::IDocument *document, OpenEditorFlags flags) { Q_ASSERT(view); - const QList<IEditor*> editors = editorsForDocument(document); + const QList<IEditor*> editors = d->m_documentModel->editorsForDocument(document); if (editors.isEmpty()) return 0; @@ -1695,11 +1685,6 @@ IEditor *EditorManager::openEditorWithContents(const Id &editorId, return edt; } -bool EditorManager::hasEditor(const QString &fileName) const -{ - return !editorsForFileName(fileName).isEmpty(); -} - void EditorManager::restoreEditorState(IEditor *editor) { QTC_ASSERT(editor, return); diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h index 4a7f057b38..9836d56563 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.h +++ b/src/plugins/coreplugin/editormanager/editormanager.h @@ -122,9 +122,7 @@ public: QStringList getOpenFileNames() const; Id getOpenWithEditorId(const QString &fileName, bool *isExternalEditor = 0) const; - bool hasEditor(const QString &fileName) const; QList<IEditor *> editorsForFileName(const QString &filename) const; - QList<IEditor *> editorsForDocument(IDocument *document) const; static IDocument *currentDocument(); static IEditor *currentEditor(); |