forked from qt-creator/qt-creator
ProjectExplorer: Use a local object pool for IProjectManagers
Change-Id: I94ada96da2bf7ce4c95c0ae8f393e6303e79ff60 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -32,8 +32,6 @@
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -103,22 +101,13 @@ Core::GeneratedFiles JsonWizardScannerGenerator::fileList(Utils::MacroExpander *
|
||||
|
||||
result = scan(project.absolutePath(), project);
|
||||
|
||||
QList<IProjectManager *> projectManagers
|
||||
= ExtensionSystem::PluginManager::getObjects<IProjectManager>();
|
||||
|
||||
int projectCount = 0;
|
||||
for (auto it = result.begin(); it != result.end(); ++it) {
|
||||
const QString relPath = project.relativeFilePath(it->path());
|
||||
it->setBinary(binaryPattern.match(relPath).hasMatch());
|
||||
|
||||
Utils::MimeType mt = Utils::mimeTypeForFile(relPath);
|
||||
if (mt.isValid()) {
|
||||
bool found = Utils::anyOf(projectManagers, [mt](IProjectManager *m) {
|
||||
return mt.matchesName(m->mimeType());
|
||||
});
|
||||
if (found && !(onlyFirst && projectCount++))
|
||||
it->setAttributes(it->attributes() | Core::GeneratedFile::OpenProjectAttribute);
|
||||
}
|
||||
bool found = IProjectManager::managerForMimeType(Utils::mimeTypeForFile(relPath));
|
||||
if (found && !(onlyFirst && projectCount++))
|
||||
it->setAttributes(it->attributes() | Core::GeneratedFile::OpenProjectAttribute);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user