forked from qt-creator/qt-creator
Added `Find Usages' of a Symbol.
This commit is contained in:
@@ -532,10 +532,21 @@ static void find_helper(QFutureInterface<Utils::FileSearchResult> &future,
|
||||
future.setProgressValue(files.size());
|
||||
}
|
||||
|
||||
void CppFindReferences::findAll(Symbol *symbol)
|
||||
void CppFindReferences::findUsages(Symbol *symbol)
|
||||
{
|
||||
_resultWindow->clearContents();
|
||||
findAll_helper(symbol);
|
||||
}
|
||||
|
||||
void CppFindReferences::renameUsages(Symbol *symbol)
|
||||
{
|
||||
_resultWindow->clearContents();
|
||||
_resultWindow->setShowReplaceUI(true);
|
||||
findAll_helper(symbol);
|
||||
}
|
||||
|
||||
void CppFindReferences::findAll_helper(Symbol *symbol)
|
||||
{
|
||||
_resultWindow->popup(true);
|
||||
|
||||
const Snapshot snapshot = _modelManager->snapshot();
|
||||
|
||||
@@ -62,13 +62,17 @@ Q_SIGNALS:
|
||||
void changed();
|
||||
|
||||
public:
|
||||
void findAll(CPlusPlus::Symbol *symbol);
|
||||
void findUsages(CPlusPlus::Symbol *symbol);
|
||||
void renameUsages(CPlusPlus::Symbol *symbol);
|
||||
|
||||
private Q_SLOTS:
|
||||
void displayResult(int);
|
||||
void searchFinished();
|
||||
void openEditor(const QString&, int, int);
|
||||
|
||||
private:
|
||||
void findAll_helper(CPlusPlus::Symbol *symbol);
|
||||
|
||||
private:
|
||||
QPointer<CppModelManager> _modelManager;
|
||||
Find::SearchResultWindow *_resultWindow;
|
||||
|
||||
@@ -755,10 +755,16 @@ QList<int> CppModelManager::references(CPlusPlus::Symbol *symbol,
|
||||
return m_findReferences->references(LookupContext::canonicalSymbol(symbol), doc, snapshot);
|
||||
}
|
||||
|
||||
void CppModelManager::findReferences(CPlusPlus::Symbol *symbol)
|
||||
void CppModelManager::findUsages(CPlusPlus::Symbol *symbol)
|
||||
{
|
||||
if (symbol->identifier())
|
||||
m_findReferences->findAll(symbol);
|
||||
m_findReferences->findUsages(symbol);
|
||||
}
|
||||
|
||||
void CppModelManager::renameUsages(CPlusPlus::Symbol *symbol)
|
||||
{
|
||||
if (symbol->identifier())
|
||||
m_findReferences->renameUsages(symbol);
|
||||
}
|
||||
|
||||
QMap<QString, QString> CppModelManager::buildWorkingCopyList()
|
||||
|
||||
@@ -106,7 +106,8 @@ public:
|
||||
CPlusPlus::Document::Ptr doc,
|
||||
const CPlusPlus::Snapshot &snapshot);
|
||||
|
||||
virtual void findReferences(CPlusPlus::Symbol *symbol);
|
||||
virtual void findUsages(CPlusPlus::Symbol *symbol);
|
||||
virtual void renameUsages(CPlusPlus::Symbol *symbol);
|
||||
|
||||
void setHeaderSuffixes(const QStringList &suffixes)
|
||||
{ m_headerSuffixes = suffixes; }
|
||||
|
||||
@@ -101,7 +101,8 @@ public:
|
||||
CPlusPlus::Document::Ptr doc,
|
||||
const CPlusPlus::Snapshot &snapshot) = 0;
|
||||
|
||||
virtual void findReferences(CPlusPlus::Symbol *symbol) = 0;
|
||||
virtual void renameUsages(CPlusPlus::Symbol *symbol) = 0;
|
||||
virtual void findUsages(CPlusPlus::Symbol *symbol) = 0;
|
||||
};
|
||||
|
||||
class CPPTOOLS_EXPORT AbstractEditorSupport
|
||||
|
||||
Reference in New Issue
Block a user