| Code completion on snippet not including source [message #231335] | 
Tue, 13 June 2006 17:15  | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Hi, 
I need to do some code completion in a snippet of code.  To achieve that I  
do the following: 
 
1. create a fake compilation unit (project is a java project) 
 
	IClasspathEntry[] classpath = project.getRawClasspath(); 
	WorkingCopyOwner owner = new WorkingCopyOwner() {}; 
	ICompilationUnit unit = owner.newWorkingCopy("Foo", classpath, new  
NullProblemRequestor(),null); 
 
	unit.getBuffer().append(codeSnippet); 
 
2. use the unit to do the completion 
	unit.codeComplete(offset, requestor); 
 
   where offset is the offset into the code snippet I want to complete and  
the requestor is a CompletionRequestor 
 
My problem is that this successfully completes on all types in jar files  
and the JRE in the project, but it does not complete on any source files  
in the project even though the project's raw classpath looks like it  
contains the source entries. 
 
Any ideas what I'm doing wrong? 
 
thanks, 
 
Channing
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.21398 seconds