1.4 Views and Perspectives


When you're working with the workbench, you'll see a number of different internal windows , called views , and the idea is that they give you different "views" into your projects. For example, one view may give you an overview of the Java classes in your project, while another may let you navigate between projects. For example, back in Figure 1-1, you can see the Navigator view at the upper left in Eclipsethis is the view that will display all your projects and let you move from one to another.

Because screen space is always at a premium in GUIs, views are often stacked, one on top of another, and you select the one you want to see using tabs that appear on the edge of the stacked views.

If you ever want to reopen a view you've closed by mistake, select Window Show View, and select the view you want from the menu that appears.

The editor is one special type of window that usually appears in the center of the workbench. When you open up documents, code, or resources, they'll appear in an editor. Eclipse automatically selects the correct type of editor for the item you're opening: the Java editor for a Java source code file, a GUI you're developing using a plug-in with the editor supplied by the plug-in, and so on. You can even open Microsoft Word documents in the Editor (Eclipse displays an MS Word window in the editor space using Windows Object Linking and Embedding, OLE). In Figure 1-1, the space normally reserved for editors is showing the Eclipse Welcome text.

The editor window is where you do most of the work when developing your code; for example, it's where you enter and edit your code. As we're going to see, the JDT has an editor that is lavish with built-in details, such as syntax checking, code highlighting, and much more. You might have several editors open at once, in which case they'll be stacked with tabs showing at the top of the stack, and you can pick out the one you want by clicking the corresponding tab (or with the Window Switch to Editor menu item, which displays a list of editors you can switch to). You can close an editor simply by clicking the X in its associated tab (or with the Window Hide Editors menu item, which toggles to Window Show Editors after hiding an editor). To sum up: views give you overviews of your projects, and editors let you develop code and resources.

There's one more concept to master here as well: perspectives . You don't normally decide what views and editors to display yourself; instead, they're organized into groups called perspectives (although it is easy to customize perspectives yourself). For example, when you create a Java application, you'll use the Java perspective; when you want to debug a Java program, you'll use the Debug perspective.

Perspectives have a predefined set of views and editors built-in; when you select a perspective, that set of views and editors appears automatically. For example, we'll take a look at the Java perspective here: to select a perspective, you use the Window Open Perspective menu item, which displays a submenu of the installed perspectives. In this case, we'll choose the Window Open Perspective Java menu item to open the Java perspective, shown in Figure 1-4.

Figure 1-4. The Java perspective

This perspective presents an editor, which appears in the center pane, that lets you write Java code, as well as show several views. For example, the Package Explorer view you see at left gives you an overview of the Java packages and classes in a project, and it lets you move between them. When you debug a Java application, the workbench makes the Debug perspective appear, which you see in Figure 1-5. This perspective displays the code you're debugging, where you are in the program, the values of variables and expressions you want to watch, and so on, in various views.

Figure 1-5. The Debug perspective

Much of the time, the idea of views, editors, and perspectives is transparent to the user , and that's certainly the case when you master Eclipse and use it on a daily basis. But they're important concepts for us and ones we'll be referring to by name throughout the book.

Now that we're fortified with the concepts and overview that we need, it's time to start actually working with Eclipse. Although Eclipse is a universal tool platform, its great popularity comes from developing Java code, and we're going to put it to work doing that here. When you first start Eclipse, you'll see the Resource perspective, which is the default perspective for developing general resources. But when we put Eclipse to work in this book, we're going to switch to the Java perspective and start developing some code.

ISBN: 0596006411
EAN: 2147483647
Year: 2006
Pages: 114
Authors: Steve Holzner

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net