The Difference between Views and Editors in Eclipse IDE for Java Development
You may have difficulty understanding the difference between views and editors when using Eclipse for Java development. If views and editors seem the same to you, and you’re not sure whether you can tell which is which, don’t be upset.
When you’re an ordinary Eclipse user, the distinction between views and editors comes naturally as you gain experience using the workbench. You rarely have to decide whether the thing you’re using is a view or an editor.
Anyway, if you ever have to distinguish between a view and an editor, here’s what you need to know:
View: A part of the Eclipse workbench that displays information for you to browse. In the simplest case, a view fills up an area in the workbench.
You can use a view to make changes. For example, to delete MyFirstProject in the figure, right-click the MyFirstProject branch in the Package Explorer view. (On a Mac, control-click the MyFirstProject branch.) Then on the resulting context menu, choose Delete.
When you use a view to change something, the change takes place immediately. For example, when you choose Delete in the Package Explorer’s context menu, whatever item you’ve selected is deleted immediately. In a way, this behavior is nothing new. The same kind of thing happens when you recycle a file using Windows Explorer or trash a file using the Macintosh Finder.
Editor: A part of the Eclipse workbench that displays information for you to modify. A typical editor displays information in the form of text. This text can be the contents of a file.
An area of the Eclipse workbench might contain several views or several editors. Most Eclipse users get along fine without giving this “several views” business a second thought (or even a first thought). But if you care about the terminology surrounding tabs and active views, here’s the scoop:
Tab: Something that’s impossible to describe except by calling it a “tab.” That which we call a tab by any other name would move us as well from one view to another or from one editor to another. The important thing is, views can be stacked on top of one another.
Eclipse displays stacked views as though they’re pages in a tabbed notebook. For example, this figure displays one area of the Eclipse workbench. The area contains six views (Problems view, Javadoc view, Declaration view, Search view, Console view, and LogCat view). Each view has its own tab.
The Console view is shown in the figure, but it doesn’t always appear as part of the Java perspective. Normally, the Console view appears automatically whenever the program crashes. If you want to force the Console view to appear, choose Window→Show View→Other. In the resulting Show View dialog box, expand the General branch. Finally, within that General branch, double-click the Console item.
A bunch of stacked views is a tab group. To bring a view in the stack to the forefront, you click that view’s tab.
By the way, all this information about tabs and views holds true for tabs and editors. The only interesting thing is the way Eclipse uses the word editor. In Eclipse, each tabbed page of the Editor area is an individual editor.
For example, the Editor area shown in this figure contains three editors (not three tabs belonging to a single editor). The three editors display the contents of three files: MyFirstJavaClass.java, MortgageWindow.java, and activity_main.xml.
Active view or active editor: In a tab group, the active view or editor refers to the view or editor that’s in front.
In the figure, the MyFirstJavaClass.java editor is the active editor. The MortgageWindow.java and activity_main.xml editors are inactive. (The activity_main.xml looks as though it’s active, but that’s because, in the figure, the mouse is hovering over that editor’s tab.)