Tuesday, July 21, 2009

Eclipse 3.5 Hidden Treasures

Small note: The shortcuts in this article work on Windows. On Mac, substitute the Ctrl with Command (the Apple key) unless stated otherwise.

The Eclipse Platform

Mac Cocoa Support

For me, that was one of the most substantial change, since I am a Mac user. Read more about the new Cocoa flavor of Eclipse in my previous article.

Plugin Installation

Plugin installation was completely redesigned in Galileo. While writing this article I found I had just too much to say about it, so I wrote this article which is dedicated to the plugin installation.

Open Resource: "Open With" Options

Open-withThe Open Resource dialog (Ctrl-R) is one of the most useful tools in Eclipse. Simply start typing a name of a file and find it in seconds. There's an important improvement in Galileo: the ability to right-click a file in the list and ask to open it with a different editor.

I hope the next feature added will be to reveal the file in the package explorer.

Better Toolbar & Menu Customization

Toolbar-customization UI Customization received A major improvement in Galileo: you can finally select which buttons/commands will appear in the toolbar/menu. In previous versions, it was possible to disable or enable groups of commands. Now, buttons and menu options are controlled individually.

To customize your toolbar, right-click on the toolbar and select Customize Perspective. There are two new tabs here: Tool Bar Visibility and Menu Visibility. These allow controlling individual items in the toolbar and menu.

Block Selection

Galileo introduces Block Selection (sometime called discontinuous selection): the ability to select a box of text regardless of the line breaks or any other white-spaces. I think the implementation leaves room for improvements, but it is nice to see it anyway.

Block-selection To use it, one must toggle Block Selection Mode (Alt+Shift+A / Option+Command+A). The cursor changes and you may now select any block of text. Copy/Paste works pretty much as expected. However, if you paste a couple of lines and wish to undo the paste, you will need to hit Undo for each line pasted (although it was one action). Typing and deleting characters works nicely, enabling you to instantly add text at the same position for a number of characters.

The Block Selection Mode can also be used from a toolbar button. If you do not have it, go to the Customize Perspective dialog and enable the Command Group called Editor Presentation (you may hide the other buttons, see previous section).

Java Development Tools (JDT)

It seems like the JDT is reaching a saturation point. It is a very good tool as it is and, perhaps, not much can be added. I am biased here, since I do offer a tool which greatly enhances the productivity of JDT called nWire.

Debug View as Breadcrumbs

For me, this is the most noticeable UI change in JDT. It revolutionized the organization of my Debug Perspective. The idea is that the Debug view, which shows the running processes and threads, can be shown as a collapsible Breadcrumbs rather than a full tree. This means it could be minimized and the space may be utilized for other views.

Debug-view-setting Here's how you do it:

  1. Switch to the Debug Perspective.
  2. In the Debug View, click on the toolbar menu (a small triangle at the right side).
  3. Select Layout -> Breadcrumb.
  4. Move the view on top of the files, and reduce its' height.
  5. If you still need to see the entire tree, just click on the breadcrumbs.
It takes a little time to get used to, but once you, you won't look back.

Debug-view-in-action

toString() Generator

Tostring-generator We've been waiting for that for some time now. Actually, I was using a 3rd party plugin to generate my toString methods. Nevertheless, the implementation of the toString generator in Galileo is highly customizable and I find it very useful.

To use it, From the Source menu select Generate toString()... You can controls the template, select methods to be included and more. A great little tool.

Outline in Compare Editor

Compare-outline The Compare Editor, which opens when comparing files (e.g. a file to a previous revision), was revamped in Galileo, adding all kinds of abilities which were only available in the regular Java editor. From all the features, I found the Quick Outline (Ctrl+O) to be the most useful. It makes browsing the file a lot quicker.

Plug-in Development Environment (PDE)

Targets Management

In PDE, the Target Platform is the Runtime which will be used when launching your plugins from PDE (for testing and debugging). By default, it is your currently running Eclipse. However, you may change it to other installed Eclipse instances, which allows you to develop on one Eclipse version and test on another.

Target-state There are 2 new tools in Galileo which makes managing your platform a relatively simple task. First, there's the Target Platform State view. It is a bit like the Plugin Registry, however, instead of showing your current platform state, it shows the details of your target platform. You can easily see which plugins will be included and where they are installed.

Target-preferences The second addition is the Target Platform Preferences Page which allows adding and changing platforms. In the previous Eclipse versions, Target Platforms were determined by a target file. This is still possible in Galileo, but you may also define targets using the preferences. The creation of platforms has also been improved.

Plug-in Spy for Menu Items

Plugin-spy-menu I mentioned the Plug-in Spy (Alt+Shift+F1) last year: it is a great little feature which quickly reveals which class and plug-in stands behind each UI element. It is very useful for finding the right example to learn from when developing Eclipse Plug-ins and RCP applications.

The Plug-in Spy just got better, enabling inspecting menu items. Click Alt+Shift+F2 (Option+Shift+F2 on OS X) and then select a menu option to see its' implementation details.

In this example, I selected Navigate -> Open Type. There are active links to the source code and plugin.xml file. Using the item identifier you can find the item definition. It is very useful in case you want to add another after an existing item.

The P2 Publisher

This is a very well hidden treasure. The P2 Publisher is being used behind the scenes for building plugins, features, P2 repository metadata and update sites. For me, it has one important goal: enable headless PDE builds.

The build process in PDE was very complex up until now. Creating a script that will automate it end-to-end required quite a bit of research and too much work. The P2 Publisher solves this and becomes the one stop shop for automated PDE builds. My experiments with this tool are limited, but it does show a lot of potential. You can start reading about it here.

From http://blog.zvikico.com

No comments:

Post a Comment