DOC

Chapter 4[1]. Customizing Your Workbench

By Sam Price,2014-03-29 16:15
17 views 0
Chapter 4[1]. Customizing Your Workbench

    Chapter 4. Customizing Your Workbench

    Course points

    ; Use multiple perspectives to organize task-specific views

    ; Create new perspectives for your unique development tasks and work style

    ; Choose from the many views and editors provided by Eclipse

    ; Set preferences to fit your individual needs and work habits

    ; Set preferences shared by your project team

    Reading

    4.1. Perspectives

    Each perspective simply defines a collection of Eclipse views and action sets organized in a

    layout that suits its assigned task for a typical user.

    Eight perspectives are defined in the standard Eclipse SDK download: Resource. This is the default perspective when opening Eclipse and is useful for browsing all workspace resources; that is, projects and their contents. Java. Primary views and menu/toolbar commands used during Java development. Java Browsing. Very useful for exploring large projects; contains views for projects, packages, types, and members.

    Java Type Hierarchy. Includes a subset of the Java perspective used to explore class inheritance.

    Debug. Views used while debugging your Java programs.

    CVS Repository Exploring. Used while opening and exploring CVS repositories, especially when discovering shared projects to be imported into your workspace. Team Synchronizing. Used while synchronizing your file modifications with a CVS (or other) version control repository.

    Plug-in Development. Specialized views used while developing new plug-in contributions for Eclipse.

    The perspective bar is similar to a standard toolbar, but it is specialized to show an icon for each perspective that is open in your workbench. A perspective bar with four open perspectives is shown in Figure 4-1.

Figure 4-1. Eclipse perspective bar with four open perspectives. The Java perspective is currently

    displayed.

    Tip: Don't hesitate to jump in and customize the content or layout of your Eclipse

    perspectives! After you experiment with adding, removing, or rearranging views, you

    can restore the default view selection and layout of the current perspective by selecting

    Window > Reset Perspective.

    4.2. Workbench Views

    A view displays information about the contents of your workbench. A view might appear by itself or stacked with other views in a tabbed notebook. You can change the layout of a perspective by opening and closing views and by docking them in different positions in the workbench window.

    The views available within your workbench are organized into named categories such as Basic, Java, Debug, Ant, and Team. To see a complete list of views, select Window > Show View > Other…. The most commonly used views from the Basic category are

    Navigator. Displays a general-purpose view of projects, folders, and files in your current workspace; useful in any perspective.

    Properties. Customized by workbench plug-ins to display and edit name/value properties for any resource or object.

    Outline. Customized by plug-ins to display a structural view of resource contents. For example, it can display an outline of methods in a Java class file.

    Problems. Displays a list of problems found in a resource; for example, compilation errors and warnings in a Java file.

    Tasks. Displays a list of tasks to be performed, along with a reference to the resource and line number for each task.

    Bookmarks. Displays bookmarks for quick reference and navigation to specific lines in a file.

    Search. Displays results of searching your workspace.

    The view toolbar for the Package Explorer is shown in Figure 4-3.

    Figure 4-3. View toolbar and menu for the Package Explorer

    4.2.1. Marker Views

    Three of these basic views have related behavior: Problems, Tasks , and Bookmarks all display a list of markers, where each marker is linked to one line in a file. Filter commands are available in many Eclipse views to help you cope with information overload. The Navigator view can filter the resources that are displayed, and the Problems, Tasks , and Bookmarks views filter the markers that are displayed. All of these filters are useful as your projects grow in size and complexity. To set a view's filters, select the Filters…

    toolbar icon or menu. (show view->Task->?->config filters)The filter dialog for the

    Problems view is shown in Figure 4-4.

    Figure 4-4. Filtering contents of the Problems view

    Filters for the Tasks and Bookmarks views are similar to those for the Problems view, except that the Problems view may be filtered by severity, whereas Task markers may be iltered by priority and status. f

    The Tasks view includes a helpful customization for Java developers. When a Java project is built, the parser automatically scans for Java task tags in your code comments. You can configure the task tag names and their priorities using the Java > Task Tags preferences, as shown in Figure 4-5. Three tags are provided by default (FIXME, TODO, and XXX).

    Figure 4-5. Add a new Java task tag for user stories.

    The right margin of your Java editor displays small blue rectangles indicating the location of task markers. As shown in Figure 4-6

    Figure 4-6. Tasks view showing STORY and TODO tasks.

    4.2.2. View Layout

    Adding, removing, and repositioning views in your perspectives is quick and intuitive. To add a view, select the Window > Show View menu.

    To move a view, click the left mouse button on the view tab and drag it to the desired location. Release the mouse when finished.

    Any view may be set to display as a fast view. All fast views are displayed as icons on the fast view bar, as shown on the bottom of your workbench in Figure 4-7.

    Figure 4-7. Fast view bar with three views. The Tasks view has horizontal orientation. 4.3. Resource Editors

    As a Java developer, most of your time will be spent in the Java file editor. This editor provides menu and toolbar commands, syntax highlighting, and many other features that are customized for Java source code files. But other editors are also available. Double-clicking on a file in the Navigator view will open the default editor. Or, as shown in Figure 4-8, select the Open With context menu and pick one of the other editors that are available.

    Figure 4-8. Pick an editor from those available for the selected resource.

    4.4. Preferences: Have It Your Way

    4.4.1. Scope of Preference Settings

    Most preference settings are limited to the current workspace. If you have several workspaces for your projects, each will have separate preference settings. However, this is not always desirable. You may want to use the same preferences for several workspaces, or you may want unique preferences for individual projects in a workspace.

    To accommodate this, Eclipse defines three preference scopes:

    Configuration. These preference settings are saved in your Eclipse installation directory and are shared by all workspace instances.

    Workspace Instance. Each workspace instance defines preferences shared by all of its projects. This is the default preference scope.

    Project. Some preference settings may be limited to one project.

    If unspecified, the preference scope is probably limited to your current workspace. 4.4.2. Sharing Your Preferences

    Share your hard work with others! Contribute your preferences as best practices for your project team or jump-start new team members with coding styles that are unique to your tools and design.

    You can export all of your workspace preference settings by pressing the Export… button (File->Export)on the Preferences dialog, as shown in Figure 4-9. You can then import these into another workspace by opening that workspace in a new Eclipse workbench and pressing the Import… button in this dialog. To share them with your team.

