Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » bug in mvc logo example(CloneOnClickHandler)
bug in mvc logo example [message #1818855] Mon, 30 December 2019 15:59 Go to next message
lian hongwu is currently offline lian hongwuFriend
Messages: 5
Registered: November 2017
Junior Member
CloneOnClickHandler has a bug. When press SHIFT or ALT, click one geometry shape ,it can be cloned! But when dragging,the part that is dragged is the older,but not the newer, I want the newer is dragged! how to fix ?
Re: bug in mvc logo example [message #1819259 is a reply to message #1818855] Fri, 10 January 2020 15:10 Go to previous message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 230
Registered: March 2015
Senior Member
Hi Lian,

nice catch!

I looked into it just now together with Tamas. We found that the old part is selected by the FocusAndSelectOnClickHandler that is executed after the CloneOnClickHandler.

There are multiple options for solving this, for example:

1) Overwrite the default FocusAndSelectOnClickHandler, so that it will not be active when cloning is done, as follows:

package org.eclipse.gef.mvc.examples.logo.handlers;

import org.eclipse.gef.mvc.fx.handlers.FocusAndSelectOnClickHandler;

import javafx.scene.input.MouseEvent;

public class FocusAndSelectOnClickHandlerEx extends FocusAndSelectOnClickHandler {

	protected boolean isCloneModifierDown(MouseEvent e) {
		return e.isAltDown() || e.isShiftDown();
	}

	@Override
	protected boolean isFocusAndSelect(MouseEvent event) {
		return super.isFocusAndSelect(event) && !isCloneModifierDown(event);
	}
}


2) Overwrite the DefaultHandlerResolver so that only the first IOnClickHandler is executed.

3) Convert the CloneOnClickHandler into a CloneOnDragHandler (implementing IOnDragHandler) so that it is executed after the click handlers.

I created a Bugzilla to keep track of this issue [1]. We need to consider what should be the solution in the example before changing it, though.

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=559029

Best regards,
Matthias

[Updated on: Fri, 10 January 2020 15:10]

Report message to a moderator

Previous Topic:how to add listener to selectionmodel
Next Topic:[GEF5] Right way to set global visual effect
Goto Forum:
  


Current Time: Sat Apr 27 01:02:02 GMT 2024

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

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

Back to the top