Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Code completion on snippet not including source
Code completion on snippet not including source [message #231335] Tue, 13 June 2006 17:15
Eclipse UserFriend
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
Previous Topic:ICompilationUnit from IResource
Next Topic:[ADT-JDT] Inject Code during generation
Goto Forum:
  


Current Time: Fri May 02 22:28:17 EDT 2025

Powered by FUDForum. Page generated in 0.02272 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top