Archive for the ‘Eclipse’ Category

Nebula Gallery widget in production (PosterGenius)

March 9th, 2010

Just relaying a ‘thank-you’ post from Stavros Kounis on the nebula newsgroup :

Hi all

Its was back to 2008 when we have decide to rely on nebula gallery widget for our project named “PosterGenius”[1][2].

Since then Nebula Gallery widget[3] was havy used in our application. Now PosterGenius is a finalist for the Best RCP Application for the 2010 Eclipse Community Awards.

I what to share this “recognition” of our work with the Nebula Team[4] and say a BIG “Thank you guys!!”

/stavros

[1] http://www.postergenius.com/
[2] http://skounis.blogspot.com/2010/03/nebula-gallery-widget-in-production.html
[3] http://www.eclipse.org/nebula/widgets/gallery/gallery.php
[4] http://www.eclipse.org/nebula/

(more…)

CollabNet merge client

August 12th, 2009

The CollabNet team has made a fantastic work with the new merge client in Subclipse 1.6.x. I was used to the previous merge dialog and I was surprised how merging with SVN can be easy with a good wizard.

Let’s take a look at these screenshots :

Select merge operation

Merge wizard 1

Select branch to reintegrate

Merge wizard 2

Pre-merge checks

No screenshot here but if there is something wrong in the current working copy, the wizard warns you and provides quick fixes.

Merge options

Merge wizard 3

Results

Merge wizard 4

Merge graph

The branch and merge history can be shown in the history graph. We can see the previous merge on this test project.

Merge graph

Great work guys :-)

Collaboration between ShareMedia and Remus Information Management

August 11th, 2009

ShareMedia and Remus information Management are two open source RCP applications which have similar features :

ShareMedia is a multi-platform photo manager. It supports several repositories such as local computer, Jabber, Picasa web or Flickr.

RIM is a free OpenSource client application for the management of information with a connection to multitude of data repositories like Flickr, Youtube or Facebook and a desktop-integration for an optimal usage for the offline management, visualization and easy accessibility of information to the user.

A few weeks ago, Tom Seidel and I decided to work on Eclipse bundles that will be shared between the two projects in order to speed up development and improve reusability of our code.

Our first goal is to define a common API which will be used by both applications and to port the existing image viewers from ShareMedia to this new API. ShareMedia has two full screen viewers including an OpenGL based one, inspired from CoverFlow from iTunes (see screencast bellow @0:55).

While these bundles are mainly targeted to ShareMedia and RIM, they can also be used in the Eclipse IDE and in any RCP application.

We now have a first implementation of the viewer API and two basic viewers. A few features are still missing and there is no background image loading so the IU may freeze a few seconds while loading large images, but it is working.

The following explains how to install the viewers in Eclipse and in an RCP application.

Installing the demo viewer into Eclipse :

The viewer has a dependency on Nebula Gallery which is not yet packaged into the feature. So you have to install the gallery widget from its update site :

http://download.eclipse.org/technology/nebula/gallery/update-N/

then install the demo viewer from ShareMedia / RIM update site :

http://smedia-rim.sourceforge.net/update/site.xml

Testing the viewer :

Select one or several image files in the package viewer / navigator view, open the context menu and select View in full screen…

viewer-fullscreen

Your monitors will fade to black and the first file will be displayed on your primary monitor. Commands are : ESC – Return to Eclipse , SPACE – Next image.

Multi-monitor setups are supported. Your secondary monitor will let you select the image to display on the primary monitor using a gallery of all items from your selection.

How to add a viewer to your application :

First, you will have to add the following bundles to your application

  • org.sharemediarim.api : the base API plugin, always required
  • org.sharemediarim.simple : the basic viewers. These are the only viewers available right now, just wait :-)
  • org.sharemediarim.viewers.adapter.file : the adapter for IFile objects. Only if you want do show eclipse resources (IFile) in the viewer.
  • org.apache.sanselan : dependency of o.s.v.adapter.file, used to read image thumbnails.
  • org.sharemedia.rim.viewers : Eclipse integration. Adds full screen action for IFile items in the context menu.

If you didn’t use the Eclipse integration, you can open the viewer from your code (usually in an action) :

1 – Create a viewer : a viewer can display images, but not necessary in full screen. It can also be hosted in a view :

IViewer viewer= new SampleViewer();

2 – Create a full screen viewer from the previous viewer. You can also provide additional viewers which will be displayed on secondary monitors.

final GenericFullScreenViewer fullScreenViewer = new GenericFullScreenViewer(new SampleViewer());

3 – Set the viewer’s input. Objects within the selection must implement IAdaptable and have an adapter to Image or IAdvancedImage. We provide a default Adapter for IFile in org.sharemediarim.viewers.adapter.file.

fullScreenViewer.setInput(structuredSelection);

4 – Register a listener to dispose the viewer on close. You can also reuse the viewer every time, and dispose it only on exit.

fullScreenViewer.addCloseListener(new Listener() {
public void handleEvent(Event event) {
viewer.dispose();
}});

5 – Finally, open the viewer :

fullScreenViewer.open();

