summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2013-08-06 21:35:06 +0300
committerOrgad Shaneh <orgads@gmail.com>2013-08-07 11:08:36 +0200
commit0b4300a68c744dc33af545a88b82cbd6c00fcb5d (patch)
tree9464c4c64f3ec8b505835caeb9cfcb1ecefe749c /src/plugins
parent5a02089e3cd165d1774e2b0f0e8d466f0688f9dd (diff)
downloadqt-creator-0b4300a68c744dc33af545a88b82cbd6c00fcb5d.tar.gz
EditorManager: Make closeEditor public
And use it where appropriate Change-Id: I0f37b8aada6eaa9be6743724b91a59173a01cb0c Reviewed-by: hjk <hjk121@nokiamail.com> Reviewed-by: David Schulz <david.schulz@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/coreplugin/editormanager/editormanager.cpp4
-rw-r--r--src/plugins/coreplugin/editormanager/editormanager.h2
-rw-r--r--src/plugins/cppeditor/cppdoxygen_test.cpp2
-rw-r--r--src/plugins/cpptools/cppmodelmanager_test.cpp3
-rw-r--r--src/plugins/cvs/cvsplugin.cpp3
-rw-r--r--src/plugins/debugger/disassembleragent.cpp6
-rw-r--r--src/plugins/debugger/sourceagent.cpp6
-rw-r--r--src/plugins/fakevim/fakevimplugin.cpp9
-rw-r--r--src/plugins/git/gitsubmiteditor.cpp2
-rw-r--r--src/plugins/perforce/perforceplugin.cpp3
10 files changed, 15 insertions, 25 deletions
diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp
index 77a8820044..350668faae 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.cpp
+++ b/src/plugins/coreplugin/editormanager/editormanager.cpp
@@ -1009,11 +1009,11 @@ void EditorManager::setCurrentEditorFromContextChange()
setCurrentEditor(newCurrent);
}
-void EditorManager::closeEditor(Core::IEditor *editor)
+void EditorManager::closeEditor(Core::IEditor *editor, bool askAboutModifiedEditors)
{
if (!editor)
return;
- closeEditors(QList<IEditor *>() << editor);
+ closeEditors(QList<IEditor *>() << editor, askAboutModifiedEditors);
}
void EditorManager::closeEditor(DocumentModel::Entry *entry)
diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h
index 7c629d8945..ee15724178 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.h
+++ b/src/plugins/coreplugin/editormanager/editormanager.h
@@ -142,6 +142,7 @@ public:
bool saveEditor(IEditor *editor);
bool closeEditors(const QList<IEditor *> &editorsToClose, bool askAboutModifiedEditors = true);
+ void closeEditor(IEditor *editor, bool askAboutModifiedEditors = true);
MakeWritableResult makeFileWritable(IDocument *document);
@@ -268,7 +269,6 @@ private:
static Internal::EditorView *viewForEditor(IEditor *editor);
static Internal::SplitterOrView *findRoot(const Internal::EditorView *view, int *rootIndex = 0);
- void closeEditor(IEditor *editor);
void closeView(Internal::EditorView *view);
void emptyView(Internal::EditorView *view);
static void splitNewWindow(Internal::EditorView *view);
diff --git a/src/plugins/cppeditor/cppdoxygen_test.cpp b/src/plugins/cppeditor/cppdoxygen_test.cpp
index 13d0d2d3a0..c5821b39f5 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()->closeEditors(QList<Core::IEditor *>() << editor, false);
+ EditorManager::instance()->closeEditor(editor, false);
QCoreApplication::processEvents(); // process any pending events
// Remove the test file from the code-model
diff --git a/src/plugins/cpptools/cppmodelmanager_test.cpp b/src/plugins/cpptools/cppmodelmanager_test.cpp
index 0c35d4099a..669c086d52 100644
--- a/src/plugins/cpptools/cppmodelmanager_test.cpp
+++ b/src/plugins/cpptools/cppmodelmanager_test.cpp
@@ -540,8 +540,7 @@ void CppToolsPlugin::test_modelmanager_gc_if_last_cppeditor_closed()
QVERIFY(mm->snapshot().contains(file));
// Close file/editor
- const QList<Core::IEditor*> editorsToClose = QList<Core::IEditor*>() << editor;
- em->closeEditors(editorsToClose, /*askAboutModifiedEditors=*/ false);
+ em->closeEditor(editor, /*askAboutModifiedEditors=*/ false);
// Check: File is removed from the snapshpt
QVERIFY(!mm->workingCopy().contains(file));
diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp
index d29efd5af6..d0c3bd8e37 100644
--- a/src/plugins/cvs/cvsplugin.cpp
+++ b/src/plugins/cvs/cvsplugin.cpp
@@ -1212,8 +1212,7 @@ bool CvsPlugin::describe(const QString &repositoryPath,
void CvsPlugin::submitCurrentLog()
{
m_submitActionTriggered = true;
- EditorManager::instance()->closeEditors(QList<IEditor*>()
- << EditorManager::currentEditor());
+ EditorManager::instance()->closeEditor(EditorManager::currentEditor());
}
// Run CVS. At this point, file arguments must be relative to
diff --git a/src/plugins/debugger/disassembleragent.cpp b/src/plugins/debugger/disassembleragent.cpp
index 06f57e9de9..a587e4f36c 100644
--- a/src/plugins/debugger/disassembleragent.cpp
+++ b/src/plugins/debugger/disassembleragent.cpp
@@ -124,10 +124,8 @@ DisassemblerAgentPrivate::DisassemblerAgentPrivate()
DisassemblerAgentPrivate::~DisassemblerAgentPrivate()
{
- if (editor) {
- EditorManager *editorManager = EditorManager::instance();
- editorManager->closeEditors(QList<IEditor *>() << editor);
- }
+ if (editor)
+ EditorManager::instance()->closeEditor(editor);
editor = 0;
delete locationMark;
qDeleteAll(breakpointMarks);
diff --git a/src/plugins/debugger/sourceagent.cpp b/src/plugins/debugger/sourceagent.cpp
index fcf4b4ca59..b5bb5c8345 100644
--- a/src/plugins/debugger/sourceagent.cpp
+++ b/src/plugins/debugger/sourceagent.cpp
@@ -76,10 +76,8 @@ SourceAgentPrivate::SourceAgentPrivate()
SourceAgentPrivate::~SourceAgentPrivate()
{
- if (editor) {
- EditorManager *editorManager = EditorManager::instance();
- editorManager->closeEditors(QList<IEditor *>() << editor);
- }
+ if (editor)
+ EditorManager::instance()->closeEditor(editor);
editor = 0;
delete locationMark;
}
diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp
index 445f5a170a..ab682fe6ee 100644
--- a/src/plugins/fakevim/fakevimplugin.cpp
+++ b/src/plugins/fakevim/fakevimplugin.cpp
@@ -1865,13 +1865,10 @@ void FakeVimPluginPrivate::handleDelayedQuit(bool forced, IEditor *editor)
// This tries to simulate vim behaviour. But the models of vim and
// Qt Creator core do not match well...
EditorManager *editorManager = ICore::editorManager();
- if (editorManager->hasSplitter()) {
+ if (editorManager->hasSplitter())
triggerAction(Core::Constants::REMOVE_CURRENT_SPLIT);
- } else {
- QList<IEditor *> editors;
- editors.append(editor);
- editorManager->closeEditors(editors, !forced);
- }
+ else
+ editorManager->closeEditor(editor, !forced);
}
void FakeVimPluginPrivate::handleDelayedQuitAll(bool forced)
diff --git a/src/plugins/git/gitsubmiteditor.cpp b/src/plugins/git/gitsubmiteditor.cpp
index d318580b51..5eb0d5f9f0 100644
--- a/src/plugins/git/gitsubmiteditor.cpp
+++ b/src/plugins/git/gitsubmiteditor.cpp
@@ -181,7 +181,7 @@ void GitSubmitEditor::updateFileModel()
} else {
VcsBase::VcsBaseOutputWindow::instance()->append(errorMessage);
m_forceClose = true;
- Core::EditorManager::instance()->closeEditors(QList<IEditor*>() << this);
+ Core::EditorManager::instance()->closeEditor(this);
}
}
diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp
index b7aca23052..282db9f209 100644
--- a/src/plugins/perforce/perforceplugin.cpp
+++ b/src/plugins/perforce/perforceplugin.cpp
@@ -1296,8 +1296,7 @@ void PerforcePlugin::describe(const QString & source, const QString &n)
void PerforcePlugin::submitCurrentLog()
{
m_submitActionTriggered = true;
- Core::EditorManager *em = Core::EditorManager::instance();
- em->closeEditors(QList<Core::IEditor*>() << Core::EditorManager::currentEditor());
+ Core::EditorManager::instance()->closeEditor(Core::EditorManager::currentEditor());
}
void PerforcePlugin::cleanCommitMessageFile()