# Quick Start Guide

This tutorial introduces you to the Workbench, providing a brief overview of the steps required to create simple applications. More extensive explanations, including images, are available in the Workbench User Guide.

Workbench Quick Start

Task | Description
Create a Simple Project | Select File > New > Project.... In the New Project wizard, select Simple > Project then click Next. In the Project name field type a name for your new project. Specify a location for the project or use the default. Click Finish.
Create a Folder | Ensure one or more projects exist. Select File > New > Folder. In the Folder name field of the New Folder wizard, type a name for your new folder. Click Finish.
Create a File | Ensure one or more projects exist. Select File > New > File. In the File name field of the New Folder wizard, type a name for your new folder. Click Finish.
Import Resources | Select File > Import. Select an import source. Click Next. Select the import location containing the resource by following the steps indicated in the applicable wizard. Click Finish.
Export Resources | Select File > Export. Select an export destination. Click Next. Select the export destination by following the steps indicated in the applicable wizard. Click Finish.
Create a Java Project: JUnit example | To download the JUnit source code, visit http://www.eclipse.org/downloads/ and locate the Eclipse release that you are working with. Scroll down to the Example Plug-ins section and download the examples archive. Extract the contents of the Zip file to a directory. Return to Eclipse and select File > New > Project.... Select Java Project then click Next. In the Project name field type JUnit. Click Finish. In the Package Explorer, make sure that the JUnit project is selected. Select the menu item File > Import.... Select Zip file, then click Next. Click Browse next to the Zip file field and browse to select <ExamplesDownloadPath>eclipse/plugins/org.eclipse.jdt.ui.examples.projects_3.0.0/archive/junit/junit381src.jar. In the Import wizard, below the hierarchy list click Select All. Once the JUnit project appears in the destination Folder field click Finish. In the import progress indicator, notice that the imported resources are compiled as they are imported into the workbench. This is because the Build automatically option is checked on the Workbench preferences page. You will be prompted to overwrite the .classpath and .project files in the JUnit project. This is because the .classpath resource was created for you when you created the JUnit project. It is safe to overwrite these files. In the Package Explorer view, expand the JUnit project to view the JUnit packages.
Create a Java Class: JUnit Example | In the Package Explorer view, right-click the JUnit project, select New > Package. In the Name field, type test as the name for the new package. Click Finish. In the Package Explorer view, select the new test package and click New Java Class in the toolbar. Make sure that JUnit appears in the Source Folder field and that test appears in the Package field. In the Name field, type MyTestCase. Next to the Superclass field, click Browse. In the Choose a type field in the Superclass Selection dialog, type Test to narrow the list of available superclasses. Select the TestCase class and click OK. Select the checkbox for Constructors from superclass. Click Finish. The new file is opened in the editor. In the Outline view select the new class MyTestCase. Open the context menu and select Source > Override/Implement Methods.... In the Override Methods dialog, check setUp() and tearDown() and click OK. Change the body of setUp() to container= new Vector();. container and Vector are underlined with a problem highlight line as they cannot be resolved. A light bulb appears on the marker bar. Set the cursor inside Vector and press Ctrl+1 (or use Edit > Quick Fix from the menu bar). Choose Import 'Vector' (java.util).This adds the missing import declaration. Set the cursor inside container and press Ctrl+1. Choose Create field 'container' to add the new field. In the Outline view, select the class MyTestCase. Open the context menu and select Source > Generate Getter and Setter.... The Generate Getter and Setter dialog suggests that you create the methods getContainer and setContainer. Select both and click OK. A getter and setter method for the field container are added. Save the file. The formatting of generated code can be configured in Window > Preferences > Java > Code Style > Code Formatter. If you use a prefix or suffix for field names, you can specify this in Window > Preferences > Java > Code Style > Fields so that generated getters and setters will suggest method names without the prefix or suffix.
Launch a Java Program: JUnit Example | In the Package Explorer view, find junit.textui.TestRunner.java and double-click it to open it in an editor. In the Outline view, notice that the TestRunner class has an icon which indicates that the class defines a main method. Right-click TestRunner.java in the Package Explorer and select Run > Java Application. Select Run > Run.... The Launch Configurations dialog opens with the TestRunner launch configuration selected. In the Launch Configurations dialog select the Arguments tab and type junit.samples.VectorTest in the Program arguments area. Click Run. This time the program runs correctly, indicating the number of tests that were run. Switch to the Debug perspective. In the Debug view, notice that a process for the last program launch was registered when the program was run. Click Run in the workbench toolbar. This list contains the previously launched programs. These programs can be relaunched by selecting them in the history list. From the context menu in the Debug view (or the equivalent toolbar button), select Remove All Terminated to clear the view of terminated launch processes.
Create a Plug-in | Select File > New > Project. Select Plug-in Project and click Next. In the Project name field, type a name for your project and click Next. In the Plug-in Content page, set the data with which the plugin.xml file will be initialized, including the plug-in ID, version and name. Select an available template and click Next. Customize the sample extension and click Finish.
Launch an Eclipse runtime workbench instance to test a plug-in | Select Run > Run.... In the Launch Configuration dialog, type a name for your configuration in the Name field. In the Workspace data field, click Browse to define the workspace that will be used by the run-time workbench. The location of this runtime workspace must be different from the workspace of your host instance. In the Run an application field select the default Eclipse application org.eclipse.ui.ide.workbench. Click Run. A second workbench instance will appear whose constituent plug-ins are the workspace plug-ins and the plug-ins selected on the Target Platform preference page. You can test your runtime workbench using the JRE of your choice and does not have to be the same one against which your plug-ins compile in the workspace. You can also specify any VM arguments that are appropriate for your testing.
Automatically performing builds | Select Window > Preferences. Select the General category in the left pane. Select Build automatically. Click OK.
Manually performing builds | In the Navigator view of the Resource perspective, select one or more projects. Right-click and select the option Build Project from the pop-up menu.

CVS Quick Start

Note: A CVS server must already be configured on the host machine to create a valid repository location in the Workbench.

Task | Description
Creating a CVS repository location | Select Window > Show View > Other... Select CVS > CVS Repositories. Click Add CVS Repository. Enter the information required to identify and connect to the repository location. Click Finish.
Connecting and configuring CVS with SSH | Select Window > Preferences. Select Team > CVS > SSH2 Connection Method. Select the General tab, click Add Private Key and add your private key to the list. Provide a password for your private key and save it on your computer. If you do not have a key pair: Select Window > Preferences. Select Team > CVS > SSH2 Connection Method. Select the Key Management tab. If your server supports version 1 of the protocol, select Generate RSA key, for version 2 select Generate DSA key. A public key and private key will be generated. The public key will be shown in the read-only text area. Copy the public key to your server. If your server is running an OpenSSH server, click Export via sftp. Otherwise copy and paste the public key into your remote ~/.ssh/authorized_keys file.
Checking out a project from a CVS repository | Switch to the CVS Repository Exploring perspective. In the CVS Repositories view, expand the repository location. Expand HEAD and select the folders that you want to add as projects to the Workbench. Select one of the following from the menu for the selected folders: Check Out to check out each of the selected folders as a project in the local workspace with the same name as the folder in the repository. Check Out As... to check out the selected folders into a custom configured project in the local workspace.
Synchronizing with the Repository and Updating or Committing changes | In the Navigator view, select the resources that you want to synchronize. Right click and select Team > Synchronize with Repository. In the Synchronize view, right-click the resource and select one of the following: Commit, if you want to override the existing CVS version of the resource and save your version to the repository. Update, if you want to update your workspace with the version stored within the repository.