Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » [Zest] Suppress multi-selection on the canvas
[Zest] Suppress multi-selection on the canvas [message #1748250] Mon, 21 November 2016 15:30 Go to next message
Christoph Broeter is currently offline Christoph BroeterFriend
Messages: 30
Registered: July 2015
Member
How do I suppress multi-selection (LMouse+Shift, LMouse/RMouse selection box) on the current canvas (ZestContentViewer)?

Zest 0.2.0 is used.
Re: [Zest] Suppress multi-selection on the canvas [message #1748261 is a reply to message #1748250] Mon, 21 November 2016 15:59 Go to previous messageGo to next message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 163
Registered: March 2015
Senior Member
Hi Christoph,

you can remove the bindings for MarqueeOnDragPolicy by extending ZestFxJFaceModule and overriding the bindMarqueeOnDragPolicyAsIRootPartAdapter() method with an empty implementation.

Best regards,
Matthias
Re: [Zest] Suppress multi-selection on the canvas [message #1748446 is a reply to message #1748250] Wed, 23 November 2016 09:24 Go to previous messageGo to next message
Christoph Broeter is currently offline Christoph BroeterFriend
Messages: 30
Registered: July 2015
Member
Thanks for your reply!

I am guessing that the behavior has been changed since release 0.2.0.
A class named ZestFxJFaceModule is not available but one named ZestFxModule.
ZestFxModule extends MvcFxModule which contains the following method:
	/**
	 * Adds a binding for {@link FXMarqueeOnDragPolicy} to the
	 * {@link AdapterMap} binder for {@link FXRootPart}.
	 *
	 * @param adapterMapBinder
	 *            The {@link MapBinder} to be used for the binding registration.
	 *            In this case, will be obtained from
	 *            {@link AdapterMaps#getAdapterMapBinder(Binder, Class)} using
	 *            {@link FXRootPart} as a key.
	 *
	 * @see AdapterMaps#getAdapterMapBinder(Binder, Class)
	 */
	protected void bindOnDragPoliciesAsFXRootPartAdapters(
			MapBinder<AdapterKey<?>, Object> adapterMapBinder) {
		adapterMapBinder.addBinding(
				AdapterKey.get(FXClickDragTool.DRAG_TOOL_POLICY_KEY)).to(
				FXMarqueeOnDragPolicy.class);
	}

I've overritten ZestFxModule and named the new class MyZestFxModule with an empty method.
@Override
	protected void bindOnDragPoliciesAsFXRootPartAdapters(MapBinder<AdapterKey<?>, Object> adapterMapBinder) {
		// super.bindOnDragPoliciesAsFXRootPartAdapters(adapterMapBinder);
	}


Further I've bound MyZestFxUIModule to MyZestContentViewer class by overwriting the createModule method.
@Override
	protected Module createModule() {
		if (PlatformUI.isWorkbenchRunning()) {
			return Modules.override(new ZestFxUiModule()).with(new MyZestFxModule());
		} else {
			return new MyZestFxModule();
		}
	}

Sadly, that did not solve the multi selection and the marquee (Did not know the term) can still be used.
Re: [Zest] Suppress multi-selection on the canvas [message #1748476 is a reply to message #1748446] Wed, 23 November 2016 13:26 Go to previous messageGo to next message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 163
Registered: March 2015
Senior Member
Hi Christoph,

yes you are right the names changed. Your approach seems to be correct, though. The marquee selection definitely cannot be used anymore if the binding for FXMarqueeOnDragPolicy is missing from the module. I would suggest looking at the references to FXMaruqeeOnDragPolicy within your workspace to find any direct use of the policy. Moreover, you can use the injector to create an instance of FXRootPart and take a look at the injected adapters to ensure that the policy is not present.

However, I overlooked the first part of your question regarding appending selections. This can be done by subclassing FXFocusAndSelectOnClickPolicy (and adjusting the bindings within the module accordingly), where the selection change is computed. Unfortunately, in the 0.2.0 version, there is no method isAppend(MouseEvent) present, therefore, you have to copy and adjust the code.

Best regards,
Matthias

[Updated on: Wed, 23 November 2016 13:31]

Report message to a moderator

Re: [Zest] Suppress multi-selection on the canvas [message #1748482 is a reply to message #1748476] Wed, 23 November 2016 14:03 Go to previous message
Christoph Broeter is currently offline Christoph BroeterFriend
Messages: 30
Registered: July 2015
Member
Thank you Matthias, that worked.
For reason of your response I could easily figure out the issuing behavior and fixed it.

Thanks for all the help!
Both of you guys provide a protruding support!
Previous Topic:How to use GEF Shapes editor example
Next Topic:[ZEST] render Composite/Nested nodes using Zest
Goto Forum:
  


Current Time: Sun Sep 23 00:48:20 GMT 2018

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

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

Back to the top