Saturday 31 December 2011

Eclipse UI Overview for Selenium automation


3. Eclipse UI Overview

Eclipse provides PerspectivesViews and EditorsViews and Editors are grouped intoPerspectives. All projects are located in a workspace.

3.1. Workspace

The workspace is the physical location (file path) you are working in. You can choose the workspace during startup of Eclipse or via the menu ( File → Switch Workspace → Others. All your projects, source files, images and other artifacts will be stored and saved in your workspace.
You can predefine the workspace via the startup parameter -data path_to_workspace, e.g.c:\eclipse.exe -data "c:\temp".
Please note that you have to put the path name into double quotes.
To see the current workspace directory in the title of Eclipse use -showLocation as an additional parameter.

3.2. Perspective

Perspective is a visual container for a set of Views and Editors.
You can change the layout and content within a Perspective, for example by opening or closing Views orEditors, changing their size and position and more. Eclipse allows you to switch to another perspective via the menu Window → Open Perspective → Other.
For Java development you usually use the Java Perspective, but Eclipse has much more predefinedPerspectives, e.g. Debug, Git Repositories, CVS Repositories.
A common problem is that you mis-configured your Perspective, e.g. by closing a View. You can reset aPerspective to its original state via the menu Window → Reset Perspective.

3.3. Views and Editors

View is typically used to navigate a hierarchy of information or to open an Editor. Changes in a View are directly applied to the underlying data structure.
Editors are used to modify elements and are typically text editors. An Editor can have code completion, undo / redo, etc. To apply the changes in an editor to the underlying resource, e.g. Java source file, you have to save.

3.4. Java Perspective and Package Explorer

The default Perspective for Java development can be opened via Window → Open Perspective → Java.
On the left hand side, this perspective shows the "Package Explorer" View which allows to browse your Java projects and to select the components you want to work on via double-click.
For example to open a Java source file, open the tree under src, select the corresponding .java file and double-click it. This will open the file in an Editor.
The following picture shows the Eclipse IDE in its standard Java perspective. The "Package Explorer" is on the left. In the middle you have the open Editor for a Java source file. If several Editors would be open, they would be stacked in the same place and you could switch between them by clicking on the next Editor. All editors share the same part of the Eclipse IDE; this part is called the "editor area".
To the right and below the editor area you find more Views which were considered useful by the developer of the perspective. For example the "Console" view shows the output of System.out statements in your code.

3.5. Linking the package explorer with the code editor

The Package Explorer allows displaying the associated file from the currently selected editor. For example if you working on Foo.java and you change in the editor to Var.java then the corresponding file will be selected in the the "Package explorer" View.
To activate this behavior, press the button "Link with Editor" in the "Package explorer" View.

Synchronize the project explorer with the current selected editor

3.6. Problems view

Sooner or later you will run into problems with your code or your project setup. To view the problems in your project you can use the "Problems" View which is part of the standard Java Perspective. If it is closed you can open it viaWindows → Show View → Problems.

Opening the problems view

You can configure the content of the "Problems" View. For example, to display the problems from the currently selected project, select "Configure Contents" and set the Scope to "On any element in the same project".

Configuring the problems view


Configuring the problems view