Eclipse 3.6 Hidden Treasures
Join the DZone community and get the full member experience.Join For Free
eclipse 3.6, aka helios , was released about a month ago. it has become a tradition: this is the time i highlight some of my favorite hidden features in the new release. i focus my article on features which are less obvious, off the beaten path. features you might not be familiar with if you didn't take the time to read the "new and noteworthy" for this release .
if you haven't done so already, you are invited to read my posts for eclipse 3.4 (ganymede) and eclipse 3.5 (galileo) (which won the galileo blogathon ). you can probably pick up some new tricks there as well. i also took the time to reiterate on some of my favorite shortcuts, which made this article a tad longer.
as always, if you are familiar with more features which are hidden and worthy, please let me know in the comments.
the eclipse platform
projects in eclipse are associated with a root folder. all the file hierarchy of this folder is included in the project. this hierarchy is visible in the navigator view. in helios, you may selectively filter out files and folders from your project. for example, if your operating system creates extra files (like those pesky .ds_store files in os x or thumbs.db in windows) you don't need in your project, filter them out. right click on a project or folder, select properties and look under resource → resource filters .
opening a file from the command line
eclipse is a powerful ide. it is a perfect companion when working on a large projects. however, for most people, it does not replace the conventional text editor for more casual work like composing htmls, tweaking csss or going over xmls. i'm guessing that the reasons for that are rooted in the original eclipse concept: working only on files within your projects. in older versions it was very difficult to open just any file from the file system in eclipse for editing.
the situation today is very different. you can drop a file directly into eclipse, but that was possible in galileo. in helios, there's a new addition which enables opening a file directly from the command line. this opens the door to associating files with eclipse. for example, you can double click an html file in your operating system and open it in eclipse for editing. it will require a bit of hacking, but it is worth it. to get started, visit this page .
learn keyboard shortcuts with quick access
the quick access feature is one of my favorite features in eclipse. it acts like a universal launcher: hit ctrl+3 (or cmd+3 ) and start typing the name of a command, view, perspective or any other ui element that can be invoked. it's a very quick way for launching commands without ever leaving your keyboard.
this very handy feature just became even more useful: it now shows keyboard shortcuts within the view. this makes it a perfect tool for learning and memorizing keyboard shortcuts. for example, what is the keyboard shortcut for switching to the next editor? you could look it up in the menu or preferences, but that takes too much time. besides, if you reach for the mouse you'll probably end up just selecting the next editor. instead, hit ctrl+3 , type "next editor" and you will learn that the shortcut is ctrl+f6 .
many eclipse users use more than one workspace. i often find myself switching and even working with multiple instances of eclipse running different workspaces. helios introduces a handy little feature which lets you assign a name to your workspace. this name will appear first in the window title, before the perspective name and current file name. the options is available in the preferences , under general → workspace .
the jdt (java development tools) is one of the oldest projects of eclipse. no doubt, it is getting better, not older. i do wish there was a bit more innovation. well, that opens the door to innovative tools like nwire for java .
package name abbreviations
here's a common scenario: you are using the package or project explorer, and view the packages in a flat view. that's probably the most convenient way to look at your source tree. with one major drawback: the package names are usually too long which leads to either excessive horizontal scrolling or a wider side bar that takes too much screen real-estate.
helios solves this problem: you can assign abbreviations and shorten the list. in the preferences , under java → appearance . for example, org.eclipse.ui can be shown as [ui]. this applies to the project sources and included jars as well.
more preferences import/export
copying preferences between workspaces is a challenge in eclipse. one of the critically overlooked feature is eclipse is the ability to export and import preferences. you start with file → export and select general → preferences . now, you get a list of preferences sets that can be selected to export. import works quite similar.
unfortunately, many preferences are missing. in order to support this feature, each plugin need to specifically "ask" for it and not many do. in helios, jdt adds support for exporting/importing the java appearance, code style and compiler preferences. this is a neat feature which makes backing up and sharing preferences much easier.
variable instance count in java 1.6
now for a little debugger upgrade. the debugging perspective has the very useful variables view . it is often neglected, but this view has more information to offer. the default columns are name and value. the view has a small drop-down menu on the top-right corner. by selecting layout → columns → select columns.. . you can choose which columns are shown.
helios adds a very useful column which shows instance count : the number of instances corresponding to the concrete type of each variable. it requires jvm 1.6 or newer. handy for chasing those pesky memory leaks. this joins the galileo feature of showing a list of instances of a given type: select the type in the editor or outline view, right click, and from the context menu select all instances... . the instance count is available from the same menu as well.
formatter on/off tags
i'm a big fan of save actions since the early days of europa (for more information, read this article ). for those not familiar with the option: it enables certain formatting rules and code clean-ups which will be executed after each save. it works really well for me and i'm simply lost without it.
as much as i like it, there are specific cases where i wish it was off. for example, if i put a little ascii diagram in the comments and don't want the formatter to destroy it by wrapping the lines. helios adds two formatter tags, added as line comments, that turn the formatter on and off. you need to specifically enable this feature under the formatter settings ( java → code style → formatter ), in off/on tags .
it is also interesting to note that in helios you can no longer modify the formatter built-in profiles, you must create your own.
pde (plugin development environment)
feature based launch configurations
this could be a big time saver for people who are serious about plugin development. when launching a plugin for testing and debugging using pde, the default behavior is to load all the plugins of the target platform. this has several drawbacks, mainly, performance. loading less plugins means quicker launch and smaller memory footprint (read my article about this subject ).
there are other scenarios where you might want to start with a partial feature set. for example, for testing, you might want to load jdt but not mylyn. in previous versions, this required going over a list of literally hundreds or plugins and handpicking them one by one. in galileo, you can create launch configurations based on features, which is a big time saver in this case. to get started, edit you launch configuration , under plug-ins , in the launch with field, select features selected below .
this one is for your inner hacker. the equinox osgi implementation, as every plugin developer should now, is the underlying framework of the eclipse platform. in helios, you can open a console and tap into your running platform through the osgi interface. to open an osgi console, open a console view , and from the open console drop-down menu (top-right button) select osgi console .
what can you do with an osgi console? start and stop plugins, check for plugin dependencies issues, install and uninstall plugins, list osgi services and much more. type ? for a list of all possible commands. let the hacking begin.
api use reports
the api use reports have been around for a while, but now they are well integrated and easy to use. these reports describe which apis and internals are being used by other bundles. there are many options for these reports. for example, look at the report of pde against the helios api.
the api use reports are tucked away in the external tools section. to get started, select run → external tools → external tool configurations... select the api use report node and click on new launch configuration .
quick outline in xml/html/css
the eclipse webtools project includes useful editors for many web-related file formats like xml, html and css. this was already a good editor, but it just got even better. the most notable addition is the new quick outline option ( cmd+o or ctrl+o ) which works much like in the java editor, showing a hovering outline of the file with a quick search option. there are more improvements in other areas, including the content assist.
the quick outline may not be such a hidden feature, however, many eclipse users are not familiar with the webtools editors. i recommend checking them out, they are very good.
faster php resolution (plus, a tip on how to make it even faster)
helios includes a new version of pdt (php development tools) : 2.2. apart from some new features on the surface, there are many enhancements behind the scenes. the module responsible for resolving artifacts was redone to improve performance. this affects features like code completion, open type, type hierarchy, etc. if you tried pdt before and wasn't very satisfied with the performance, you should give it another go.
nwire for php , which is based on pdt, also benefits from this performance boost. the new pdt uses the h2 database engine (running locally) to keep all the resolution details, a concept borrowed from nwire. if there's something we learned, is that it is imperative to turn off virus scanning on the db files to keep the performance smooth.
our suggestion is to disable scanning of the entire workspace folder. if you are worried about viruses, the database files are in <workspace root>/.metadata/.plugins/org.eclipse.dltk.core.index.sql.h2/. alternatively, if you can disable scanning by file suffix, disable the files ending with .db.
eclipse helios is a worthy release, filled with hidden gems. if you haven't upgraded yet, now is a perfect time to do so. you can head over to the eclipse downloads page and get helios today.
alternatively, nwire is now offering free downloads of the standard eclipse packages over a highly optimized cdn based on limelight globally available infrastructure. it is a mirror of the eclipse main site, so you get the same packages, only faster. much faster. go get helios today .
Opinions expressed by DZone contributors are their own.