[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools] Re: Source mapping to Java element

Note that with the 1/31 driver, the resolvable string had to be reduced to
one token, e.g. in order to resolve "java.lang.String", you had to pass a
selection range corresponding to "String", from which it would infer the
proper context based on the source of the compilation unit.

Latest drivers are now accepting qualified names as part of the selection,
along with simple names (the idea is that a user also wants it to work when
double-clicking on an identifier and pressing F3).

> lauzon@xxxxxxxxxx wrote:

> > Posting question for Juanita Ewing from Instantiations, using 1/31 driver:

> > Having some trouble making the source mapping to java element work
> > properly. The code we are executing is:

> >                  ICompilationUnit unit= 
> > manager.getWorkingCopy(editor.getInput());
> >                  ITextSelection tSelection = (ITextSelection)selection;
> >                  IJavaElement[] elements = 
> > unit.codeResolve(tSelection.getStart(),
> > tSelection.getStart() + tSelection.getLength(), null);

> > The result of codeResolve() is always a zero element array.

> The code you're executing is similar to what is done in the Java IDE
> editor. Given the information above, it's difficult to say what goes
> wrong. Did you check that
> - the selection describes a resolvable string
> - the compilation unit you call codeResolve on is part of a Java 
>   project, i.e. the project has the Java nature
> - the project's build class path is properly set so that the element
>   to be resolved is accessible for the code resolve infrastructure?

> Hope that helps, Kai