subshell Blog » Eclipse
Stories, tips and tricks from the team at subshell. A software product developer that is specialized in content management systems.
How to use JFace information controls for custom tooltips
Every Java developer who works with the Eclipse IDE knows the helpful JavaDoc tooltips that appear when the mouse cursor hovers over a method or class name in the source code editor. You can click into the tooltip, then move or resize it or navigate inside the JavaDoc to the documentation of other methods and classes. How can we use this feature in our own Eclipse RCP or JFace application?
What to do if Jubula can not map the (custom) SWT control you need for your test?
Jubula is a UI testing tool for eclipse rich client applications. For testing you have to map the SWT controls like text fields, labels, tables, trees or buttons of your application under test (AUT) to Jubula components. After that Jubula is able to find the controls and perform actions like clicking the button or entering text into the textfield. In the end verifications can be done on the controls in the test cases, e.g. whether a label displays the expected text or not.
But what to do if Jubula does not draw this funny green border around the control you need in your test, indicating that you can map it when pressing Ctrl+Shift+Q? This is the moment to extend Jubula by yourself. In this article I describe the steps we have done to include our custom control (a SWT canvas) into Jubula tests. We implemented a general solution to support any SWT control in Jubula, so it might help you with your own controls. To sum it up, all you need is a little fragment for your RCP application (the AUT) and a plug-in for the Jubula client.
How to use Groovy code in Eclipse RCP applications?
Some days ago I found the time to take a closer look at Groovy, the second standard language for the Java platform. I liked the idea of Groovy and since Groovy classes can be called within Java classes (and vice versa) I thought about how to use Groovy code in Eclipse RCP plug-ins for resolving some domain problems and making programmers daily work much easier (e.g. XML file handling). Here is a short overview of the steps I have done to make Groovy code in my RCP application work.
Scrumclipse: An Eclipse IDE Plug-In To Follow The Sprint Process
Like described in a previous article subshell organizes its software development with the agile methodology of scrum. Of course we have a big scrum board with DIN A5 cards for each task and a burndown chart to illustrate the process of the sprint. Thereby each task has a corresponding issue in our JIRA bug and issue tracking system and the whole life cycle of the tasks is managed there:
- The issues are assigned to the developer who currently works on it.
- The estimate and the spent time is logged in the working log.
- The state of the issues (e.g. "In Progress", "Review", "Test", "Done") is switched in JIRA.
- And so on...
- Finally the burndown chart is calculated out of the working logs automatically.
In addition to the "traditional" scrum board and burndown chart we created an Eclipse IDE plug-in that integrates the scrum board, the burndown chart and a sprint statistic into the developer's IDE.
What to do when your SWT application runs out of user handles.
"No more handles." Have you ever got this error message in your SWT application? We've had reports of this error cropping up in our Sophora DeskClient when the user had a lot of documents open simultaneously. To investigate this error, we first needed to know the kind of the unavailable handles. These could be e.g., file or GDI handles, but in our case turned out to be USER handles.
Maven makes dependency management between java projects easy, and with maven tycho, building Eclipse RCP plugins and products from the command-line is just as simple. But Eclipse RCP projects and maven projects have very different dependency resolutions, and mixing both project types is not as simple as adding a pom.xml to an Eclipse plugin project. In this blog post, I'll show what I've done to reference maven projects from our Eclipse RCP application.
The benefit of Eclipse perspectives is to group and organize views, actions etc. relative to specific user tasks and workflows. Every Eclipse developer switches over to different perspectives several times a day, e.g. for developing an Eclipse RCP application in the "Plug-In Development perspective", for debugging it in the "Debug perspective" and for committing or updating changes to/from SVN in "Team Synchronizing perspective". Users can arrange the views, add or close views and move or minimize them to the user's preferred layout and usage. Additional custom perspectives can be saved with a custom name, so users can create and switch over to their individual UI layouts.
Yesterday I switched from Eclipse 3.6. (Helios) to the new Eclipse version 3.7. (Indigo)and I experienced some problems with the maven integration for Eclipse. In 3.7 Sonatype's m2eclipse plugin, which I used before, was integrated in the Indigo release train and is now available on the standard eclipse update site. Unfortunately there seems to be some incompatibility between the "old" m2eclipse plugin and the "new" m2e plugin which comes with Eclipse Indigo.
A few days ago I had the problem to add proxy support for p2 updates in my own RCP application. The solution was very quick and simple.
If you want to add a view to your Eclipse RCP application, you usually have to register your view using the "org.eclipse.ui.views" extension point. Eclipse then takes care of adding your view to the view dialog automatically, so that users can open this view by selecting it from the menu. But for some reasons you might want to hide a view inside Eclipse's view dialog within your RCP application. For example if you want to open views only programatically or if you have to set specifing parameters when creating the view (e.g. a secondary id when using multiple instances of one view).
A few days ago I had to replace a TreeViewer with checkboxes with a TableViewer using dropdown comboboxes to allow the user editing values inside the table. It took me quite some time to find some useful documentation on how to manage to do that. The eclipse snippet page just deals with SWT whereas I wanted to use JFace. A tutorial is provided by eclipse as well, but unfortunately it is about 7 years old. In addition the eclipse API is far away from being detailed and helpful. Have a look at the JavaDoc of the class EditingSupport for instance. It is supposed to be one of the important classes to add editing support to your TableViewer and it's description simply says "EditingSupport is the abstract superclass of the support for cell editing."...
Lately I had to add a webservice interface to our XML importer component and so I was taking a closer look on some webservice frameworks. While reading several feature lists and technical documentations I came across this description of Spring-WS. Chapter 17.5.6 deals with using Spring-WS together with the Java 6 JDK webservice features, published in a build-in HTTP-Server. Because the attached code samples looked really simple, I decided to give it a shot.
I spend several hours lately to get Eclipse Helios to work with Maven (m2eclipse plugin) and the Eclipse Web Tools Platform (WTP). I wanted Maven to resolve my dependencies for a web project and WTP to deploy my application on a Tomcat server automatically. Actually this should be managed by the "Maven Integration for WTP" plugin - but it doesn't ...
Probably not a new tip for everyone, but here's how to have the Eclipse Java editor cleanup your code whenever you save a file. In the preferences, navigate to Java > Editor > Save Actions, activate the checkbox "Perform the selected actions on save", and check anything you like. For example, the screenshot shows what to activate to never leave unused import statements behind.
JFace preference pages are easy to create using field editors. The are several editor types available, most consist of a label and one or two controls for displaying and changing a value. E.g., a StringFieldEditor consists of a label and a text field. This article will show how to use JFace field editors in a custom dialog.
Amongst others, there are editors for color, font, and a file path. Field editors can be created using one liners, their layout is managed by the FieldEditorPreferencePage. They work with a preference store to load and save data and have built-in validation. This saves a lot of code when building preference pages, but what about using them outside of preferences?
First off, I haven't found a lot of publications about field editors on the net. There's an old article on eclipse.org that's a good introduction to field editors and is still mostly valid: http://www.eclipse.org/articles/Article-Field-Editors/field_editors.html.
With Eclipse 3.6 (Helios) the Equinox p2 API for update support of RCP applications becomes stable. Time to use it in your own application, but how?
The best documentation of how to use Equinox p2 is the article Adding Self-Update to an RCP Application in the eclipse wiki. Following that article I will describe the steps I had to do to use p2 in my application.
First of all I want to use p2 "as is". Users should be allowed to choose and add update-sites (or "repositories" in p2 terms) and use Help > Check for Updates or Help > Install New Software... in the main menu like in Eclipse IDE. So I followed the chapter "Reusing the Eclipse SDK UI in its entirety" of the article above.
Möchte man seine Eclipse-Entwicklungsumgebung auf Version 3.6 (Helios) aktualisieren, kann man sich meiner Meinung nach eine Menge Arbeit (und Frust) ersparen, wenn man folgende Schritte beachtet.
Ein Backup des "workspace"-Verzeichnisses anlegen. Dabei ist vor allem der Unterordner ".metadata" wichtig, der alle Einstellungen enthält. Zudem lohnt es sich den Ordner ".eclipse" im Benutzerverzeichnis zu sichern. Unter Windows 7 befindet sich dieser beispielsweise unter "C:\Users\Benutzername\.eclipse".
Die neue Eclipse-Version in einem separaten Ordner entpacken und nicht drüberkopieren. Es bietet sich beispielsweise an, den alten "eclipse"-Ordner in "eclipse_alt" umzubenennen und dann die neue Version im "eclipse"-Ordner abzulegen. So bleiben auch alle bereits angelegten Verweise erhalten.