Bug 4139 - EC DCR: Code templates feature (1GIVMDV)
Summary: EC DCR: Code templates feature (1GIVMDV)
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Claude Knaus CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-10 23:06 EDT by Carolyn MacLeod CLA
Modified: 2002-01-25 02:51 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carolyn MacLeod CLA 2001-10-10 23:06:42 EDT
From Eclipse Corner: Code templates

	Great IDE! One thing I miss though: code templates. I would like to have
	user defined shortcuts to generate statements like:

	for (int i=0; i<[vector].size(); i++) {
	  Object item = [vector].get(i);
	}

	where [vector] would be replaced by a user supplied name.

NOTES:
	CM (8/23/2001 3:57:39 PM)
		Further info on feature:
> It would be useful if you could supply more info:
> - where have you used these before

:
 JBuilder

> - how did you invoke them - specific shortcut key? user-specified shortcut
> key[s]?

:
 shortcut (possible user-defined)


> - i.e. did the U/I provide a list of them for you when you invoked it, or
> could you invoke each one with some separate key sequence?

:
 you could start typing the template, then hit one special key for templates
and see
the list of available templates.

 Please: NO separate keys for different templates!

> - are they just a macro?

:
 ?
> - did you name them?

:
 yes.

> - did you fill in the parameter (i.e. [vector]) (in a dialog, perhaps?)

when
> you invoked the template, or did the U/I place the cursor for you to type

it
> in?

  "U/I place the cursor for you to type it in" right after the template has
been injected
in your code.
Comment 1 Claude Knaus CLA 2001-10-11 08:18:58 EDT
We're getting there. Templates as of now support arguments to avoid
typing the same name multiple times. Argument variables are named ${0}, ${1} 
etc.

The corresponding template would be

  Name: itvec Context: java
  Description: iterate over vector
  Pattern: 
    for (int i=0; i<${0}.size(i); i++) {
      Object item= ${0}.get(i);
    }

and could be called by:

  itvec(myVector)<CTRL-SPACE>
Comment 2 Claude Knaus CLA 2001-10-18 06:35:08 EDT
implemented > 204

If there are unresolved variables, a popup editor allows to enter the missing
variable names.
Comment 3 DJ Houghton CLA 2001-10-29 17:34:08 EST
PRODUCT VERSION:
	R0.9