Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Double click on white space
Double click on white space [message #498749] Wed, 18 November 2009 14:25 Go to next message
Eclipse UserFriend
Originally posted by:


the existing posts about capturing double-click events didn't work in my
application. I tried to capture REQ_OPEN at the diagram editpart but
that didn't work. Then I tried to add a mouse listener to the diagram
figure like this:

protected IFigure createFigure() {

// Create free form layer:
Figure layer = new FreeformLayer();
layer.setBorder(new MarginBorder(3));
layer.setLayoutManager(new FreeformLayout());

layer.addMouseListener(new MouseListener() {
public void mouseDoubleClicked(MouseEvent me) {
System.out.println("double click: " + me);
// ...

// Create the static router for the connection layer
ConnectionLayer connections = (ConnectionLayer)
connections.setConnectionRouter(new ShortestPathConnectionRouter(layer));

return layer;


But I still get no events. I do get events if I listen to the
FigureConvas of the graphical viewer but then I get ALL double clicks,
and not just the ones in the white space.

Re: Double click on white space [message #500187 is a reply to message #498749] Wed, 25 November 2009 09:57 Go to previous message
Gerrit  is currently offline Gerrit Friend
Messages: 30
Registered: July 2009
Hi, I am using a Tool to capture double-clicks on the EditParts, and also on the whitespace that represents the RootEditPart. I don't know if that's already on your list of methods that don't work, but it works fine for me.


public class MyTool extends PanningSelectionTool {

	// ...

	protected boolean handleDoubleClick(int button) {
		EditPart editPart = getCurrentViewer().findObjectAtExcluding(
		if(editPart instanceof ScalableFreeformRootEditPart) {
			// It's the RootEditPart, which usually has a ViewPort with Layers as its Figure.
			// This means the whitespace has received a double-click,
			// unless the setup is vastly different.
		else {
			// Some other EditPart's Figure has been double-clicked on.
		return super.handleDoubleClick(button);
Previous Topic:Custom SWT widgets in palette
Next Topic:EMF ItemProvider to PropertySource in GEF
Goto Forum:

Current Time: Thu Jun 21 03:14:36 GMT 2018

Powered by FUDForum. Page generated in 0.01769 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top