Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 21:15
Channing Walton is currently offline Channing WaltonFriend
Messages: 110
Registered: July 2009
Senior Member
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 Dec 27 00:22:22 GMT 2024

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

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

Back to the top