ProjectExplorer: Use a local object pool for IProjectManagers

Change-Id: I94ada96da2bf7ce4c95c0ae8f393e6303e79ff60
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
hjk
2017-03-02 08:47:06 +01:00
parent d2b82c6cf1
commit e9cdc807e7
4 changed files with 50 additions and 64 deletions

View File

@@ -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;