## The Ambient Perspective

Now that you have checked out your first project, you should familiarize yourself with the workbench. You should see the Ambient perspective (notice the name "Ambient" in the title bar). If this is not the case, you should switch to this perspective by selecting the Ambient in the perpective list.

### Elements of the workbench

There are six main parts that are of concern for you:
1. menubar at the top of the window
- it includes the Ambient menu, which should become very handy
2. toolbar underneath the menubar
- it provides shortcuts to functions in the menubar that have been symbolized with icons
3. Ambient Package Explorer on the left side
- displays all projects in your workspace
4. Outline view on the bottom left side
- this will show the full structure of classes, methods, and variables in whichever file is currently selected.
5. editor on the right side
6. console window on the bottom
- will display output and allow for input when you run programs

### Using the Ambient Package Explorer

At first, you should only see one object (probably called "project1") with a little plus sign in front of it. Click on the plus sign to expand the object and see the objects it contains. Do this to all children until the view is completely expanded. You should now see that there are some classes listed in the default package. Notice also that you can see an outline of the class. All data members and methods are displayed. In order to open a class or a specific method, simply double-click on its name.

### Using the Java Editor

A Java editor containing the file you just selected should have opened up in the editor area on the right side. Please select Ambient Perspective (alternatively you may press Ctrl + Alt + P) again. This should hide some of the menus you do not need. Using the editor is just like using any text editor. However, there are some additional features that should help you write programs.
1. Syntax highlighting

> By default, the editor analyzes your code and highlights certain elements to make it easier to read. For example, it highlights keywords in purple, comments in light blue or light green, and strings in blue.

2. Error detection

> When the editor finds an expression that it does not know how to evaluate, it will underline it with a red line. You might not be able to run a program before all errors are fixed. If the editor thinks a line is unnecessary, it will underline it in yellow.

3. Quickfix

> Usually, when the editor detects an error, it will also attempt to present you with a solution. To do so, the editor will display a yellow light blub on the left edge of the line in which the error occured. Clicking on the bulb once will open a menu that will offer you different solutions. Selecting one of these solutions will immediately alter your code (however, you can always undo the changes).

4. Formatting your code

> Formatting your code is not only good programming practice but will also help you determine the location of errors. Fortunately, Eclipse has a functionality that will allow you to automatically format your code. To do so select Ambient > Format Code (alternatively you may press Ctrl + Shift + F).

5. Organizing Imports

> Java comes with a wealth of predefined classes that you can use. To do so, you will have to import the classes so your Java compiler knows about them. Ordinarily this involves looking up where these classes are located. This is not the case in Eclipse. If you are using a class that Eclipse does not recognize, simply select Ambient > Organize Imports (alternatively you may press Ctrl + Shirt + O). Eclipse will automatically import all required classes, if they exist.

6. Using auto-completion features

> There are two coding features that should make your life a lot easier.
> 1. Type a keyword or part of a keyword and press Ctrl + Space. Eclipse will show you a list of elements that you may wish to use. For example, if you type "for" and press the two keys simultaneously, it will show you a list of predefined for loops. Selecting one of them will insert the loop into your code.
> 2. When using member methods or data members of classes, we use the dot operator in Java (e.g., MyFirstClass.printHelloWorld()). Oftentimes we know that there is a method we would like to use, but we cannot remember its exact name. If you are not sure, simple type the name of the object you are working with followed by a period and wait for a moment. A list will appear that shows all members that you may use.