March 21, 2006
I'm trying to display a message in Eclipse global status bar when hovering on a menu item.
I had the part to display the message (but I'm pretty sure it's the ugliest way I could have found):
if (window instanceof ApplicationWindow) {
ApplicationWindow appWindow = (ApplicationWindow)window;
appWindow.setStatus(message);
}
But I can't find how to run that code when hovering on a menu item. I've got the complete control on the menu and its items creation but I don't see where I can plug my code so that it is executed when hovering on a item of my menu.
The reason I need that code is that I'd like to display a description of a Eclipse Monkey script when hovering on a menu item in the Monkey
menu (see bug #132601 for a description of this enhancement).
If anyone has an idea, I'd appreciate.
March 20, 2006
Still playing with Eclipse Monkey.
I wrote this simple script based on the org.eclipse.dash.doms
resources
DOM. It looks for Java files to find the files which are missing copyright headers. In my script it is looking for the Eclipse Foundation copyright (Copyright (c) 2005 Eclipse Foundation
).
--- Came wiffling through the eclipsey wood ---
/*
* Menu: Find Missing Headers
* Kudos: Jeff Mesnil
* License: EPL 1.0
* DOM: http://download.eclipse.org/technology/dash/update/org.eclipse.dash.doms
*/
function main() {
var files = resources.filesMatching(".*\\.java");
var match;
for each( file in files ) {
file.removeMyTasks( );
if (!file.lines[1].string.match(/\* Copyright \(c\) 2005 Eclipse Foundation/)) {
file.lines[1].addMyTask(file);
}
}
window.getActivePage().showView("org.eclipse.ui.views.TaskList");
}
--- And burbled as it ran! ---
If I run it on my workspace with the imported org.eclipse.eclipsemonkey
plug-in, it shows that one file is missing the copyright header:

March 19, 2006
I'm playing with Eclipse Monkey and its DOM examples.
At first I did not understood in the Find_System_Prints.em
example where the window
variable was coming from.
After diving into in the org.eclipse.eclipsemonkey
plug-in source code, I found out that it is defined as a standard global variable in RunMonkeyScript.defineStandardGlobalVariables(Scriptable scope)
method.
Incidentally, it is the only global variable added by Eclipse Monkey.
The following code is also commented in this method (in version 0.1.6 of the o.e.eclipsemonkey
plug-in):
// Object wrappedWorkspace = Context.javaToJS(ResourcesPlugin
// .getWorkspace(), scope);
// ScriptableObject.putProperty(scope, "workspace", wrappedWorkspace);
The workspace
variable is instead contributed by the org.eclipse.dash.doms
plug-in.
To sum up, window
is available for free in your Monkey scripts while you will have to reference this DOM URL to have access to the workspace
variable.
March 14, 2006
EclipseCon'06 is approaching and I haven't yet chosen the talks I want to attend. There are so many things related to Eclipse which interest me:
It'll be hard to choose between so many talks but I'm eagerly waiting to learn more about Eclipse Monkey. Ward Cunningham and Bjorn Freeman-Benson envisioned it as just a team tool but Wayne Beaton is already pushing it and uses it to script a RCP application.
Anyway, see you at EclipseCon'06! And if you're interested by RCP and TPTP technology, I've a short talk about integrating TPTP in a RCP application which might interest you.
March 3, 2006
From its Web page:
Eclipse Monkey is a dynamic scripting tool for the automation of routine programming tasks. Monkey scripts are little Javascript programs using either the Eclipse APIs or custom Monkey DOMs.
I downloaded it and installed it on Eclipse 3.1.1 and it is promising.
It seems inspired a lot by greasemonkey and I'd like to see what kind of scripts the Eclipse community will create.
A first script I'd really like to get is to transform code comments like //BUG 12345
into a clickable URL to our bug tracker.
A concrete example of what can be done with Eclipse Monkey is Wayne Beaton's Flickr script
Kudos to Ward Cunningham & Bjorn Freeman-Benson
March 1, 2006
Following Wayne Beaton's post on more templates with eclipse, here is an example of template that I extensively use in eclipse to ease logging statements. For each logging level (debug, info, warn, error, fatal), I defined a corresponding templates. For example, I have a debug
template:
{% highlight java%} if (logger.isDebugEnabled()) { logger.debug(${cursor}); } {% endhighlight %}
It makes it simpler and quicker to write logging statements. However the class won't compile if a logger field has not already been defined. But in that case, either you can use eclipse's quick fix... or create a new template to define the logger.
February 14, 2006
After Innobase, Oracle has bought Sleepycat, the maker of the great database engine BerkeleyDB. Congratulations to the Sleepycat team!
As an aside, Oracle now owns the developers of InnoDB and BDB, two of the most popular transactional table formats used by MySQL database.
Shouldn't MySQL AB start to worry about that?
February 14, 2006
Eamonn McManus's Blog: What is an MXBean?
One of the important new features of the JMX API in Mustang (Java SE 6) is the ability to create MXBeans. MXBeans provide a convenient way to bundle related values together without requiring clients to be specially configured to handle the bundles. Here's the complete story about MXBeans.
Great new feature for JMX-based applications. When I read articles like that, I wish I could already use Java SE 6 in our production code because it could tremendously reduce the burden of JMX handling.
February 8, 2006
My talk about Integrating TPTP in a RCP Management/Monitoring Console has been accepted for EclipseCon'06.
See you there!

January 19, 2006
During the development of an Eclipse plug-in, I wanted to add label decorations to a view. The article Understanding Decorators in Eclipse is a good reference but I couldn't make it work in my own plug-in. This article is omitting a key information: The label provider you want to decorate needs to accept decorations, it must be wrapped in a DecoratingLabelProvider
. For now, I haven't found a way to find that information declaratively. So if you want to decorate a label provider provided by another plug-in, you have to browse its code to find out if it can be decorated or not.
As an example, to make my own ILabelProvider
decorable, I had to change the code in my view from:
viewer.setLabelProvider(new MyLabelProvider());
to:
viewer.setLabelProvider(
new DecoratingLabelProvider(
new MyLabelProvider(),
PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()));
With that change, I could contribute declaratively a lightweight decorator extension (i.e. in another plug-in) to this provider without any trouble.