In addition to handy features like automatic code formatting, Eclipse can generate code for you. In this lab we'll explore how to configure and use its code-generation features.
The following steps will lead you through the steps of
automatically generating a class in your ircclient package
that implements the interface IRCMessageListener.
src
and select the edu.ucsd.cse70.ircclient package.
File->New->Class.
In the "New Java Class" dialog,
make sure the package is set to edu.ucsd.cse70.ircclient,
and give the class any name you like. (You won't commit it to the repository.)
Don't close the dialog just yet!
Add... button,
and in the text field, begin typing
the name of the interface you're implemeting (see above).
Then select it and press "OK".
message, connection, and user.
Give each variable a type that seems appropriate.
In keeping with good encapsulation, make them private.
So that other classes can read and modify the values of these variables,
we'll generate accessor methods.
Source->Generate Getters and Setters.....
In the resulting dialog, check all 3 variables
and check the "Generate method comments" option
before pressing "OK".
Notice the TODO comment in the notify method?
Find it painfully obvious? Let's tell Eclipse to stop generating those.
Window->Preferences->Java->Code Style->Code Templates.
TODO comment
and remove it.
Then try generating another class (hint: or at least another method)
to verify it works.
package edu.ucsd.cse70.ircclient; /** * @author Tess * @version .1 10/20/2008 */ public class MYCLASS implements IRCMessageListener