forked from qt-creator/qt-creator
Fix usage of EditorManager::editorsForFileName
And move to using the corresponding method in document model. Change-Id: I80b12ceab8a91c5393b9c0422d660a8896ae09d8 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -1250,16 +1250,11 @@ void GitPlugin::updateSubmodules()
|
||||
// If the file is modified in an editor, make sure it is saved.
|
||||
static bool ensureFileSaved(const QString &fileName)
|
||||
{
|
||||
const QList<Core::IEditor*> editors = Core::EditorManager::instance()->editorsForFileName(fileName);
|
||||
if (editors.isEmpty())
|
||||
return true;
|
||||
Core::IDocument *document = editors.front()->document();
|
||||
Core::IDocument *document = Core::EditorManager::documentModel()->documentForFilePath(fileName);
|
||||
if (!document || !document->isModified())
|
||||
return true;
|
||||
bool canceled;
|
||||
QList<Core::IDocument *> documents;
|
||||
documents << document;
|
||||
Core::DocumentManager::saveModifiedDocuments(documents, &canceled);
|
||||
Core::DocumentManager::saveModifiedDocuments(QList<Core::IDocument *>() << document, &canceled);
|
||||
return !canceled;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user