Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Drag-n-Drop - can it NOT display the insertion bar in the target?
Drag-n-Drop - can it NOT display the insertion bar in the target? [message #778393] Thu, 12 January 2012 18:23 Go to next message
John Lussmyer is currently offline John LussmyerFriend
Messages: 100
Registered: December 2010
Senior Member
When dragging to a tree (or table), the system shows the insertion bar when the drop point is between nodes.
I have a case where this makes no sense,as you can NOT drop between nodes, only on nodes.

So, is there any way to prevent the insertion bar from being displayed?
(Yes, I don't allow the drop in my validateDrop() method, but it still shows the insertion bar.)
Re: Drag-n-Drop - can it NOT display the insertion bar in the target? [message #778632 is a reply to message #778393] Fri, 13 January 2012 15:20 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
The insertion bar should not be shown unless it is asked for. For an
example of this see SWT's DND example at
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/dnd
.. Run it and change its drop target to a Table or Tree and note that no
feedback is displayed by default (it sounds like in your case you may
want FEEDBACK_SELECT). I've verified that this is the case on win32, I
don't have access to the other platforms today. Do you see a different
behaviour than this?

Grant


On 1/12/2012 1:23 PM, Missing name Mising name wrote:
> When dragging to a tree (or table), the system shows the insertion bar
> when the drop point is between nodes.
> I have a case where this makes no sense,as you can NOT drop between
> nodes, only on nodes.
>
> So, is there any way to prevent the insertion bar from being displayed?
> (Yes, I don't allow the drop in my validateDrop() method, but it still
> shows the insertion bar.)
>
Re: Drag-n-Drop - can it NOT display the insertion bar in the target? [message #778637 is a reply to message #778632] Fri, 13 January 2012 15:49 Go to previous messageGo to next message
John Lussmyer is currently offline John LussmyerFriend
Messages: 100
Registered: December 2010
Senior Member
I think the difference is that my FolderTreeDropAdapter extends ViewerDropAdapter
I don't quite see how to limit it to FEEDBACK_SELECT when extending a ViewerDropAdapter.
I just tried overriding dragEnter(), dragOperationChanged(), and dragOver() with this:

	public void dragEnter( DropTargetEvent event) {
		super.dragEnter(event);
		if (event.detail == DND.DROP_DEFAULT) {
			event.detail = DND.DROP_MOVE;
		}
		event.feedback = DND.FEEDBACK_SELECT;
		return;
	}



And that just resulted in Dropping never being allowed.
Re: Drag-n-Drop - can it NOT display the insertion bar in the target? [message #779799 is a reply to message #778637] Mon, 16 January 2012 15:26 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
According to
http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fjface%2Fviewers%2FViewerDropAdapter.html
it looks like ViewerDropAdapter.setFeedbackEnabled() may be your friend
here.

Grant


On 1/13/2012 10:49 AM, Missing name Mising name wrote:
> I think the difference is that my FolderTreeDropAdapter extends
> ViewerDropAdapter
> I don't quite see how to limit it to FEEDBACK_SELECT when extending a
> ViewerDropAdapter.
> I just tried overriding dragEnter(), dragOperationChanged(), and
> dragOver() with this:
>
>
> public void dragEnter( DropTargetEvent event) {
> super.dragEnter(event);
> if (event.detail == DND.DROP_DEFAULT) {
> event.detail = DND.DROP_MOVE;
> }
> event.feedback = DND.FEEDBACK_SELECT;
> return;
> }
>
>
>
> And that just resulted in Dropping never being allowed.
>
Re: Drag-n-Drop - can it NOT display the insertion bar in the target? [message #779802 is a reply to message #779799] Mon, 16 January 2012 15:30 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
.... and possibly ViewerDropAdapter.setSelectionFeedbackEnabled() too. I
haven't tried this, but based on the doc it looks like
ViewerDropAdapter.setFeedbackEnabled(false) followed by
ViewerDropAdapter.setSelectionFeedbackEnabled(true) may be what's needed.

Grant


On 1/16/2012 10:26 AM, Grant Gayed wrote:
> According to
> http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fjface%2Fviewers%2FViewerDropAdapter.html
> it looks like ViewerDropAdapter.setFeedbackEnabled() may be your friend
> here.
>
> Grant
>
>
> On 1/13/2012 10:49 AM, Missing name Mising name wrote:
>> I think the difference is that my FolderTreeDropAdapter extends
>> ViewerDropAdapter
>> I don't quite see how to limit it to FEEDBACK_SELECT when extending a
>> ViewerDropAdapter.
>> I just tried overriding dragEnter(), dragOperationChanged(), and
>> dragOver() with this:
>>
>>
>> public void dragEnter( DropTargetEvent event) {
>> super.dragEnter(event);
>> if (event.detail == DND.DROP_DEFAULT) {
>> event.detail = DND.DROP_MOVE;
>> }
>> event.feedback = DND.FEEDBACK_SELECT;
>> return;
>> }
>>
>>
>>
>> And that just resulted in Dropping never being allowed.
>>
>
Re: Drag-n-Drop - can it NOT display the insertion bar in the target? [message #779840 is a reply to message #778393] Mon, 16 January 2012 16:43 Go to previous message
John Lussmyer is currently offline John LussmyerFriend
Messages: 100
Registered: December 2010
Senior Member
Yes! That was it. I'd missed those 2 methods when digging through the docs. Frankly, it's often unclear to me which object is controlling whatever feature I'm looking for, so I don't always look in the correct set of docs. (and google search completely failed me this time.)

I added:
setFeedbackEnabled(false);
setSelectionFeedbackEnabled(true);
To the Drop Adapter constructor, and it works just as I need.
Thanks!
Previous Topic:Click a menu button to display the drop down list
Next Topic:Where are Delta Packs?
Goto Forum:
  


Current Time: Fri Nov 27 09:36:56 GMT 2020

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

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

Back to the top