1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-06 08:35:26 +02:00

Patch for Bogdan Gheorghe and Thomas Fletcher.

This is Thomas' patch which causes the completion engine to use the FORCE_IMMEDIATE_SEARCH option 
in the search engine. Test suite run on Windows.
This commit is contained in:
John Camelon 2004-02-15 23:12:40 +00:00
parent bb4821dee3
commit 0470019cbd
6 changed files with 38 additions and 8 deletions

View file

@ -1,3 +1,10 @@
2004-02-13 Bogdan Gheorghe
-Modified CompletionProposalsTest to reset the indexer thread at the
beginning of the test case - this means that the project will be indexed
as soon as it is created. Since completions now use FORCE_IMMEDIATE_SEARCH,
we have to give a bit of time to ensure that the project is indexed before
we try a query.
2004-01-29 John Camelon
Added ScannerTestCase::testBug50821().

View file

@ -58,6 +58,7 @@ public class CompletionProposalsTest extends TestCase{
}
protected void setUp() throws Exception {
(CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset();
monitor = new NullProgressMonitor();
String pluginRoot=org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.core.tests").find(new Path("/")).getFile();
@ -79,8 +80,8 @@ public class CompletionProposalsTest extends TestCase{
}
// use the new indexer
IndexManager indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
indexManager.reset();
// IndexManager indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
// indexManager.reset();
}
@ -110,13 +111,15 @@ public class CompletionProposalsTest extends TestCase{
Document document = new Document(buffer);
int pos = buffer.indexOf(" a ") + 2;
int length = 0;
CCompletionProcessor completionProcessor = new CCompletionProcessor(null);
ICompletionProposal[] results = completionProcessor.evalProposals(document, pos, length, tu);
try {
Thread.sleep(MAGIC_NUMBER);
} catch (InterruptedException e1) {
fail( "Bogdan's hack did not suffice");
}
CCompletionProcessor completionProcessor = new CCompletionProcessor(null);
ICompletionProposal[] results = completionProcessor.evalProposals(document, pos, length, tu);
assertEquals(results.length, 7);
for (int i = 0; i<results.length; i++){
ICompletionProposal proposal = results[i];

View file

@ -1,3 +1,7 @@
2004-02-13 Bogdan Gheorghe
- From Thomas: Modified SearchEngine.search to allow for the passing of
a waiting policy
2004-02-13 Bogdan Gheorghe
- Added error handling to MatchLocator.locateMatches to handle possible
parser failures.

View file

@ -156,6 +156,10 @@ public class SearchEngine implements ICSearchConstants{
* @param _collector
*/
public void search(IWorkspace workspace, ICSearchPattern pattern, ICSearchScope scope, ICSearchResultCollector collector, boolean excludeLocalDeclarations) {
search(workspace, pattern, scope, collector, excludeLocalDeclarations, ICSearchConstants.WAIT_UNTIL_READY_TO_SEARCH);
}
public void search(IWorkspace workspace, ICSearchPattern pattern, ICSearchScope scope, ICSearchResultCollector collector, boolean excludeLocalDeclarations, int waitingPolicy) {
if( VERBOSE ) {
System.out.println("Searching for " + pattern + " in " + scope); //$NON-NLS-1$//$NON-NLS-2$
}
@ -189,7 +193,7 @@ public class SearchEngine implements ICSearchConstants{
pathCollector,
indexManager
),
ICSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
waitingPolicy,
subMonitor,
null );

View file

@ -1,3 +1,10 @@
2004-02-13 Bogdan Gheorghe
Thomas' patch: Modified CCompletionProcessor to use FORCE_IMMEDIATE_SEARCH
when requesting a dependency query/search.
* src/org/eclipse/cdt/internal/ui/text/CCompletionProcessor.java
2004-02-05 Alain Magloire
PR 51221
Reformat Patch from Bogdan base on Thomas Fletcher original patch

View file

@ -513,7 +513,7 @@ public class CCompletionProcessor implements IContentAssistProcessor {
//Get file's dependencies
try {
IndexManager indexMan = CCorePlugin.getDefault().getCoreModel().getIndexManager();
indexMan.performConcurrentJob(new DependencyQueryJob(project, (IFile)actualFile, indexMan, dependencies), ICSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, null, null);
indexMan.performConcurrentJob(new DependencyQueryJob(project, (IFile)actualFile, indexMan, dependencies), ICSearchConstants.FORCE_IMMEDIATE_SEARCH, null, null);
} catch (Exception e) {
}
}
@ -529,8 +529,13 @@ public class CCompletionProcessor implements IContentAssistProcessor {
orPattern.addPattern(SearchEngine.createSearchPattern( prefix, ICSearchConstants.TYPE, ICSearchConstants.DECLARATIONS, false ));
orPattern.addPattern(SearchEngine.createSearchPattern( prefix, ICSearchConstants.ENUM, ICSearchConstants.DECLARATIONS, false ));
orPattern.addPattern(SearchEngine.createSearchPattern( prefix, ICSearchConstants.MACRO, ICSearchConstants.DECLARATIONS, false ));
searchEngine.search(CUIPlugin.getWorkspace(), orPattern, scope, resultCollector, true);
elementsFound.addAll(resultCollector.getSearchResults());
try {
searchEngine.search(CUIPlugin.getWorkspace(), orPattern, scope, resultCollector, true, ICSearchConstants.FORCE_IMMEDIATE_SEARCH);
elementsFound.addAll(resultCollector.getSearchResults());
} catch(Exception ex) {
/* Ignore exception, there may be partial results collected */
}
if((currentScope instanceof IMethod) || (currentScope instanceof IMethodDeclaration) ){
// add the methods and fields of the parent class