mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Search Refactoring for bugs
50983 - OrPattern not visible 51250 - search engine throws runtime exception OperationCanceledException
This commit is contained in:
parent
a693c52f25
commit
c1a246da20
20 changed files with 1789 additions and 1766 deletions
File diff suppressed because it is too large
Load diff
|
@ -650,9 +650,12 @@ import org.eclipse.core.runtime.Platform;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void search(IWorkspace workspace, ICSearchPattern pattern, ICSearchScope scope, ICSearchResultCollector collector) {
|
protected void search(IWorkspace workspace, ICSearchPattern pattern, ICSearchScope scope, ICSearchResultCollector collector) {
|
||||||
searchEngine.search( workspace, pattern, scope, collector, false );
|
try {
|
||||||
}
|
searchEngine.search( workspace, pattern, scope, collector, false );
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Utils
|
* Utils
|
||||||
|
|
|
@ -122,7 +122,11 @@ public class BaseSearchTest extends TestCase implements ICSearchConstants {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void search(IWorkspace workspace, ICSearchPattern pattern, ICSearchScope scope, ICSearchResultCollector collector) {
|
protected void search(IWorkspace workspace, ICSearchPattern pattern, ICSearchScope scope, ICSearchResultCollector collector) {
|
||||||
searchEngine.search( workspace, pattern, scope, collector, false );
|
try {
|
||||||
|
searchEngine.search( workspace, pattern, scope, collector, false );
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,10 +19,10 @@ import java.util.Set;
|
||||||
import org.eclipse.cdt.core.search.ICSearchConstants;
|
import org.eclipse.cdt.core.search.ICSearchConstants;
|
||||||
import org.eclipse.cdt.core.search.ICSearchPattern;
|
import org.eclipse.cdt.core.search.ICSearchPattern;
|
||||||
import org.eclipse.cdt.core.search.IMatch;
|
import org.eclipse.cdt.core.search.IMatch;
|
||||||
|
import org.eclipse.cdt.core.search.OrPattern;
|
||||||
import org.eclipse.cdt.core.search.SearchEngine;
|
import org.eclipse.cdt.core.search.SearchEngine;
|
||||||
import org.eclipse.cdt.internal.core.CharOperation;
|
import org.eclipse.cdt.internal.core.CharOperation;
|
||||||
import org.eclipse.cdt.internal.core.search.matching.ClassDeclarationPattern;
|
import org.eclipse.cdt.internal.core.search.matching.ClassDeclarationPattern;
|
||||||
import org.eclipse.cdt.internal.core.search.matching.OrPattern;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -22,13 +22,13 @@ import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.search.BasicSearchMatch;
|
import org.eclipse.cdt.core.search.BasicSearchMatch;
|
||||||
import org.eclipse.cdt.core.search.ICSearchPattern;
|
import org.eclipse.cdt.core.search.ICSearchPattern;
|
||||||
import org.eclipse.cdt.core.search.IMatch;
|
import org.eclipse.cdt.core.search.IMatch;
|
||||||
|
import org.eclipse.cdt.core.search.OrPattern;
|
||||||
import org.eclipse.cdt.core.search.SearchEngine;
|
import org.eclipse.cdt.core.search.SearchEngine;
|
||||||
import org.eclipse.cdt.internal.core.CharOperation;
|
import org.eclipse.cdt.internal.core.CharOperation;
|
||||||
import org.eclipse.cdt.internal.core.search.AcceptMatchOperation;
|
import org.eclipse.cdt.internal.core.search.AcceptMatchOperation;
|
||||||
import org.eclipse.cdt.internal.core.search.matching.FieldDeclarationPattern;
|
import org.eclipse.cdt.internal.core.search.matching.FieldDeclarationPattern;
|
||||||
import org.eclipse.cdt.internal.core.search.matching.MatchLocator;
|
import org.eclipse.cdt.internal.core.search.matching.MatchLocator;
|
||||||
import org.eclipse.cdt.internal.core.search.matching.NamespaceDeclarationPattern;
|
import org.eclipse.cdt.internal.core.search.matching.NamespaceDeclarationPattern;
|
||||||
import org.eclipse.cdt.internal.core.search.matching.OrPattern;
|
|
||||||
import org.eclipse.cdt.testplugin.CTestPlugin;
|
import org.eclipse.cdt.testplugin.CTestPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
@ -327,7 +327,10 @@ public class OtherPatternTests extends BaseSearchTest {
|
||||||
|
|
||||||
ArrayList matchesList = new ArrayList();
|
ArrayList matchesList = new ArrayList();
|
||||||
MatchLocator matchLocator = new MatchLocator( pattern, resultCollector, scope, monitor );
|
MatchLocator matchLocator = new MatchLocator( pattern, resultCollector, scope, monitor );
|
||||||
matchLocator.locateMatches( new String [] { path }, workspace, null, matchesList);
|
try {
|
||||||
|
matchLocator.locateMatches( new String [] { path }, workspace, null, matchesList);
|
||||||
|
} catch (InterruptedException e1) {
|
||||||
|
}
|
||||||
|
|
||||||
AcceptMatchOperation acceptMatchOp = new AcceptMatchOperation(resultCollector, matchesList);
|
AcceptMatchOperation acceptMatchOp = new AcceptMatchOperation(resultCollector, matchesList);
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,280 +1,286 @@
|
||||||
2004-02-13 Bogdan Gheorghe
|
2004-02-16 Andrew Niefer
|
||||||
- Added error handling to MatchLocator.locateMatches to handle possible
|
fixed a couple of warnings
|
||||||
parser failures.
|
moved OrPattern from org.eclipse.cdt.internal.core.search.matching to org.eclipse.cdt.core.search
|
||||||
|
changed SearchEngine.search & MatchLocator.locateMatches to throw InterruptedException when cancelled
|
||||||
2004-02-06 Bogdan Gheorghe
|
updates calls to search to handle InterruptedException
|
||||||
|
|
||||||
- Modified CSearchPattern.scanforParameters. If no parameters are passed in
|
2004-02-13 Bogdan Gheorghe
|
||||||
as part of a function/method search, void is assigned as a parameter type.
|
- Added error handling to MatchLocator.locateMatches to handle possible
|
||||||
|
parser failures.
|
||||||
- Modified MethodDeclarationPattern to check for void parameter types
|
|
||||||
|
2004-02-06 Bogdan Gheorghe
|
||||||
2004-02-05 Alain Magloire
|
|
||||||
PR 51221
|
- Modified CSearchPattern.scanforParameters. If no parameters are passed in
|
||||||
Reformat Patch from Bogdan base on Thomas Fletcher original patch
|
as part of a function/method search, void is assigned as a parameter type.
|
||||||
In a nutshell, it moves the search operation into a runnable which
|
|
||||||
can be passed to a progress dialog.
|
- Modified MethodDeclarationPattern to check for void parameter types
|
||||||
|
|
||||||
* search/org/eclipse/cdt/core/search/BasicSearchResultCollector.java
|
2004-02-05 Alain Magloire
|
||||||
|
PR 51221
|
||||||
2004-01-26 John Camelon
|
Reformat Patch from Bogdan base on Thomas Fletcher original patch
|
||||||
Updated clients to use new Scanner logging service.
|
In a nutshell, it moves the search operation into a runnable which
|
||||||
|
can be passed to a progress dialog.
|
||||||
2003-10-23 Bogdan Gheorghe
|
|
||||||
|
* search/org/eclipse/cdt/core/search/BasicSearchResultCollector.java
|
||||||
- Added AcceptMatchOperation to get around Bug 45324. The search
|
|
||||||
operation is no longer a WorkspaceModifyOperation (which used to
|
2004-01-26 John Camelon
|
||||||
lock the workspace for the duration of search). Instead, we now
|
Updated clients to use new Scanner logging service.
|
||||||
lock the workspace only when we tag the resources with markers.
|
|
||||||
|
2003-10-23 Bogdan Gheorghe
|
||||||
- Modified SearchEngine : we now receive a list of matches
|
|
||||||
from the search that we pass into the AcceptMatchOperation.
|
- Added AcceptMatchOperation to get around Bug 45324. The search
|
||||||
|
operation is no longer a WorkspaceModifyOperation (which used to
|
||||||
- Modified MatchLocator to add matches to passed in list instead
|
lock the workspace for the duration of search). Instead, we now
|
||||||
of reporting them right away
|
lock the workspace only when we tag the resources with markers.
|
||||||
|
|
||||||
- Modified JobManager: -added in jobToIgnore parm to unblock dependency
|
- Modified SearchEngine : we now receive a list of matches
|
||||||
jobs
|
from the search that we pass into the AcceptMatchOperation.
|
||||||
|
|
||||||
|
- Modified MatchLocator to add matches to passed in list instead
|
||||||
2003-10-06 Bogdan Gheorghe
|
of reporting them right away
|
||||||
- added createCFileSearchScope() to SearchEngine.java to improve
|
|
||||||
code complete performance
|
- Modified JobManager: -added in jobToIgnore parm to unblock dependency
|
||||||
|
jobs
|
||||||
2003-10-01 Andrew Niefer
|
|
||||||
- fix bug 44026 by checking scope before reporting match in MatchLocator.report
|
|
||||||
|
2003-10-06 Bogdan Gheorghe
|
||||||
2003-10-01 Andrew Niefer
|
- added createCFileSearchScope() to SearchEngine.java to improve
|
||||||
- fix BasicSearchMatch.equals() for bug43988
|
code complete performance
|
||||||
|
|
||||||
2003-09-30 Bogdan Gheorghe
|
2003-10-01 Andrew Niefer
|
||||||
- changed logging in JobManager to use new ICLogConstants
|
- fix bug 44026 by checking scope before reporting match in MatchLocator.report
|
||||||
|
|
||||||
2003-09-30 Andrew Niefer
|
2003-10-01 Andrew Niefer
|
||||||
-fix bug43862 - Cannot find macro delcarations using all occurences.
|
- fix BasicSearchMatch.equals() for bug43988
|
||||||
* modified CSearchPattern.createMacroPattern
|
|
||||||
|
2003-09-30 Bogdan Gheorghe
|
||||||
2003-09-29 Andrew Niefer
|
- changed logging in JobManager to use new ICLogConstants
|
||||||
- fix bug 43062 outline is confused on operator methods containing spaces
|
|
||||||
- modify CSearchPattern.scanForNames to use same naming convention as TokenDuple.toString()
|
2003-09-30 Andrew Niefer
|
||||||
- modify MatchLocator.report to use IASTOffsetableNamedElement.getNameEndOffset()
|
-fix bug43862 - Cannot find macro delcarations using all occurences.
|
||||||
|
* modified CSearchPattern.createMacroPattern
|
||||||
2003-09-29 Andrew Niefer
|
|
||||||
-bug42911 - Search: cannot find beyond use of data member
|
2003-09-29 Andrew Niefer
|
||||||
- fix NPE's in BasicSearchMatch.equals & hashCode
|
- fix bug 43062 outline is confused on operator methods containing spaces
|
||||||
|
- modify CSearchPattern.scanForNames to use same naming convention as TokenDuple.toString()
|
||||||
2003-09-29 Andrew Niefer
|
- modify MatchLocator.report to use IASTOffsetableNamedElement.getNameEndOffset()
|
||||||
-fix NPE if IScannerInfoProvider returns null IScannerInfo
|
|
||||||
|
2003-09-29 Andrew Niefer
|
||||||
2003-09-25 Andrew Niefer
|
-bug42911 - Search: cannot find beyond use of data member
|
||||||
- bug43129 - Cannot search for definitions of global variables
|
- fix NPE's in BasicSearchMatch.equals & hashCode
|
||||||
- check definitions for variables, fields, enumerators and namespaces
|
|
||||||
- handle enter/exitLinkageSpecification
|
2003-09-29 Andrew Niefer
|
||||||
* search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java
|
-fix NPE if IScannerInfoProvider returns null IScannerInfo
|
||||||
* search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java
|
|
||||||
|
2003-09-25 Andrew Niefer
|
||||||
2003-09-25 Bogdan Gheorghe
|
- bug43129 - Cannot search for definitions of global variables
|
||||||
- added SearchFor INCLUDE in ICSearchConstants
|
- check definitions for variables, fields, enumerators and namespaces
|
||||||
- added acceptIncludeDeclaration to IIndexSearchRequestor
|
- handle enter/exitLinkageSpecification
|
||||||
- modified PathCollector to acceptIncludeDeclarations
|
* search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java
|
||||||
- modified CSearchPattern to create an IncludePattern
|
* search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java
|
||||||
- added IncludePattern.java
|
|
||||||
|
2003-09-25 Bogdan Gheorghe
|
||||||
2003-09-25 Andrew Niefer
|
- added SearchFor INCLUDE in ICSearchConstants
|
||||||
- partial fix for 43664 Modify Matchlocator to not try and create a link if we have no
|
- added acceptIncludeDeclaration to IIndexSearchRequestor
|
||||||
resource, instead just use the path
|
- modified PathCollector to acceptIncludeDeclarations
|
||||||
|
- modified CSearchPattern to create an IncludePattern
|
||||||
2003-09-23 Andrew Niefer
|
- added IncludePattern.java
|
||||||
fix bug 43498 Search with ? fails on first letter of second word
|
|
||||||
-modifications to CSearchPattern.scanForNames()
|
2003-09-25 Andrew Niefer
|
||||||
-add getSimpleName to MethodDeclarationPattern
|
- partial fix for 43664 Modify Matchlocator to not try and create a link if we have no
|
||||||
|
resource, instead just use the path
|
||||||
2003-09-19 Andrew Niefer
|
|
||||||
fix bug 43327 Code Complete finds local variables
|
2003-09-23 Andrew Niefer
|
||||||
- modified MatchLocator to not report local declarations when boolean is set
|
fix bug 43498 Search with ? fails on first letter of second word
|
||||||
- modified SearchEngine.search to take an additional parameter "excludeLocalDeclarations"
|
-modifications to CSearchPattern.scanForNames()
|
||||||
|
-add getSimpleName to MethodDeclarationPattern
|
||||||
2003-09-15 Andrew Niefer
|
|
||||||
- modify CSearchPattern to handle escaping wildcards (bug43063)
|
2003-09-19 Andrew Niefer
|
||||||
- modify enterFunctionBody and enterMethodBody to fix bug42979
|
fix bug 43327 Code Complete finds local variables
|
||||||
- search for Parameter References
|
- modified MatchLocator to not report local declarations when boolean is set
|
||||||
|
- modified SearchEngine.search to take an additional parameter "excludeLocalDeclarations"
|
||||||
2003-09-13 Andrew Niefer
|
|
||||||
-Searching for Typedefs: (bug42902)
|
2003-09-15 Andrew Niefer
|
||||||
- modified setElementInfo in BasicSearchResultCollector
|
- modify CSearchPattern to handle escaping wildcards (bug43063)
|
||||||
- added TYPEDEF to ICSearchConstants
|
- modify enterFunctionBody and enterMethodBody to fix bug42979
|
||||||
- modified CSearchPattern & ClassDeclarationPattern
|
- search for Parameter References
|
||||||
- implemented acceptTypedef* in MatchLocator
|
|
||||||
- modified BasicSearchMatch to implement Comparable
|
2003-09-13 Andrew Niefer
|
||||||
|
-Searching for Typedefs: (bug42902)
|
||||||
2003-09-11 Andrew Niefer
|
- modified setElementInfo in BasicSearchResultCollector
|
||||||
- Modified ICSearchResultCollector.createMatch to not take a parent parameter
|
- added TYPEDEF to ICSearchConstants
|
||||||
- modified BasicSearchResultCollector to create the parent string from the fully qualified name of the node
|
- modified CSearchPattern & ClassDeclarationPattern
|
||||||
- modified MatchLocator to keep track of most recent declaration for reporting purposes
|
- implemented acceptTypedef* in MatchLocator
|
||||||
- modified MatchLocator.report to use the most recent declaration
|
- modified BasicSearchMatch to implement Comparable
|
||||||
|
|
||||||
2003-09-09 Andrew Niefer
|
2003-09-11 Andrew Niefer
|
||||||
pattern matching on function parameters:
|
- Modified ICSearchResultCollector.createMatch to not take a parent parameter
|
||||||
- modified scanForParameters in CSearchPattern
|
- modified BasicSearchResultCollector to create the parent string from the fully qualified name of the node
|
||||||
- added getParamString in CSearchPattern
|
- modified MatchLocator to keep track of most recent declaration for reporting purposes
|
||||||
- modified matchLevel in MethodDeclarationPattern
|
- modified MatchLocator.report to use the most recent declaration
|
||||||
|
|
||||||
Enumeration references
|
2003-09-09 Andrew Niefer
|
||||||
- modified acceptEnumeratorReference in MatchLocator
|
pattern matching on function parameters:
|
||||||
|
- modified scanForParameters in CSearchPattern
|
||||||
2003-09-05 Andrew Niefer
|
- added getParamString in CSearchPattern
|
||||||
- fix searching for enumerators
|
- modified matchLevel in MethodDeclarationPattern
|
||||||
|
|
||||||
2003-09-03 Andrew Niefer
|
Enumeration references
|
||||||
- added CLASS_STRUCT to the SearchFor constants
|
- modified acceptEnumeratorReference in MatchLocator
|
||||||
- Modified CSearchPattern to handle CLASS_STRUCT
|
|
||||||
|
2003-09-05 Andrew Niefer
|
||||||
2003-08-26 Bogdan Gheorghe
|
- fix searching for enumerators
|
||||||
- Added debug tracing statements to SearchEngine
|
|
||||||
- Modified scanForNames in CSearchPattern to treat append
|
2003-09-03 Andrew Niefer
|
||||||
a token after "~" to allow for destructors search
|
- added CLASS_STRUCT to the SearchFor constants
|
||||||
- Added scope checking to MatchLocator
|
- Modified CSearchPattern to handle CLASS_STRUCT
|
||||||
- Added debug trace statements to MatchLocator
|
|
||||||
|
2003-08-26 Bogdan Gheorghe
|
||||||
2003-08-20 Bogdan Gheorghe
|
- Added debug tracing statements to SearchEngine
|
||||||
- Changed matching and reporting functions to handle nodes
|
- Modified scanForNames in CSearchPattern to treat append
|
||||||
of type IElaboratedTypeSpecifier
|
a token after "~" to allow for destructors search
|
||||||
|
- Added scope checking to MatchLocator
|
||||||
2003-08-12 Bogdan Gheorghe
|
- Added debug trace statements to MatchLocator
|
||||||
- Rolled field and variable search patterns into one pattern, in
|
|
||||||
order to allow for qualified var searches
|
2003-08-20 Bogdan Gheorghe
|
||||||
|
- Changed matching and reporting functions to handle nodes
|
||||||
2003-08-11 Andrew Niefer
|
of type IElaboratedTypeSpecifier
|
||||||
- Added Macro ICSearchConstant
|
|
||||||
- Added acceptMacro to IIndexSearchRequestor and PathCollector
|
2003-08-12 Bogdan Gheorghe
|
||||||
- Added MacroDeclaration Pattern
|
- Rolled field and variable search patterns into one pattern, in
|
||||||
- Rolled method and function patterns into one method pattern
|
order to allow for qualified var searches
|
||||||
- Added WorkingCopy support to search
|
|
||||||
|
2003-08-11 Andrew Niefer
|
||||||
2003-08-08 Bogdan Gheorghe
|
- Added Macro ICSearchConstant
|
||||||
- Added CreateSearchScope to create a search scope out of
|
- Added acceptMacro to IIndexSearchRequestor and PathCollector
|
||||||
CElements
|
- Added MacroDeclaration Pattern
|
||||||
- Filled out CSearchScope to enable:
|
- Rolled method and function patterns into one method pattern
|
||||||
- adding a project to scope, include referenced projects
|
- Added WorkingCopy support to search
|
||||||
- adding individual CElements to scope
|
|
||||||
|
2003-08-08 Bogdan Gheorghe
|
||||||
2003-08-08 Andrew Niefer
|
- Added CreateSearchScope to create a search scope out of
|
||||||
- add function parameter information to search results
|
CElements
|
||||||
|
- Filled out CSearchScope to enable:
|
||||||
2003-08-06 Andrew Niefer
|
- adding a project to scope, include referenced projects
|
||||||
- Create OrPattern which matches for search if any of its constituent patterns matches
|
- adding individual CElements to scope
|
||||||
- modified MatchLocator to support the OrPattern
|
|
||||||
- searching for All occurences now uses the OrPattern
|
2003-08-08 Andrew Niefer
|
||||||
|
- add function parameter information to search results
|
||||||
2003-08-01 Andrew Niefer
|
|
||||||
- Modified BasicSearchResultCollector to only accept matches it has not already seen
|
2003-08-06 Andrew Niefer
|
||||||
- fixed bug in finding a resource when entering includes
|
- Create OrPattern which matches for search if any of its constituent patterns matches
|
||||||
|
- modified MatchLocator to support the OrPattern
|
||||||
2003-07-29 Andrew Niefer
|
- searching for All occurences now uses the OrPattern
|
||||||
Refactoring Search result collection:
|
|
||||||
- Modified ICSearchResultCollector
|
2003-08-01 Andrew Niefer
|
||||||
- Modified IMatch
|
- Modified BasicSearchResultCollector to only accept matches it has not already seen
|
||||||
- Modified MatchLocator to reflect changes in ICSearchResultCollector
|
- fixed bug in finding a resource when entering includes
|
||||||
- Created BasicSearchMatch implements IMatch
|
|
||||||
- Created BasicSearchResultCollector implements ICSearchResultCollector
|
2003-07-29 Andrew Niefer
|
||||||
|
Refactoring Search result collection:
|
||||||
2003-07-28 Andrew Niefer
|
- Modified ICSearchResultCollector
|
||||||
- added abstract CSearchPattern.resetIndexInfo fix bug with searching with globally
|
- Modified IMatch
|
||||||
qualified names
|
- Modified MatchLocator to reflect changes in ICSearchResultCollector
|
||||||
- fixed bug in CSearchPattern.matchQualifications to do with globally qualified names
|
- Created BasicSearchMatch implements IMatch
|
||||||
- fixed bug in CSearchPattern.createFunctionPattern to do with parameter lists.
|
- Created BasicSearchResultCollector implements ICSearchResultCollector
|
||||||
|
|
||||||
2003-07-25 Bogdan Gheorghe
|
2003-07-28 Andrew Niefer
|
||||||
- Added refs to PathCollector
|
- added abstract CSearchPattern.resetIndexInfo fix bug with searching with globally
|
||||||
- Filled in feedIndexRequestor for the new search patterns
|
qualified names
|
||||||
- Fixed the FunctionDeclarationPattern to work with no parms
|
- fixed bug in CSearchPattern.matchQualifications to do with globally qualified names
|
||||||
|
- fixed bug in CSearchPattern.createFunctionPattern to do with parameter lists.
|
||||||
2003-07-24 Andrew Niefer
|
|
||||||
- Implemented decodeIndexEntry & matchIndexEntry for all patterns
|
2003-07-25 Bogdan Gheorghe
|
||||||
- changed MatchLocator to use a COMPLETE_PARSE.
|
- Added refs to PathCollector
|
||||||
|
- Filled in feedIndexRequestor for the new search patterns
|
||||||
2003-07-23 Andrew Niefer
|
- Fixed the FunctionDeclarationPattern to work with no parms
|
||||||
-Changed ICSearchPattern.matchLevel to take a ISourceElementCallbackDelegate
|
|
||||||
-Changed ICSearchResultCollector.createMatch to take a ISourceElementCallbackDelegate
|
2003-07-24 Andrew Niefer
|
||||||
-first implementations of:
|
- Implemented decodeIndexEntry & matchIndexEntry for all patterns
|
||||||
-CSearchPattern.createFunctionPattern
|
- changed MatchLocator to use a COMPLETE_PARSE.
|
||||||
-CSearchPattern.createVariablePattern
|
|
||||||
-CSearchPattern.createMethodPattern
|
2003-07-23 Andrew Niefer
|
||||||
-preliminary matching for remaining patterns
|
-Changed ICSearchPattern.matchLevel to take a ISourceElementCallbackDelegate
|
||||||
-handling of remaining parser callbacks
|
-Changed ICSearchResultCollector.createMatch to take a ISourceElementCallbackDelegate
|
||||||
-generating index Prefixes for the patterns
|
-first implementations of:
|
||||||
|
-CSearchPattern.createFunctionPattern
|
||||||
2003-07-14 Andrew Niefer
|
-CSearchPattern.createVariablePattern
|
||||||
-Modified SearchFor instances in ICSearchConstants to more closely match what we are searching for
|
-CSearchPattern.createMethodPattern
|
||||||
-added IMatch interface, it represents matches found by the search engine, implementors can store
|
-preliminary matching for remaining patterns
|
||||||
whatever information they like, see ICSearchResultCollector::createMatch
|
-handling of remaining parser callbacks
|
||||||
-added createMatch to the ICSearchResultCollector interface, the result collector is responsible for
|
-generating index Prefixes for the patterns
|
||||||
implementing IMatch to store whatever data they want out of the AST nodes.
|
|
||||||
-added skeleton patterns:
|
2003-07-14 Andrew Niefer
|
||||||
search/org/eclipse/cdt/internal/core/search/matching/FieldDeclarationPattern.java
|
-Modified SearchFor instances in ICSearchConstants to more closely match what we are searching for
|
||||||
search/org/eclipse/cdt/internal/core/search/matching/FunctionDeclarationPattern.java
|
-added IMatch interface, it represents matches found by the search engine, implementors can store
|
||||||
search/org/eclipse/cdt/internal/core/search/matching/MethodDeclarationPattern.java
|
whatever information they like, see ICSearchResultCollector::createMatch
|
||||||
search/org/eclipse/cdt/internal/core/search/matching/NamespaceDeclarationPattern.java
|
-added createMatch to the ICSearchResultCollector interface, the result collector is responsible for
|
||||||
search/org/eclipse/cdt/internal/core/search/matching/VariableDeclarationPattern.java
|
implementing IMatch to store whatever data they want out of the AST nodes.
|
||||||
-added beginnings of CSearchPattern::create*Pattern functions
|
-added skeleton patterns:
|
||||||
-modifications to MatchLocator to keep track of current scope
|
search/org/eclipse/cdt/internal/core/search/matching/FieldDeclarationPattern.java
|
||||||
-added CSearchPattern::matchQualifications
|
search/org/eclipse/cdt/internal/core/search/matching/FunctionDeclarationPattern.java
|
||||||
|
search/org/eclipse/cdt/internal/core/search/matching/MethodDeclarationPattern.java
|
||||||
2003-07-10 Bogdan Gheorghe
|
search/org/eclipse/cdt/internal/core/search/matching/NamespaceDeclarationPattern.java
|
||||||
Provided implementation for ICSearchScope.java, CSearchScope.java
|
search/org/eclipse/cdt/internal/core/search/matching/VariableDeclarationPattern.java
|
||||||
|
-added beginnings of CSearchPattern::create*Pattern functions
|
||||||
Hooked up new CWorkspaceScope, PathCollector, PatternSearchJob in SearchEngine.java
|
-modifications to MatchLocator to keep track of current scope
|
||||||
|
-added CSearchPattern::matchQualifications
|
||||||
Provided implementation for PatternSearchJob.java - PatternSearchJob is where the first part
|
|
||||||
of the search occurs - using an IndexSelector to filter the indexes, it gets the indexes from
|
2003-07-10 Bogdan Gheorghe
|
||||||
the IndexManager and then uses the passed in pattern to find the index matched. Once it finds
|
Provided implementation for ICSearchScope.java, CSearchScope.java
|
||||||
an index match it adds the file path to the PathCollector.
|
|
||||||
|
Hooked up new CWorkspaceScope, PathCollector, PatternSearchJob in SearchEngine.java
|
||||||
Modified CSearchPattern - added support to find index entries.
|
|
||||||
|
Provided implementation for PatternSearchJob.java - PatternSearchJob is where the first part
|
||||||
Modified ClassDeclarationPattern - added support to decode, match and report
|
of the search occurs - using an IndexSelector to filter the indexes, it gets the indexes from
|
||||||
index entries.
|
the IndexManager and then uses the passed in pattern to find the index matched. Once it finds
|
||||||
|
an index match it adds the file path to the PathCollector.
|
||||||
|
|
||||||
Added:
|
Modified CSearchPattern - added support to find index entries.
|
||||||
* search/org/eclipse/cdt/internal/core/search/CWorkspaceScope.java
|
|
||||||
* search/org/eclipse/cdt/internal/core/search/IIndexSearchRequestor.java
|
Modified ClassDeclarationPattern - added support to decode, match and report
|
||||||
* search/org/eclipse/cdt/internal/core/search/IndexSelector.java
|
index entries.
|
||||||
* search/org/eclipse/cdt/internal/core/search/PathCollector.java
|
|
||||||
|
|
||||||
Modified:
|
Added:
|
||||||
* search/org/eclipse/cdt/core/search/ICSearchScope.java
|
* search/org/eclipse/cdt/internal/core/search/CWorkspaceScope.java
|
||||||
* search/org/eclipse/cdt/core/search/SearchEngine.java
|
* search/org/eclipse/cdt/internal/core/search/IIndexSearchRequestor.java
|
||||||
* search/org/eclipse/cdt/internal/core/search/CSearchScope.java
|
* search/org/eclipse/cdt/internal/core/search/IndexSelector.java
|
||||||
* search/org/eclipse/cdt/internal/core/search/PatternSearchJob.java
|
* search/org/eclipse/cdt/internal/core/search/PathCollector.java
|
||||||
* search/org/eclipse/cdt/internal/core/search/matching/ClassDeclarationPattern.java
|
|
||||||
* search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java
|
Modified:
|
||||||
|
* search/org/eclipse/cdt/core/search/ICSearchScope.java
|
||||||
2003-07-04 Andrew Niefer
|
* search/org/eclipse/cdt/core/search/SearchEngine.java
|
||||||
Modified ICSearchConstants to use new nested classes SearchFor and LimitTo instead of int
|
* search/org/eclipse/cdt/internal/core/search/CSearchScope.java
|
||||||
for stronger type safety
|
* search/org/eclipse/cdt/internal/core/search/PatternSearchJob.java
|
||||||
|
* search/org/eclipse/cdt/internal/core/search/matching/ClassDeclarationPattern.java
|
||||||
Updated MatchLocator to invoke parser to do actual search.
|
* search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java
|
||||||
|
|
||||||
2003-06-27 Andrew Niefer
|
2003-07-04 Andrew Niefer
|
||||||
Modified:
|
Modified ICSearchConstants to use new nested classes SearchFor and LimitTo instead of int
|
||||||
search/org.eclipse.cdt.core.search.matching/MatchLocator.java
|
for stronger type safety
|
||||||
- enter/exitInclusion
|
|
||||||
- enterClassSpecifier
|
Updated MatchLocator to invoke parser to do actual search.
|
||||||
search/org.eclipse.cdt.core.search.matching/CSearchPattern.java
|
|
||||||
- createClassPattern
|
2003-06-27 Andrew Niefer
|
||||||
- matchesName
|
Modified:
|
||||||
search/org.eclipse.cdt.core.search.matching/ClassDeclarationPattern.java
|
search/org.eclipse.cdt.core.search.matching/MatchLocator.java
|
||||||
- matchLevel
|
- enter/exitInclusion
|
||||||
search/org.eclipse.cdt.core.search/ICSearchPattern.java
|
- enterClassSpecifier
|
||||||
search/org.eclipse.cdt.core.search/ICSearchResultCollector.java
|
search/org.eclipse.cdt.core.search.matching/CSearchPattern.java
|
||||||
search/org.eclipse.cdt.core.search/SearchEngine.java
|
- createClassPattern
|
||||||
|
- matchesName
|
||||||
2003-06-25 Bogdan Gheorghe
|
search/org.eclipse.cdt.core.search.matching/ClassDeclarationPattern.java
|
||||||
Modified:
|
- matchLevel
|
||||||
* search/org/eclipse/cdt/core/search/ICSearchConstants.java
|
search/org.eclipse.cdt.core.search/ICSearchPattern.java
|
||||||
* search/org/eclipse/cdt/internal/core/search/Utils.java
|
search/org.eclipse.cdt.core.search/ICSearchResultCollector.java
|
||||||
- moved to index/org/eclipse/cdt/internal/core/search/Utils.java
|
search/org.eclipse.cdt.core.search/SearchEngine.java
|
||||||
* search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java
|
|
||||||
* search/org/eclipse/cdt/internal/core/search/processing/IJob.java
|
2003-06-25 Bogdan Gheorghe
|
||||||
|
Modified:
|
||||||
|
* search/org/eclipse/cdt/core/search/ICSearchConstants.java
|
||||||
|
* search/org/eclipse/cdt/internal/core/search/Utils.java
|
||||||
|
- moved to index/org/eclipse/cdt/internal/core/search/Utils.java
|
||||||
|
* search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java
|
||||||
|
* search/org/eclipse/cdt/internal/core/search/processing/IJob.java
|
||||||
* search/org/eclipse/cdt/internal/core/search/processing/JobManager.java
|
* search/org/eclipse/cdt/internal/core/search/processing/JobManager.java
|
|
@ -59,8 +59,6 @@ public class BasicSearchMatch implements IMatch, Comparable {
|
||||||
}
|
}
|
||||||
BasicSearchMatch match = (BasicSearchMatch)obj;
|
BasicSearchMatch match = (BasicSearchMatch)obj;
|
||||||
|
|
||||||
IPath path = getLocation();
|
|
||||||
|
|
||||||
if( startOffset != match.getStartOffset() || endOffset != match.getEndOffset() )
|
if( startOffset != match.getStartOffset() || endOffset != match.getEndOffset() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -11,18 +11,17 @@
|
||||||
/*
|
/*
|
||||||
* Created on Aug 6, 2003
|
* Created on Aug 6, 2003
|
||||||
*/
|
*/
|
||||||
package org.eclipse.cdt.internal.core.search.matching;
|
package org.eclipse.cdt.core.search;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
|
import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
|
||||||
import org.eclipse.cdt.core.search.ICSearchPattern;
|
|
||||||
import org.eclipse.cdt.core.search.ICSearchScope;
|
|
||||||
import org.eclipse.cdt.internal.core.index.IEntryResult;
|
import org.eclipse.cdt.internal.core.index.IEntryResult;
|
||||||
import org.eclipse.cdt.internal.core.index.impl.IndexInput;
|
import org.eclipse.cdt.internal.core.index.impl.IndexInput;
|
||||||
import org.eclipse.cdt.internal.core.search.IIndexSearchRequestor;
|
import org.eclipse.cdt.internal.core.search.IIndexSearchRequestor;
|
||||||
|
import org.eclipse.cdt.internal.core.search.matching.CSearchPattern;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ import org.eclipse.core.resources.IWorkspace;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.OperationCanceledException;
|
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||||
|
|
||||||
|
@ -109,7 +108,6 @@ public class SearchEngine implements ICSearchConstants{
|
||||||
*/
|
*/
|
||||||
public static ICSearchScope createCFileSearchScope(IFile sourceFile, ArrayList elements) {
|
public static ICSearchScope createCFileSearchScope(IFile sourceFile, ArrayList elements) {
|
||||||
CSearchScope scope = new CSearchScope();
|
CSearchScope scope = new CSearchScope();
|
||||||
HashSet visitedProjects = new HashSet(2);
|
|
||||||
|
|
||||||
if (sourceFile != null){
|
if (sourceFile != null){
|
||||||
//Add the source file and project
|
//Add the source file and project
|
||||||
|
@ -155,7 +153,7 @@ public class SearchEngine implements ICSearchConstants{
|
||||||
* @param _scope
|
* @param _scope
|
||||||
* @param _collector
|
* @param _collector
|
||||||
*/
|
*/
|
||||||
public void search(IWorkspace workspace, ICSearchPattern pattern, ICSearchScope scope, ICSearchResultCollector collector, boolean excludeLocalDeclarations) {
|
public void search(IWorkspace workspace, ICSearchPattern pattern, ICSearchScope scope, ICSearchResultCollector collector, boolean excludeLocalDeclarations) throws InterruptedException {
|
||||||
if( VERBOSE ) {
|
if( VERBOSE ) {
|
||||||
System.out.println("Searching for " + pattern + " in " + scope); //$NON-NLS-1$//$NON-NLS-2$
|
System.out.println("Searching for " + pattern + " in " + scope); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
@ -199,7 +197,7 @@ public class SearchEngine implements ICSearchConstants{
|
||||||
matchLocator.setShouldExcludeLocalDeclarations( excludeLocalDeclarations );
|
matchLocator.setShouldExcludeLocalDeclarations( excludeLocalDeclarations );
|
||||||
|
|
||||||
if( progressMonitor != null && progressMonitor.isCanceled() )
|
if( progressMonitor != null && progressMonitor.isCanceled() )
|
||||||
throw new OperationCanceledException();
|
throw new InterruptedException();
|
||||||
|
|
||||||
//TODO: BOG Filter Working Copies...
|
//TODO: BOG Filter Working Copies...
|
||||||
matchLocator.locateMatches( pathCollector.getPaths(), workspace, this.workingCopies, matches);
|
matchLocator.locateMatches( pathCollector.getPaths(), workspace, this.workingCopies, matches);
|
||||||
|
|
|
@ -45,6 +45,7 @@ import org.eclipse.cdt.core.parser.ast.IASTFunction;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
|
import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
|
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
|
import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
|
||||||
|
import org.eclipse.cdt.core.search.*;
|
||||||
import org.eclipse.cdt.core.search.ICSearchConstants;
|
import org.eclipse.cdt.core.search.ICSearchConstants;
|
||||||
import org.eclipse.cdt.core.search.ICSearchPattern;
|
import org.eclipse.cdt.core.search.ICSearchPattern;
|
||||||
import org.eclipse.cdt.core.search.ICSearchScope;
|
import org.eclipse.cdt.core.search.ICSearchScope;
|
||||||
|
|
|
@ -189,7 +189,6 @@ public class FieldDeclarationPattern extends CSearchPattern {
|
||||||
private char [][] decodedQualifications;
|
private char [][] decodedQualifications;
|
||||||
private char [] simpleName;
|
private char [] simpleName;
|
||||||
private char [] decodedSimpleName;
|
private char [] decodedSimpleName;
|
||||||
private char decodedType;
|
|
||||||
|
|
||||||
private SearchFor searchFor;
|
private SearchFor searchFor;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,6 @@ public class IncludePattern extends CSearchPattern {
|
||||||
*/
|
*/
|
||||||
protected void decodeIndexEntry(IEntryResult entryResult) {
|
protected void decodeIndexEntry(IEntryResult entryResult) {
|
||||||
char[] word = entryResult.getWord();
|
char[] word = entryResult.getWord();
|
||||||
int size = word.length;
|
|
||||||
|
|
||||||
int firstSlash = CharOperation.indexOf( SEPARATOR, word, 0 );
|
int firstSlash = CharOperation.indexOf( SEPARATOR, word, 0 );
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,6 @@ public class MacroDeclarationPattern extends CSearchPattern {
|
||||||
*/
|
*/
|
||||||
protected void decodeIndexEntry(IEntryResult entryResult) {
|
protected void decodeIndexEntry(IEntryResult entryResult) {
|
||||||
char[] word = entryResult.getWord();
|
char[] word = entryResult.getWord();
|
||||||
int size = word.length;
|
|
||||||
|
|
||||||
int firstSlash = CharOperation.indexOf( SEPARATOR, word, 0 );
|
int firstSlash = CharOperation.indexOf( SEPARATOR, word, 0 );
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,6 @@ import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.OperationCanceledException;
|
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
|
||||||
|
|
||||||
|
@ -335,7 +334,7 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void locateMatches( String [] paths, IWorkspace workspace, IWorkingCopy[] workingCopies,ArrayList matches ){
|
public void locateMatches( String [] paths, IWorkspace workspace, IWorkingCopy[] workingCopies,ArrayList matches ) throws InterruptedException{
|
||||||
matchStorage = matches;
|
matchStorage = matches;
|
||||||
workspaceRoot = (workspace != null) ? workspace.getRoot() : null;
|
workspaceRoot = (workspace != null) ? workspace.getRoot() : null;
|
||||||
|
|
||||||
|
@ -368,7 +367,7 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants
|
||||||
for( int i = 0; i < length; i++ ){
|
for( int i = 0; i < length; i++ ){
|
||||||
if( progressMonitor != null ) {
|
if( progressMonitor != null ) {
|
||||||
if( progressMonitor.isCanceled() ){
|
if( progressMonitor.isCanceled() ){
|
||||||
throw new OperationCanceledException();
|
throw new InterruptedException();
|
||||||
} else {
|
} else {
|
||||||
progressMonitor.worked( 1 );
|
progressMonitor.worked( 1 );
|
||||||
}
|
}
|
||||||
|
@ -482,7 +481,7 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants
|
||||||
if( node instanceof IASTReference ){
|
if( node instanceof IASTReference ){
|
||||||
IASTReference reference = (IASTReference) node;
|
IASTReference reference = (IASTReference) node;
|
||||||
offset = reference.getOffset();
|
offset = reference.getOffset();
|
||||||
end = offset + reference.getName().length();;
|
end = offset + reference.getName().length();
|
||||||
if (VERBOSE)
|
if (VERBOSE)
|
||||||
MatchLocator.verbose("Report Match: " + reference.getName());
|
MatchLocator.verbose("Report Match: " + reference.getName());
|
||||||
} else if( node instanceof IASTOffsetableNamedElement ){
|
} else if( node instanceof IASTOffsetableNamedElement ){
|
||||||
|
@ -491,7 +490,7 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants
|
||||||
: offsetableElement.getStartingOffset();
|
: offsetableElement.getStartingOffset();
|
||||||
end = offsetableElement.getNameEndOffset();
|
end = offsetableElement.getNameEndOffset();
|
||||||
if( end == 0 ){
|
if( end == 0 ){
|
||||||
end = offset + offsetableElement.getName().length();;
|
end = offset + offsetableElement.getName().length();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VERBOSE)
|
if (VERBOSE)
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
2004-02-13 Andrew Niefer
|
||||||
|
Updated calls to search to handle InterruptedException
|
||||||
|
|
||||||
2004-02-16 Alain Magloire
|
2004-02-16 Alain Magloire
|
||||||
|
|
||||||
Use ITextEditor instead of CEditor.
|
Use ITextEditor instead of CEditor.
|
||||||
|
|
|
@ -16,8 +16,8 @@ import org.eclipse.cdt.core.search.BasicSearchResultCollector;
|
||||||
import org.eclipse.cdt.core.search.ICSearchConstants;
|
import org.eclipse.cdt.core.search.ICSearchConstants;
|
||||||
import org.eclipse.cdt.core.search.ICSearchScope;
|
import org.eclipse.cdt.core.search.ICSearchScope;
|
||||||
import org.eclipse.cdt.core.search.IMatch;
|
import org.eclipse.cdt.core.search.IMatch;
|
||||||
|
import org.eclipse.cdt.core.search.OrPattern;
|
||||||
import org.eclipse.cdt.core.search.SearchEngine;
|
import org.eclipse.cdt.core.search.SearchEngine;
|
||||||
import org.eclipse.cdt.internal.core.search.matching.OrPattern;
|
|
||||||
import org.eclipse.cdt.internal.ui.dialogs.ElementListSelectionDialog;
|
import org.eclipse.cdt.internal.ui.dialogs.ElementListSelectionDialog;
|
||||||
import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
||||||
import org.eclipse.cdt.ui.CSearchResultLabelProvider;
|
import org.eclipse.cdt.ui.CSearchResultLabelProvider;
|
||||||
|
@ -124,55 +124,59 @@ public class OpenDeclarationsAction extends Action implements IUpdate {
|
||||||
* @see IAction#actionPerformed
|
* @see IAction#actionPerformed
|
||||||
*/
|
*/
|
||||||
public void run() {
|
public void run() {
|
||||||
final String selectedText = getSelectedStringFromEditor();
|
final String selectedText = getSelectedStringFromEditor();
|
||||||
|
|
||||||
|
if(selectedText == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final ArrayList elementsFound = new ArrayList();
|
||||||
|
|
||||||
if(selectedText == null) {
|
IRunnableWithProgress runnable = new IRunnableWithProgress()
|
||||||
return;
|
{
|
||||||
}
|
public void run(IProgressMonitor monitor) {
|
||||||
|
BasicSearchResultCollector resultCollector = new BasicSearchResultCollector(monitor);
|
||||||
final ArrayList elementsFound = new ArrayList();
|
IWorkingCopyManager fManager = CUIPlugin.getDefault().getWorkingCopyManager();
|
||||||
|
ITranslationUnit unit = fManager.getWorkingCopy(fEditor.getEditorInput());
|
||||||
IRunnableWithProgress runnable = new IRunnableWithProgress() {
|
|
||||||
public void run(IProgressMonitor monitor) {
|
|
||||||
BasicSearchResultCollector resultCollector = new BasicSearchResultCollector(monitor);
|
|
||||||
IWorkingCopyManager fManager = CUIPlugin.getDefault().getWorkingCopyManager();
|
|
||||||
ITranslationUnit unit = fManager.getWorkingCopy(fEditor.getEditorInput());
|
|
||||||
|
|
||||||
ICElement[] projectScopeElement = new ICElement[1];
|
ICElement[] projectScopeElement = new ICElement[1];
|
||||||
projectScopeElement[0] = unit.getCProject();//(ICElement)currentScope.getCProject();
|
projectScopeElement[0] = unit.getCProject();//(ICElement)currentScope.getCProject();
|
||||||
ICSearchScope scope = SearchEngine.createCSearchScope(projectScopeElement, true);
|
ICSearchScope scope = SearchEngine.createCSearchScope(projectScopeElement, true);
|
||||||
OrPattern orPattern = new OrPattern();
|
OrPattern orPattern = new OrPattern();
|
||||||
// search for global variables, functions, classes, structs, unions, enums and macros
|
// search for global variables, functions, classes, structs, unions, enums and macros
|
||||||
orPattern.addPattern(SearchEngine.createSearchPattern( selectedText, ICSearchConstants.VAR, ICSearchConstants.DECLARATIONS, true ));
|
orPattern.addPattern(SearchEngine.createSearchPattern( selectedText, ICSearchConstants.VAR, ICSearchConstants.DECLARATIONS, true ));
|
||||||
orPattern.addPattern(SearchEngine.createSearchPattern( selectedText, ICSearchConstants.FUNCTION, ICSearchConstants.DECLARATIONS, true ));
|
orPattern.addPattern(SearchEngine.createSearchPattern( selectedText, ICSearchConstants.FUNCTION, ICSearchConstants.DECLARATIONS, true ));
|
||||||
orPattern.addPattern(SearchEngine.createSearchPattern( selectedText, ICSearchConstants.METHOD, ICSearchConstants.DECLARATIONS, true ));
|
orPattern.addPattern(SearchEngine.createSearchPattern( selectedText, ICSearchConstants.METHOD, ICSearchConstants.DECLARATIONS, true ));
|
||||||
orPattern.addPattern(SearchEngine.createSearchPattern( selectedText, ICSearchConstants.TYPE, ICSearchConstants.DECLARATIONS, true ));
|
orPattern.addPattern(SearchEngine.createSearchPattern( selectedText, ICSearchConstants.TYPE, ICSearchConstants.DECLARATIONS, true ));
|
||||||
orPattern.addPattern(SearchEngine.createSearchPattern( selectedText, ICSearchConstants.ENUM, ICSearchConstants.DECLARATIONS, true ));
|
orPattern.addPattern(SearchEngine.createSearchPattern( selectedText, ICSearchConstants.ENUM, ICSearchConstants.DECLARATIONS, true ));
|
||||||
orPattern.addPattern(SearchEngine.createSearchPattern( selectedText, ICSearchConstants.FIELD, ICSearchConstants.DECLARATIONS, true ));
|
orPattern.addPattern(SearchEngine.createSearchPattern( selectedText, ICSearchConstants.FIELD, ICSearchConstants.DECLARATIONS, true ));
|
||||||
orPattern.addPattern(SearchEngine.createSearchPattern( selectedText, ICSearchConstants.NAMESPACE, ICSearchConstants.DECLARATIONS, true ));
|
orPattern.addPattern(SearchEngine.createSearchPattern( selectedText, ICSearchConstants.NAMESPACE, ICSearchConstants.DECLARATIONS, true ));
|
||||||
orPattern.addPattern(SearchEngine.createSearchPattern( selectedText, ICSearchConstants.MACRO, ICSearchConstants.DECLARATIONS, true ));
|
orPattern.addPattern(SearchEngine.createSearchPattern( selectedText, ICSearchConstants.MACRO, ICSearchConstants.DECLARATIONS, true ));
|
||||||
orPattern.addPattern(SearchEngine.createSearchPattern( selectedText, ICSearchConstants.TYPEDEF, ICSearchConstants.DECLARATIONS, true ));
|
orPattern.addPattern(SearchEngine.createSearchPattern( selectedText, ICSearchConstants.TYPEDEF, ICSearchConstants.DECLARATIONS, true ));
|
||||||
searchEngine.search(CUIPlugin.getWorkspace(), orPattern, scope, resultCollector, true);
|
try {
|
||||||
elementsFound.addAll(resultCollector.getSearchResults());
|
searchEngine.search(CUIPlugin.getWorkspace(), orPattern, scope, resultCollector, true);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
}
|
||||||
|
elementsFound.addAll(resultCollector.getSearchResults());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ProgressMonitorDialog progressMonitor = new ProgressMonitorDialog(getShell());
|
ProgressMonitorDialog progressMonitor = new ProgressMonitorDialog(getShell());
|
||||||
progressMonitor.run(true, true, runnable);
|
progressMonitor.run(true, true, runnable);
|
||||||
|
|
||||||
if (elementsFound.isEmpty() == true) {
|
if (elementsFound.isEmpty() == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IMatch selected= selectCElement(elementsFound, getShell(), fDialogTitle, fDialogMessage);
|
IMatch selected= selectCElement(elementsFound, getShell(), fDialogTitle, fDialogMessage);
|
||||||
if (selected != null) {
|
if (selected != null) {
|
||||||
open(selected);
|
open(selected);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch(Exception x) {
|
} catch(Exception x) {
|
||||||
CUIPlugin.getDefault().log(x);
|
CUIPlugin.getDefault().log(x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Shell getShell() {
|
protected Shell getShell() {
|
||||||
|
|
|
@ -12,8 +12,8 @@ package org.eclipse.cdt.internal.ui.opentype;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.search.ICSearchConstants;
|
import org.eclipse.cdt.core.search.ICSearchConstants;
|
||||||
import org.eclipse.cdt.core.search.ICSearchScope;
|
import org.eclipse.cdt.core.search.ICSearchScope;
|
||||||
|
import org.eclipse.cdt.core.search.OrPattern;
|
||||||
import org.eclipse.cdt.core.search.SearchEngine;
|
import org.eclipse.cdt.core.search.SearchEngine;
|
||||||
import org.eclipse.cdt.internal.core.search.matching.OrPattern;
|
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.OperationCanceledException;
|
import org.eclipse.core.runtime.OperationCanceledException;
|
||||||
|
|
|
@ -20,16 +20,14 @@ import java.util.List;
|
||||||
import org.eclipse.cdt.core.search.ICSearchConstants;
|
import org.eclipse.cdt.core.search.ICSearchConstants;
|
||||||
import org.eclipse.cdt.core.search.ICSearchPattern;
|
import org.eclipse.cdt.core.search.ICSearchPattern;
|
||||||
import org.eclipse.cdt.core.search.ICSearchScope;
|
import org.eclipse.cdt.core.search.ICSearchScope;
|
||||||
|
import org.eclipse.cdt.core.search.OrPattern;
|
||||||
import org.eclipse.cdt.core.search.SearchEngine;
|
import org.eclipse.cdt.core.search.SearchEngine;
|
||||||
import org.eclipse.cdt.internal.core.search.matching.OrPattern;
|
|
||||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import org.eclipse.ui.actions.WorkspaceModifyOperation;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author aniefer
|
* @author aniefer
|
||||||
|
@ -78,9 +76,10 @@ public class CSearchOperation implements IRunnableWithProgress,ICSearchConstants
|
||||||
pattern = SearchEngine.createSearchPattern( _stringPattern, (SearchFor)iter.next(), _limitTo, _caseSensitive );
|
pattern = SearchEngine.createSearchPattern( _stringPattern, (SearchFor)iter.next(), _limitTo, _caseSensitive );
|
||||||
}
|
}
|
||||||
|
|
||||||
engine.search( _workspace, pattern, _scope, _collector, false );
|
try {
|
||||||
|
engine.search( _workspace, pattern, _scope, _collector, false );
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,8 +20,8 @@ import org.eclipse.cdt.core.search.BasicSearchMatch;
|
||||||
import org.eclipse.cdt.core.search.BasicSearchResultCollector;
|
import org.eclipse.cdt.core.search.BasicSearchResultCollector;
|
||||||
import org.eclipse.cdt.core.search.ICSearchConstants;
|
import org.eclipse.cdt.core.search.ICSearchConstants;
|
||||||
import org.eclipse.cdt.core.search.ICSearchScope;
|
import org.eclipse.cdt.core.search.ICSearchScope;
|
||||||
|
import org.eclipse.cdt.core.search.OrPattern;
|
||||||
import org.eclipse.cdt.core.search.SearchEngine;
|
import org.eclipse.cdt.core.search.SearchEngine;
|
||||||
import org.eclipse.cdt.internal.core.search.matching.OrPattern;
|
|
||||||
import org.eclipse.cdt.internal.corext.template.ContextType;
|
import org.eclipse.cdt.internal.corext.template.ContextType;
|
||||||
import org.eclipse.cdt.internal.corext.template.ContextTypeRegistry;
|
import org.eclipse.cdt.internal.corext.template.ContextTypeRegistry;
|
||||||
import org.eclipse.cdt.internal.corext.template.ITemplateEditor;
|
import org.eclipse.cdt.internal.corext.template.ITemplateEditor;
|
||||||
|
@ -546,7 +546,10 @@ public class CCompletionProcessor implements IContentAssistProcessor {
|
||||||
orPattern.addPattern(SearchEngine.createSearchPattern(
|
orPattern.addPattern(SearchEngine.createSearchPattern(
|
||||||
searchPrefix, ICSearchConstants.FUNCTION, ICSearchConstants.DECLARATIONS, false ));
|
searchPrefix, ICSearchConstants.FUNCTION, ICSearchConstants.DECLARATIONS, false ));
|
||||||
}
|
}
|
||||||
searchEngine.search(CUIPlugin.getWorkspace(), orPattern, scope, searchResultCollector, true);
|
try {
|
||||||
|
searchEngine.search(CUIPlugin.getWorkspace(), orPattern, scope, searchResultCollector, true);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
}
|
||||||
elementsFound.addAll(searchResultCollector.getSearchResults());
|
elementsFound.addAll(searchResultCollector.getSearchResults());
|
||||||
|
|
||||||
sendResultsToCollector(elementsFound.iterator(), offset, length, prefix );
|
sendResultsToCollector(elementsFound.iterator(), offset, length, prefix );
|
||||||
|
|
|
@ -449,7 +449,10 @@ public class NewClassWizardPage extends WizardPage implements Listener {
|
||||||
elements[0] = cProject;
|
elements[0] = cProject;
|
||||||
ICSearchScope scope = SearchEngine.createCSearchScope(elements, true);
|
ICSearchScope scope = SearchEngine.createCSearchScope(elements, true);
|
||||||
|
|
||||||
searchEngine.search(CUIPlugin.getWorkspace(), pattern, scope, resultCollector, false);
|
try {
|
||||||
|
searchEngine.search(CUIPlugin.getWorkspace(), pattern, scope, resultCollector, false);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
}
|
||||||
elementsFound.addAll(resultCollector.getSearchResults());
|
elementsFound.addAll(resultCollector.getSearchResults());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue