Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 200067

Summary: [templates] code assist no longer suggests templates for method completions as it did in 3.2
Product: [Eclipse Project] JDT Reporter: jay_schmidgall
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: benno.baumgartner, daniel_megert, jerome_lanneluc
Version: 3.3   
Target Milestone: 3.3.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Fix none

Description jay_schmidgall CLA 2007-08-15 12:52:31 EDT
Build ID: I20070625-1500

Steps To Reproduce:
1.Define a template for a method completion, say named addcomp.
2.In the java editor, define a variable, say a JButton button.
3.Type button.addcomp<code assist>
4.Note that addcomp is not one of the suggestions. It was in 3.2.


More information:
I have templates defined which add an anonymous listener to a Swing component. For example,

Name      Context     Description                Auto Insert
addcomp   java        add a component listener   on

Preview
addComponentListener(new ComponentAdapter() {
	public void componentHidden( ComponentEvent e ) {
		${cursor}
	}

	public void componentMoved( ComponentEvent e ) {
	}

	public void componentResized( ComponentEvent e ) {
	}

	public void componentShown( ComponentEvent e ) {
	}
});

I could then type some code like
  JButton button = new JButton( "button" );
  button.addcomp<code assist>

and in 3.2, the code assist popup would list
   addcomp - add component adapter
   addComponentListener(ComponentListener l) void - Component
and I could choose addcomp to have the above code added for me.

In 3.3, it longer gives me the choice, instead, it simply chooses the match and fills in 
   button.addComponentListener( l )
If I instead type
   button.addc<code assist>
The popup lists the methods which complete that, but not the templates.

It appears that templates are no longer suggested by code assist in 3.3 when in 3.2 they would be suggested, and it was quite useful.
Comment 1 jay_schmidgall CLA 2007-08-15 12:57:34 EDT
Sorry, the description of the template actually matches what is shown in the code assist popup, I just typed it in wrong in the example.
Comment 2 Jerome Lanneluc CLA 2007-08-16 04:57:29 EDT
Moving to JDT/Text
Comment 3 Dani Megert CLA 2007-08-21 07:19:03 EDT
This needs to be fixed. Probably introduced by fix for bug 21926.
Comment 4 Dani Megert CLA 2007-08-21 08:05:46 EDT
*** Bug 199425 has been marked as a duplicate of this bug. ***
Comment 5 Dani Megert CLA 2007-08-28 10:54:04 EDT
Fixed in HEAD.
Comment 6 Dani Megert CLA 2007-08-29 04:02:52 EDT
Created attachment 77217 [details]
Fix

The fix has two parts:
1) reverts the old behavior for the template contexts
2) checks the template name in the template edit dialog (if we want to be conservative we can skip that part for 3.3.1)
Comment 7 Dani Megert CLA 2007-08-29 04:58:06 EDT
Fixed in R3_3_maintenance.
Comment 8 Benno Baumgartner CLA 2008-01-24 11:02:22 EST
start verification
Comment 9 Benno Baumgartner CLA 2008-01-24 11:06:05 EST
verified in M20080123-0800