Eclipse
Home Eclipse Schedule Tools Prime Directives Engineering Log Coding Standards Resources

 

This semester, you will be required to use the Eclipse integrated development environment for all of your programming activities. Eclipse is free, open source, and available for all platforms supported in ICS 413/613.

Note that Eclipse requires Java 1.3 or above to be installed and on the PATH for your environment.  For this course, you will need Java JDK 1.4.2.

1.0 Installation

1.1 Download Eclipse 2.1.1.

The Eclipse Site provides access to extensive documentation. 

To download Eclipse 2.1.1, go to the Eclipse Download page:

Click on "Main Eclipse Download Servers",
Scroll to the "Latest Releases" section, and click on Build 2.1.1.
Scroll to the "Eclipse SDK" section, and download the release appropriate for your platform, such as "eclipse-SDK-2.1.1-win32.zip". This file is approximately 60 MB.

1.2 Install and bring up "vanilla" Eclipse 2.1.1

Expand the Eclipse zip folder.  The system is now installed.
To run eclipse, navigate into the Eclipse folder and double click on the "eclipse.exe" icon. The following screen should appear:

If you see the above screen, then Eclipse is successfully installed.

1.3 Install required Eclipse plugins.

First, shutdown Eclipse if it is currently running.

1.3.1 Install Jalopy, a source code reformatter:

Download the Jalopy plugin from http://jalopy.sourceforge.net/download.html. Click on the link named "Eclipse >=2.0 (.zip)".  Save the zip file into the eclipse folder.
Unzip this file. This will create a folder called "jalopy-eclipse-0.2.6".
Inside this folder is a folder called "de.hunsicker.jalopy.plugin.eclipse_0.2.6". Copy this folder to the eclipse "plugins" folder.

1.3.2 Install Checkstyle, a source code style checker.

Download the Checkstyle plugin from http://sourceforge.net/projects/eclipse-cs/. Scroll down to "Latest File Releases" section and click on the "Download" link.  Download v3.1.1, com.atlass.tools.eclipse.checkstyle_3.1.1.zip.  Save the zip file into the eclipse folder.
Unzip this file. This will create a folder called  "com.atlass.tools.eclipse.checkstyle_3.1.1". Copy this folder to the eclipse "plugins" folder.

1.3.3 Install Hackystat, a software metrics collector.

Download the Hackystat plugin from http://hackystat.ics.hawaii.edu/hackystat/controller?Page=help&Subpage=install&Sensor=Eclipse. Scroll down to section 2.2, "Installation using the drop-in .zip file", and click on the link named "org.hackystat.stdext.sensor_5.1.819.zip" (the version number might be different). Save the zip file into the eclipse folder.
Unzip this file. This will create a folder called org.hackystat.stdext.sensor_5.1.819. (the version number might differ). Copy this folder to the eclipse "plugins" directory.

1.3.4 Install Code Rally, a game for learning Eclipse and Java.

Download the Code Rally plugin from http://www.alphaworks.ibm.com/tech/coderally. Click on the "Download now" link. Download the file "CodeRallyPkg.zip" to the eclipse directory.
Unzip this file. This will create a folder called "com.ibm.coderally".  Copy this folder to the eclipse "plugins" directory.

2.0 User Configuration in the ICS Lab environment

In the ICS Labs, Eclipse is installed into a read-only area of the file system.  By default, eclipse maintains information about the projects you are working on in a folder called "workspace" in the eclipse directory.  Since the eclipse folder is read-only, you will need to create a new shortcut that starts up Eclipse and instructs it to maintain the workspace folder in your home directory (which is normally H:).  Here's how to do it:

In your home directory (H:), create a folder called "Eclipse".
Go to c:\Program Files\Eclipse.  There will be an executable file there called "eclipse.exe". Right click on that file and select the option "Send to Desktop". A shortcut will be created on your desktop. (Note that there might already be an Eclipse shortcut on the desktop.  Ignore this one; it can't be edited.)
Right click on the desktop shortcut and select "Properties".  Edit the text field "Start in:" to the folder you created in your home directory, "H:\Eclipse".
Click OK. 

When you double-click on this desktop shortcut, you will now bring up Eclipse and it will create new projects in your home workspace directory.

3.0 Configuration to support JOSSE Code Conventions

You will want to change some of the default formatting settings so that your code obeys our coding conventions.

3.1. Set up Java code formatting.

Go  to 'Window | Preferences | Java | Code Formatter':
In the "New Lines" tab:
Check "Insert new lines in control statements"
Check "Insert a new line inside an empty block"
Check "Clear all blank lines"
In the "Line Splitting" tab:
Change "Maximum Line Length" from 80 to 100.
In the "Style" tab:
Uncheck "Insert tabs for indentation, not spaces."
Set "Number of spaces representing an indentation level" to 2.

3.2.  Set the default editor to insert spaces for tabs

Go to 'Window | Preferences | Java | Editor':
In the "Typing" tab:
Check "Insert space for tabs"

3.3. Show the print margin at column 100.

Go to Window | Preferences | Java |Editor:
Set "Print margin column" to 100.

4.0 Eclipse tutorials

Here are two good sources for getting up to speed in Eclipse.

Start with: http://www.onjava.com/pub/a/onjava/2002/12/11/eclipse.html.
Also work through the online tutorial in Eclipse from menus Help | Help Contents | Workbench User Guide | Getting Started | Basic Tutorial.

5.0 Tips and Tricks

5.1 To reformat (and thus remove tabs from) a file for improved display outside Eclipse.

If your code does not display correctly in another editor or in a browser window, it is most likely because of tabs in your file.  A simple way to fix this is to invoke the Eclipse formatter on the file containing your code with:

Source | Format

5.2 To provide an "XML-aware" editing of XML and HTML files.

The "Ant" editor provides nice support for editing XML and HTML files.  To associate this editor with all XML and HTML files:

Go to 'Window | Preferences | Workbench | File Associations'

To the left of 'File types', click "Add"
Add the new file type "*.xml"
Make sure that the *.xml file type is selected, then to the left of "Associated editors", click "Add"
Select "Ant Editor" and click "OK"
Repeat above steps to associate the Ant Editor with file types of "*.html"