forked from qt-creator/qt-creator
Ensure the user can stop a semantic search and added a method to get a pointer to the ModelManagerInterface.
This commit is contained in:
@@ -466,6 +466,12 @@ static void find_helper(QFutureInterface<Utils::FileSearchResult> &future,
|
||||
future.setProgressRange(0, files.size());
|
||||
|
||||
for (int i = 0; i < files.size(); ++i) {
|
||||
if (future.isPaused())
|
||||
future.waitForResume();
|
||||
|
||||
if (future.isCanceled())
|
||||
break;
|
||||
|
||||
const QString &fileName = files.at(i);
|
||||
future.setProgressValueAndText(i, QFileInfo(fileName).fileName());
|
||||
|
||||
|
||||
@@ -56,6 +56,8 @@
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <TranslationUnit.h>
|
||||
@@ -588,6 +590,13 @@ Document::Ptr CppPreprocessor::switchDocument(Document::Ptr doc)
|
||||
}
|
||||
|
||||
|
||||
CppTools::CppModelManagerInterface *CppTools::CppModelManagerInterface::instance()
|
||||
{
|
||||
ExtensionSystem::PluginManager *pluginManager = ExtensionSystem::PluginManager::instance();
|
||||
return pluginManager->getObject<CppTools::CppModelManagerInterface>();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\class CppTools::CppModelManager
|
||||
|
||||
@@ -81,6 +81,8 @@ public:
|
||||
CppModelManagerInterface(QObject *parent = 0) : QObject(parent) {}
|
||||
virtual ~CppModelManagerInterface() {}
|
||||
|
||||
static CppModelManagerInterface *instance();
|
||||
|
||||
virtual void GC() = 0;
|
||||
virtual void updateSourceFiles(const QStringList &sourceFiles) = 0;
|
||||
|
||||
|
||||
@@ -272,6 +272,12 @@ static void semanticSearch_helper(QFutureInterface<Utils::FileSearchResult> &fut
|
||||
|
||||
int progress = 0;
|
||||
foreach (Document::Ptr doc, snapshot) {
|
||||
if (future.isPaused())
|
||||
future.waitForResume();
|
||||
|
||||
if (future.isCanceled())
|
||||
break;
|
||||
|
||||
const QString fileName = doc->fileName();
|
||||
|
||||
QByteArray source;
|
||||
|
||||
Reference in New Issue
Block a user