Skip to main content



      Home
Home » Eclipse Projects » GEF » bug in mvc logo example(CloneOnClickHandler)
bug in mvc logo example [message #1818855] Mon, 30 December 2019 10:59 Go to next message
Eclipse UserFriend
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 10:10 Go to previous message
Eclipse UserFriend
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 10:10] by Moderator

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


Current Time: Tue Apr 22 16:34:37 EDT 2025

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

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

Back to the top