Part 1 is geared to those new to Eclipse. It explains some Eclipse terminology newcomers often find difficult and talks about various parts of the Eclipse IDE. This article explains what an Eclipse workbench is and explores the difference between projects and workspaces (Eclipse's way of organizing source code) and how they relate to each other. Finally, this article explains how you can customize portions of the IDE to your liking.
The main Eclipse window is referred to as the workbench (see Figure 1). It contains things like the menu bar, toolbar, editor, and views. The area below the toolbar where the editor and different views are placed is known as the workbench page. This page contains the most visible part of the interface: the editor and the views.
Figure 1. The Eclipse workbench
The editor is the primary content area where you do development in Eclipse. Note that the term "editor" doesn't necessarily mean a text editor; even a WYSIWYG form designer can be considered an editor. The Eclipse workbench can become crowded with toolbars and views, so if you want more space for the editor, click the Maximize button at upper right. Doing so hides all the other views, giving you more screen real estate for the editor. You can bring back all the views by clicking Restore.
Sometimes you want to view more than one editor window at a time, perhaps to copy and paste something from one to the other or to read information from one while typing in the other. To facilitate this, Eclipse lets you stack editor windows side by side or on top of each other. To do so, drag the tab of an open editor window to the side or to the top/bottom; it's stacked on that side, allowing you to work with both open editors easily.
If you have many editor windows open, it can be time-consuming to switch to the one you want by manually scanning the rows of tabs and clicking it. Eclipse has a nice shortcut that makes this easier: press Ctrl+E, and a pop-up menu appears at upper right in the row of tabs and lists all the open editors (see Figure 2). You can select one or begin typing the name of the editor you want to open, and the list will start filtering.
Figure 2. Ctrl+E shows a pop-up that lets you easily switch between editor windows
Views are the little windows docked to the sides of the editor that contain more information regarding the content of the editor. Minimize a view by clicking the Minimize button at upper right; the view minimizes to a shortcut bar on the side of the window (see Figure 3). Clicking the view's button in the shortcut bar makes the view temporarily pop up. This is a good way to save screen real estate while keeping the view easily accessible.
Figure 3. Shortcut bar lets you minimize views while keeping them accessible
A view can be detached from its position. To detach a view, drag it outside the workbench window or right-click its tab and select Detach. A detached view behaves like a new window and appears on top of the workbench window. Views can also be docked to different sides of the workbench window. To do so, drag the view's tab, and place it on the side where you want it docked. To open a view, choose Window > Show View. A menu pops up, showing some of the available views. If the view you want isn't listed, click Other at the bottom of the menu. A dialog pops up, showing all the views organized by category. You can type the name of the view you want to open in the text box at the top to filter the list of views. Alternatively, to get to this dialog more easily, click the icon with a + sign at bottom left in the workbench window to open the same menu you see when you choose Window > Show View.
Eclipse organizes your source code through the concept of projects and workspaces. A workspace is a collection of projects. A project is a collection of a set of source files. Usually, the concepts of workspaces and projects cause a lot of confusion among newcomers because the definition of Eclipse's projects is different from projects in other IDEs.
A good way to think about these in a software-development sense is to consider projects as individual modules and the workspace as a project. Thus, you have a project (the workspace, in Eclipse terminology) that contains multiple modules (projects, in Eclipse terminology). The following sections look at each in more detail.
A workspace contains all your projects and settings, such as the colors used for syntax highlighting, font size, etc. You can't work in Eclipse outside of a workspace. The first time you start Eclipse, it prompts you for a default location for your workspace. You can create a new workspace or switch to a different workspace any time by choosing File > Switch Workspace > Other. In the dialog box that opens, you can type the location of an existing workspace or type a different location to create a new workspace there. The dialog also offers the option to copy settings to the new workspace. However, this is a misnomer because the option only copies the window layouts and working sets and not things like colors of syntax highlighting, font-size templates, etc. You probably want all these settings to be copied to your new workspace because it can be a pain to reconfigure the many settings you may have configured in your existing workspace. Thankfully, Eclipse offers an easy way to copy all the settings to the new workspace:
- Choose File > Export.
- In the resulting dialog, select General > Preferences, then click Next.
- Select Export All, provide a path to the file as shown in Figure 4, and click Finish. All the settings of your workspace are saved to the file you specified.
- Switch to your new workspace, choose File > Import, and select General > Preferences.
- Point to the file to which you just saved the settings and click Finish. Your settings are imported into the new workspace.
Figure 4. Creating or switching workspaces
The .metadata directory, located in your workspace directory, contains all the settings stored by the various plug-ins within Eclipse. The presence of this directory tells Eclipse that the current directory is a valid workspace. The .metadata directory also contains a file named .log. This file contains all the errors or exceptions that might have been thrown while running Eclipse. It can be useful for diagnosis if Eclipse crashes unexpectedly at some point.
Projects, in Eclipse terminology, can be individual apps or modules, depending on how you choose to organize your workspaces. To create a new Java™ project, choose File > New > Project. In the resulting dialog box, choose Java > Java Project.
Many newcomers are confused by the Project name text box located in this dialog (see Figure 5). You use this to filter the list of different kinds of projects, not to name your project. Select the Java Project item from the tree and click Next to go to the next step in the wizard. Here, you can name your project and configure its settings.
Figure 5. Creating a Java project
The JRE group in the middle of the Create Java Project dialog lets you select the version of Java used to build this project. The Project Layout group indicates whether you want to place both the source and the generated class files in one folder or have separate folders for each. It's recommended that you leave the default setting: Create separate folders for sources and class files. This way, you have a nice separation between your code and the generated binaries. Click Finish, and a new folder with the name of your project is created in the workspace directory. The project folder contains two folders called src and bin for your source and class files, respectively. You work exclusively in the src folder; the bin folder is managed by Eclipse to generate class files automatically in the background.
Customize your toolbars and menus
You can customize the toolbar and menu bar at the top of the Eclipse window to your liking. The toolbars and menu bar are configured on a per-perspective basis. Perspectives are an Eclipse way of grouping the layout of the various views, toolbars, and menus according to the specific task you're doing. For example, by default, Eclipse has perspectives called Java and Debug for developing Java code and debugging, respectively. The Debug perspective has views and toolbar buttons specifically for use while debugging; the Java perspective doesn't have them. You can switch perspectives by choosing Window > Open Perspective > Other or by clicking the buttons at far right on the toolbar.
Figure 6. Buttons at right on the toolbar let you switch perspectives
To customize the toolbars and menus of a perspective, right-click the main toolbar at the top and select Customize Perspective, then click the Commands tab. Here, the various menu/toolbar items are grouped by functionality, as shown in Figure 7. For example, you can select the Search list item to enable the menu and toolbar items related to search. (Eclipse calls the toolbar and menu items commands, as in commands given to the IDE; thus, the tab is labeled Commands, and you can enable/disable command groups.)
Figure 7. Customizing toolbar and menu-bar items
Customize your Eclipse preferences
Eclipse is a large, complex IDE with many, many plug-ins, and it offers a host of options you can customize. Fortunately, they're all found in a central location. Choose Window > Preferences to open the Preferences dialog box.
Figure 8. Preferences dialog box
This dialog contains a big tree of options you can customize. Sometimes, it can be difficult to remember exactly where the setting you want to change is located. Fortunately, you can type in the text field at the top to filter the giant tree of options. For example, typing fonts in the box immediately filters the tree to show only the items related to fonts. The next section shows how to change some common settings.
Choose General > Appearance > Colors and Fonts (see Figure 9). From here, you can change the font of every portion of the Eclipse UI. For example, to change the font of the Java editor:
- In the Preferences dialog, select Java > Java Editor Text Font.
- Click Change.
- Select the font and size you want.
- Click Apply.
Figure 9. Changing fonts
Choose General > Keys in the Preferences dialog box (see Figure 10). From here, you can assign/change the keyboard shortcut for every Eclipse command. For example, to change the shortcut for the Step Over command:
- Type
Step Overin the text field. - Select the Step Over command from the list, which is now filtered.
- In the Binding box, press the new keyboard shortcut. Note that you don't have
to type the shortcut — just press the keys. For example, to assign
F2to the command, press the F2 key. - If the new shortcut conflicts with any existing keyboard shortcut, it's shown in the Conflicts list.
- When you've finished changing shortcuts, click OK.
Figure 10. Changing keyboard shortcuts
You've had a good look at the various parts of the Eclipse IDE. You now understand what an Eclipse workbench is and the parts it comprises. You know what workspaces and projects are, their differences, and how they relate to each other. You also know how to customize parts of the IDE to your liking and how to export those settings from one workspace to the other. Part 2 explains how to work with Java projects and the Eclipse Java Development Environment (JDT).
Learn
-
Find more information in the Workbench User Guide
in Eclipse Help, an Eclipse Foundation resource.
-
Read the "Migrating
to Eclipse" series if you're switching from other IDEs to Eclipse.
-
Check out Eclipse IDE Pocket Guide.
-
Visit the official Eclipse FAQs.
-
Read Eclipse for Dummies.
-
Be sure to read Eclipse Distilled.
-
Check out the "Recommended Eclipse reading list."
-
Browse all the Eclipse content on developerWorks.
-
New to Eclipse? Read the developerWorks article "Get started with Eclipse Platform" to learn its origin and architecture, and how to extend Eclipse with plug-ins.
-
Expand your Eclipse skills by checking out IBM developerWorks' Eclipse project resources.
-
To listen to interesting interviews and discussions for software developers, check out check out developerWorks podcasts.
-
Stay current with developerWorks' Technical events and webcasts.
-
Watch and learn about IBM and open source technologies and product functions with the no-cost developerWorks On demand demos.
-
Check out upcoming conferences, trade shows, webcasts, and other Events around the world that are of interest to IBM open source developers.
-
Visit the developerWorks Open source zone for extensive how-to information, tools, and project updates to help you develop with open source technologies and use them with IBM's products.
Get products and technologies
-
Check out the latest Eclipse technology downloads at IBM alphaWorks.
-
Download Eclipse Platform and other projects from the Eclipse Foundation.
-
Download IBM product evaluation versions, and get your hands on application development tools and middleware products from DB2®, Lotus®, Rational®, Tivoli®, and WebSphere®.
-
Innovate your next open source development project with IBM trial software, available for download or on DVD.
Discuss
-
The Eclipse Platform newsgroups should be your first stop to discuss questions regarding Eclipse. (Selecting this will launch your default Usenet news reader application and open eclipse.platform.)
-
The Eclipse newsgroups has many resources for people interested in using and extending Eclipse.
-
Participate in developerWorks blogs and get involved in the developerWorks community.

Prashant Deva is the founder of Placid Systems and the author of the ANTLR Studio plug-in for Eclipse. He also provides consulting related to ANTLR and Eclipse plug-in development. He has written several articles related to ANTLR and Eclipse plug-ins, and he frequently contributes ideas and bug reports to Eclipse development teams. He is currently busy creating the next great developer tool.
Comments (Undergoing maintenance)