4.5. Individual and Team Preferences

    4.5.1. Individual Preferences

    The following list is not an exhaustive summary of individual preference categories, but it gives you a starting point when considering your alternatives.

    ; Keyboard shortcuts

    ; Workbench and editor appearance, colors, and font

    ; Perspective layout and view selection

    ; View filters

    ; Linked resource locations

    4.5.2. Team Preferences

    Team preferences are equally beneficial to individual developers, but they also have an impact on coordinated teamwork and shared code.

    ; Code style and format

    ; Code templates

    ; Comment templates

    ; Task tags

    ; Java JRE version (1.3, 1.4, or 1.5)

    ; Compiler options (flagging errors and warning)

    ; Team file content types (e.g., binary or text)

3.4. Distilled

    ; Don't get tunnel vision within one perspective and try to force all of your work into a

    single set of views. Take advantage of using several perspectives, where each is

    organized to maximize productivity for related tasks. Create or customize perspectives

    to fit your needs. 1

    ; Explore the range of specialized views that are available in Eclipse. Using the right

    view or set of views can increase your productivity significantly. 2

    ; Use filters in the Package Explorer view and the marker views (Problems,Tasks , and

    Bookmarks) to cope with information overload. 3

    ; Personalize Eclipse to fit your style and work. Match your habits from other editors or

    IDEs and explore the many options in Eclipse. 4

    ; Share your best practices and team standards with all members by exporting

    preferences and sharing project settings. 5

    New Words and Phrases

    ; New words

    ; Phrases

    Notes

    ; Don't get tunnel vision within one perspective and try to force all of your work into a

    single set of views. Take advantage of using several perspectives, where each is

    organized to maximize productivity for related tasks. Create or customize perspectives

    to fit your needs. 1

    不要局限在一个视图中?要把所有工作集中在一组窗口中。利用多个视图?把它

    们组织起来?发挥它们最大生产力来完成一组相关的任务。创建或定制视图来满

    足你的需要。

    ; Explore the range of specialized views that are available in Eclipse. Using the right

    view or set of views can increase your productivity significantly. 2

    探讨Eclipse中可用的专门窗口。使用一个适合的窗口或一组窗口可以显著的提

    高你的生产力。

    ; Use filters in the Package Explorer view and the marker views (Problems,Tasks , and

    Bookmarks) to cope with information overload. 3

    Package Exlporer窗口和标记窗口中的过滤器可以解决信息过多的问题。

    ; Personalize Eclipse to fit your style and work. Match your habits from other editors or

    IDEs and explore the many options in Eclipse. 4

    使Eclipse个人化?以适应你的风格和工作。与你使用其他编辑器或IDE的习惯

    相匹配?探讨Eclipse中的更多选项。

    ; Share your best practices and team standards with all members by exporting

    preferences and sharing project settings. 5

    导出首选项?共享项目设置?可以与所有成员共享尼最好的实践经验和小组标准。

Report this document

For any questions or suggestions please email
cust-service@docsford.com