Bug 97857 - Code assist don't work inside variable view
Summary: Code assist don't work inside variable view
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 RC2   Edit
Assignee: Kevin Barnes CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 93157
  Show dependency tree
 
Reported: 2005-06-01 10:47 EDT by David Audel CLA
Modified: 2005-06-09 15:20 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Audel CLA 2005-06-01 10:47:54 EDT
build 3.1RC1

I tried the reproduce the bug 93157 but i cannot because the JDTCore completion
API is never call with this test case.

My exact test case is
1) launch eclipse
2) import the jdtcore plugin inside the workspace
3) set a breakpoint inside CompletionEngine#complete(IType .....)
4) launch in debug mode
5) import org.eclipse.ui.form inside this new workspace
6) set a breakpoint inside FormEditor#pageChange
7) launch in debug mode
8) import a plugin and open a Manifest file
*the breakpoint of 6) is reached
9) do ctrl+space in the variable view
*no completion and the breakpoint of 3) is not reached

Redo the same test case but set a beakpoint in
DisplayCompletionProcessor#computeCompletionProposals() instead of
CompletionEngine#complete. Then this breakpoint is reached.

Step inside getReceivingType() and you can see that 'project' is
'org.eclipse.ui.forms' and 'typeName' is ManifestEditor. The following code
seems to search ManifestEditor inside 'org.eclipse.ui.forms' but this class is
inside 'org.eclise.jdt.debug.ui' and not in 'org.eclipse.ui.forms. Then no IType
is found and the completion failed.

I am not sure of my diagnosis but the problem seems to be inside this area.
Comment 1 Darin Wright CLA 2005-06-01 16:37:28 EDT
The problem is that the receiving type (ManifestEditor) is not in the 
workspace. We hit a breakpoint in FormEditor, but we are trying code assist in 
the conext of the receiver (ManifestEditor), which cannot be found.
Comment 2 Darin Wright CLA 2005-06-01 16:43:19 EDT
And, even when it is in the workspace, we are searching for the receiving type 
(ManifestEditor) in the project of the stack frame's declaring type. This does 
not work either. I.e. the project org.eclispe.ui.forms will not be able to 
find an upstream subclass.
Comment 3 Darin Wright CLA 2005-06-08 16:50:56 EDT
Fixed. Changes to:

DetailsCompletionProcessor
DisplayCompletionProcessor
DisplayMessages.java/.properties

To peform code assist we resolve an IType. However, we were doing this by 
searching for the receiving type name in the declaring type's project (which 
might not be the same - the receiving type may be defined in an upstream 
project).

Fix is to use the source locator to search for the receiving type source 
element, and then resolve a Java element (and then type) from that. This 
provides the correct IType and IJavaProject for the completion.

Note that for this test case to work, you also need to import 
org.eclipse.pde.ui (in step 5 of original problem description) for code assist 
to work. Otherwise the source locator still cannot find the ManifestEditor 
type. 
Comment 4 Darin Wright CLA 2005-06-08 16:51:50 EDT
Please verify, Kevin.
Comment 5 Kevin Barnes CLA 2005-06-09 15:20:04 EDT
verified