Get involved :

If you are interested by using these viewers in your application or by creating new implementations, don’t hesitate to get in touch with us and help improve this API and viewers.

Project home page : http://sourceforge.net/projects/smedia-rim/

Issue tracker : http://www.remus-software.org/jira/browse/SMEDIARIM

Forum : http://sourceforge.net/forum/forum.php?forum_id=977188

Growl support for Eclipse RCP

July 5th, 2009

On Mac OS X, Growl has become the de facto standard for all notifications. There is an opened bug asking for Growl support in SWT/RCP : Bug 209911 – [Mac] Support for Growl notifications.

The best solution would be to have a standard API for notification with support for notification plug ins (including growl) and this is exactly what is discussed on bug 209911 and on the wiki page for Platform UI/Notifications.

But for those wanting to add Growl support to their applications as soon as possible, I’ve just attached to bug 209911 a plug-in which can successfully send Growl notifications.

Growl Action

Growl Action

Growl Notification from Eclipse

Growl Notification from Eclipse

The Growl wrapper depends on Apple’s Java/cocoa bindings, so the trick was to add external libraries to the plugin classpath :

Bundle-ClassPath: .,
external:/System/Library/Java

It works, but you should know that :

  • Apple Java/Cocoa bindings are deprecated.
  • This does not work with Cocoa/x86_64, probably because of the deprecation. There you get the following error :java.lang.UnsatisfiedLinkError: /usr/lib/java/libObjCJava.A.dylib: no suitable
    image found. Did find: /usr/lib/java/libObjCJava.A.dylib: no matching
    architecture in universal wrapper

Hopefully, the Growl wrapper is a really small class, and it should be rather easy to rewrite it with SWT’s internal Cocoa packages for someone who knows Cocoa (I don’t). If you want to take a look at the wrapper, just download my attachment to Bug 209911 and take a look at the class : com.growl.Growl.

Memory analysis with Eclipse 3.5

June 12th, 2009

Eclipse Galileo (3.5) will be released on June 24, 2009 and comes with a really good and easy-to-use JVM Memory Analyzer.

Memory chart

Memory chart

Here is a quick memory analysis walkthrough :

Creating a heap dump

You can dump the memory of a Java process anytime using jmap which is included in the JDK.

To ensure jmap is working for you, get your java process ID :
ps -Af | grep java

or, if you want to dump eclipse memory :
ps -Af | grep eclipse

Then ask jmap to output a memory summary :

jmap <pid>

Jmap output :
Attaching to process ID 356, please wait...
Debugger attached successfully.
Client compiler detected.
JVM version is 1.5.0_16-133

using thread-local object allocation.
Mark Sweep Compact GC

Heap Configuration:
(...)

If you get an error, take a look at the end of this post for a few tips.

Ok so jmap works for you. Now dump the complete memory in a file :
jmap -heap:format=b <pid>

There is now a file named heap.bin in your current directory.

Installing Memory Analyzer
Start Eclipse, use Help->Install new software… and select Memory Analyzer from the Galileo update site :

Installing Memory Analyzer

Installing Memory Analyzer

Opening the dump

Switch to Memory Analysis perspective

Perspectives : select Memory Analysis

Perspectives : select Memory Analysis


Use File->Open Head Dump… and select heap.bin
Memory summary

Memory summary

You can now digg into your application heap memory and ensure that no objects is using more memory than it should. Memory Analyzer also includes really nice features like an automatic leak search :

Leak suspects report

Leak suspects report

Have fun and catch the leaks :-)

jmap tips
If you have problems running jmap, try the following tips :

  • Be sure to use the jmap binary packaged with the JVM you are running : jmap from a Java 5 JDK will not be able to dump memory from a Java 6 VM : you’ll get this stacktrace :

    Attaching to process ID 704, please wait...
    Exception in thread "main" java.lang.RuntimeException: gHotSpotVMTypes was not initialized properly in the remote process; can not continue
    at sun.jvm.hotspot.HotSpotTypeDataBase.readVMTypes(HotSpotTypeDataBase.java:111)
    at sun.jvm.hotspot.HotSpotTypeDataBase.(HotSpotTypeDataBase.java:68)
    at sun.jvm.hotspot.MacOSXTypeDataBase.(MacOSXTypeDataBase.java:35)
    at sun.jvm.hotspot.bugspot.BugSpotAgent.setupVM(BugSpotAgent.java:560)
    at sun.jvm.hotspot.bugspot.BugSpotAgent.go(BugSpotAgent.java:481)
    at sun.jvm.hotspot.bugspot.BugSpotAgent.attach(BugSpotAgent.java:319)
    at sun.jvm.hotspot.tools.Tool.start(Tool.java:146)
    at sun.jvm.hotspot.tools.JMap.main(JMap.java:128)

  • jmap needs high system privileges. If you can’t attach to a java process with the following error :

    Attaching to process ID 704, please wait...
    attach: task_for_pid(704) failed (5)
    Error attaching to process: Error attaching to process, or no such process

    …, try to use sudo : sudo jmap <pid>. (See Ken Sipe's blog for additional information)