forked from qt-creator/qt-creator
QmlJS find usages: Don't pop up a result window if we don't search.
Task-number: QTCREATORBUG-4090
This commit is contained in:
@@ -645,6 +645,10 @@ static void find_helper(QFutureInterface<FindReferences::Usage> &future,
|
|||||||
if (!scope)
|
if (!scope)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// report a dummy usage to indicate the search is starting
|
||||||
|
FindReferences::Usage usage;
|
||||||
|
future.reportResult(usage);
|
||||||
|
|
||||||
QStringList files;
|
QStringList files;
|
||||||
foreach (const Document::Ptr &doc, snapshot) {
|
foreach (const Document::Ptr &doc, snapshot) {
|
||||||
// ### skip files that don't contain the name token
|
// ### skip files that don't contain the name token
|
||||||
@@ -663,18 +667,11 @@ static void find_helper(QFutureInterface<FindReferences::Usage> &future,
|
|||||||
|
|
||||||
void FindReferences::findUsages(const QString &fileName, quint32 offset)
|
void FindReferences::findUsages(const QString &fileName, quint32 offset)
|
||||||
{
|
{
|
||||||
Find::SearchResult *search = _resultWindow->startNewSearch(Find::SearchResultWindow::SearchOnly);
|
|
||||||
|
|
||||||
connect(search, SIGNAL(activated(Find::SearchResultItem)),
|
|
||||||
this, SLOT(openEditor(Find::SearchResultItem)));
|
|
||||||
|
|
||||||
findAll_helper(fileName, offset);
|
findAll_helper(fileName, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindReferences::findAll_helper(const QString &fileName, quint32 offset)
|
void FindReferences::findAll_helper(const QString &fileName, quint32 offset)
|
||||||
{
|
{
|
||||||
_resultWindow->popup(true);
|
|
||||||
|
|
||||||
ModelManagerInterface *modelManager = ModelManagerInterface::instance();
|
ModelManagerInterface *modelManager = ModelManagerInterface::instance();
|
||||||
|
|
||||||
|
|
||||||
@@ -682,16 +679,26 @@ void FindReferences::findAll_helper(const QString &fileName, quint32 offset)
|
|||||||
&find_helper, modelManager->workingCopy(),
|
&find_helper, modelManager->workingCopy(),
|
||||||
modelManager->snapshot(), fileName, offset);
|
modelManager->snapshot(), fileName, offset);
|
||||||
m_watcher.setFuture(result);
|
m_watcher.setFuture(result);
|
||||||
|
|
||||||
Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager();
|
|
||||||
Core::FutureProgress *progress = progressManager->addTask(result, tr("Searching"),
|
|
||||||
QmlJSEditor::Constants::TASK_SEARCH);
|
|
||||||
|
|
||||||
connect(progress, SIGNAL(clicked()), _resultWindow, SLOT(popup()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindReferences::displayResults(int first, int last)
|
void FindReferences::displayResults(int first, int last)
|
||||||
{
|
{
|
||||||
|
// the first usage is always a dummy to indicate we now start searching
|
||||||
|
if (first == 0) {
|
||||||
|
Find::SearchResult *search = _resultWindow->startNewSearch(Find::SearchResultWindow::SearchOnly);
|
||||||
|
connect(search, SIGNAL(activated(Find::SearchResultItem)),
|
||||||
|
this, SLOT(openEditor(Find::SearchResultItem)));
|
||||||
|
_resultWindow->popup(true);
|
||||||
|
|
||||||
|
Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager();
|
||||||
|
Core::FutureProgress *progress = progressManager->addTask(
|
||||||
|
m_watcher.future(), tr("Searching"),
|
||||||
|
QmlJSEditor::Constants::TASK_SEARCH);
|
||||||
|
connect(progress, SIGNAL(clicked()), _resultWindow, SLOT(popup()));
|
||||||
|
|
||||||
|
++first;
|
||||||
|
}
|
||||||
|
|
||||||
for (int index = first; index != last; ++index) {
|
for (int index = first; index != last; ++index) {
|
||||||
Usage result = m_watcher.future().resultAt(index);
|
Usage result = m_watcher.future().resultAt(index);
|
||||||
_resultWindow->addResult(result.path,
|
_resultWindow->addResult(result.path,
|
||||||
|
|||||||
Reference in New Issue
Block a user