Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Tools / October 2004

Tip: Looking for answers? Try searching our database.

Macro recorder/language for eclipse

Thread view: 
Yolanda Epos - 08 Oct 2004 10:28 GMT
Hello,

is there some kind of macro recorder or language for eclipse?
I'd like to simplify debugging for me.
In JEdit I just write "foo", select it, press a shortcut and
then a macro writes for me: "log.debug("foo ="+foo);"
In eclipse, I always have to write the whole log.debug... part.

OK, I could use the SlickEdit plugin or the eclipse debugger.
But both are not really practical for my task.

Perhaps I could do something with Find/Replace and regular
expressions? But how? And how assign a shortcut to it?

Thanks,
Y
John  Keyes - 08 Oct 2004 14:37 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.