[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] 1.2 stream: Code Completion patch
|
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.
- Bogdan
Index: search/ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/search/ChangeLog,v
retrieving revision 1.37.2.4
diff -u -r1.37.2.4 ChangeLog
--- search/ChangeLog 13 Feb 2004 22:03:10 -0000 1.37.2.4
+++ search/ChangeLog 13 Feb 2004 23:49:38 -0000
@@ -1,4 +1,8 @@
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.
Index: search/org/eclipse/cdt/core/search/SearchEngine.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/SearchEngine.java,v
retrieving revision 1.9.2.2
diff -u -r1.9.2.2 SearchEngine.java
--- search/org/eclipse/cdt/core/search/SearchEngine.java 27 Oct 2003 20:44:57 -0000 1.9.2.2
+++ search/org/eclipse/cdt/core/search/SearchEngine.java 13 Feb 2004 23:49:38 -0000
@@ -156,6 +156,10 @@
* @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 @@
pathCollector,
indexManager
),
- ICSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
+ waitingPolicy,
subMonitor,
null );
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/ChangeLog,v
retrieving revision 1.203.2.17
diff -u -r1.203.2.17 ChangeLog
--- ChangeLog 5 Feb 2004 19:55:30 -0000 1.203.2.17
+++ ChangeLog 13 Feb 2004 23:51:58 -0000
@@ -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
Index: src/org/eclipse/cdt/internal/ui/text/CCompletionProcessor.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/Attic/CCompletionProcessor.java,v
retrieving revision 1.15.2.2
diff -u -r1.15.2.2 CCompletionProcessor.java
--- src/org/eclipse/cdt/internal/ui/text/CCompletionProcessor.java 27 Oct 2003 20:45:06 -0000 1.15.2.2
+++ src/org/eclipse/cdt/internal/ui/text/CCompletionProcessor.java 13 Feb 2004 23:52:00 -0000
@@ -513,7 +513,7 @@
//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 @@
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
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/ChangeLog,v
retrieving revision 1.131.2.7
diff -u -r1.131.2.7 ChangeLog
--- ChangeLog 30 Jan 2004 16:13:25 -0000 1.131.2.7
+++ ChangeLog 13 Feb 2004 23:50:30 -0000
@@ -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().
Index: model/org/eclipse/cdt/core/codeassist/tests/CompletionProposalsTest.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/codeassist/tests/Attic/CompletionProposalsTest.java,v
retrieving revision 1.8
diff -u -r1.8 CompletionProposalsTest.java
--- model/org/eclipse/cdt/core/codeassist/tests/CompletionProposalsTest.java 23 Sep 2003 15:17:03 -0000 1.8
+++ model/org/eclipse/cdt/core/codeassist/tests/CompletionProposalsTest.java 13 Feb 2004 23:50:30 -0000
@@ -58,6 +58,7 @@
}
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 @@
}
// use the new indexer
- IndexManager indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
- indexManager.reset();
+// IndexManager indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
+// indexManager.reset();
}
@@ -110,13 +111,15 @@
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];