Yolanda:
This is the procedure for Eclipse 3.0.1:
1. Open Preferences (Window->Preferences).
2. Goto Java:Editor:Templates preferences.
3. Click "New..."
4. Enter Name e.g. typeDebug
5. Change context to 'java'
6. Enter Description e.g. debug variable type
7. Enter Pattern:
log.debug("${word_selection} =" + ${word_selection} );
8. Click "OK"
9. Click "OK" to close the preferences dialog.
10. Select reference in Java editor.
11. Use the Ctrl-Space keystroke.
12. The typeDebug template will be listed in the content
assisstant. You can select this with the mouse or
by typing until it is selected and pressing Enter.
Enjoy,
-John K
> Hello,
>
[quoted text clipped - 12 lines]
> Thanks,
> Y
Yolanda Epos - 13 Oct 2004 13:27 GMT
> log.debug("${word_selection} =" + ${word_selection} );
Thank you. That is exactly what I was looking for.
But I've 2 little Problems:
1) The code doesn't get proberly intented. It's always
intendend 8 charactes too much.
2) When I'm typing characters to select the template in
the code assistent popup, some subsequent code gets
overwritten. The amount of overwritten code also
depends on the length of the selected code.
Example:
--------
JPanel graph = makeGraph();
this.getContentPane().add(graph);
extraLinesColorsTemp
}
private JPanel makeGraph() {
JPanel panel = new JPanel();
After invocation of the template for "extraLinesColorsTemp":
------------------------------------------------------------
JPanel graph = makeGraph();
this.getContentPane().add(graph);
log.debug("extraLinesColorsTemp =" +
extraLinesColorsTemp);te JPanel makeGraph() {
JPanel panel = new JPanel();
Tried both in Windows with eclipse 3.01, java 1.4.2_03 and Linux with
eclipse 3.00, java 1.4.2_05.
But for now, I can live with that. Workarounds:
1) Shift selected code 4 charactes to the left (SHIFT+TAB) before
pressing CTRL+SPACE.
2) Call the template aaDebug, so I can select it with the cursor.
Thanks again,
Y