ProjectExplorer: Set temporary flag on scratch buffer document

Task-number: QTCREATORBUG-23509
Change-Id: Ieb3922030cb1dd4984b91ac24d0396bb19a4a711
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
David Schulz
2020-03-24 09:44:38 +01:00
parent 6989c9bbea
commit 398930d3cf
5 changed files with 25 additions and 14 deletions

View File

@@ -33,6 +33,7 @@
#include "../projectexplorerconstants.h"
#include "../projecttree.h"
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/messagemanager.h>
#include <utils/algorithm.h>
@@ -465,11 +466,14 @@ void JsonWizard::openFiles(const JsonWizard::GeneratorFiles &files)
openedSomething = true;
}
if (file.attributes() & Core::GeneratedFile::OpenEditorAttribute) {
if (!Core::EditorManager::openEditor(file.path(), file.editorId())) {
Core::IEditor *editor = Core::EditorManager::openEditor(file.path(), file.editorId());
if (!editor) {
errorMessage = QCoreApplication::translate("ProjectExplorer::JsonWizard",
"Failed to open an editor for \"%1\".")
.arg(QDir::toNativeSeparators(file.path()));
break;
} else if (file.attributes() & Core::GeneratedFile::TemporaryFile) {
editor->document()->setTemporary(true);
}
openedSomething = true;
}