Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Change cursor for DND
Change cursor for DND [message #206019] Fri, 23 December 2005 20:10 Go to next message
Felix L J Mayer is currently offline Felix L J MayerFriend
Messages: 202
Registered: July 2009
Senior Member
I am using a TransferDropTargetListener to handle FileTransfer and
LocalSelectionTransfer. Some of the items that can be dragged over I want to
accept into the diagram, others I don't. Currently I have a check in
Command.canExecute() which returns false if and item is not acceptable. This
means that cursor shows that everything is okay, but when you release the
mouse button, nothing happens.

I would rather change mouse cursor to SWT.CURSOR_NO to give the user
immediate feedback. I tried overriding the showTargetFeedback() method on my
EditPolicy to change the cursor, but that lasted only for 1/10 of a second,
then old cursor was back.

Is there a way to show feedback with the cursor?
Re: Change cursor for DND [message #206218 is a reply to message #206019] Tue, 27 December 2005 04:52 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

If there is no target editpart, the droptarget should not indicate that it
is enabled, which results in NOT sign if all are disabled. So, one answer is
to avoid being targeted when you don't accept a certain transfer type.

Why isn't canExecute used by default? Because the data being dropped is not
available until the drop is completed. If you want to use canExecute(), call
setEnabledDeterminedByCommand(true).

"Felix L J Mayer" <felix.mayer@objectaid.com> wrote in message
news:dohlj9$9jn$1@utils.eclipse.org...
>I am using a TransferDropTargetListener to handle FileTransfer and
>LocalSelectionTransfer. Some of the items that can be dragged over I want
>to accept into the diagram, others I don't. Currently I have a check in
>Command.canExecute() which returns false if and item is not acceptable.
>This means that cursor shows that everything is okay, but when you release
>the mouse button, nothing happens.
>
> I would rather change mouse cursor to SWT.CURSOR_NO to give the user
> immediate feedback. I tried overriding the showTargetFeedback() method on
> my EditPolicy to change the cursor, but that lasted only for 1/10 of a
> second, then old cursor was back.
>
> Is there a way to show feedback with the cursor?
>
Re: Change cursor for DND [message #206300 is a reply to message #206218] Wed, 28 December 2005 16:04 Go to previous messageGo to next message
Felix L J Mayer is currently offline Felix L J MayerFriend
Messages: 202
Registered: July 2009
Senior Member
Thanks a lot, unfortunately it looks like there is no solution. As you say,
the data being dropped is not available until the drop is completed, so
canExecute() does not work. I am not sure I understand the first part of
your answer, but my issue is that I want to accept some things that come
with a LocalSelectionTransfer and some I don't. So I have to install a
listener for the LocalSelectionTransfer, but I need a look at the actual
data before the drop is completed.

For the benefit of others reading this thread: The correct method call is
setEnablementDeterminedByCommand( true ).

"Randy Hudson" <none@us.ibm.com> wrote in message
news:doqh6d$aa0$1@utils.eclipse.org...
> If there is no target editpart, the droptarget should not indicate that it
> is enabled, which results in NOT sign if all are disabled. So, one answer
> is to avoid being targeted when you don't accept a certain transfer type.
>
> Why isn't canExecute used by default? Because the data being dropped is
> not available until the drop is completed. If you want to use
> canExecute(), call setEnabledDeterminedByCommand(true).
>
> "Felix L J Mayer" <felix.mayer@objectaid.com> wrote in message
> news:dohlj9$9jn$1@utils.eclipse.org...
>>I am using a TransferDropTargetListener to handle FileTransfer and
>>LocalSelectionTransfer. Some of the items that can be dragged over I want
>>to accept into the diagram, others I don't. Currently I have a check in
>>Command.canExecute() which returns false if and item is not acceptable.
>>This means that cursor shows that everything is okay, but when you release
>>the mouse button, nothing happens.
>>
>> I would rather change mouse cursor to SWT.CURSOR_NO to give the user
>> immediate feedback. I tried overriding the showTargetFeedback() method on
>> my EditPolicy to change the cursor, but that lasted only for 1/10 of a
>> second, then old cursor was back.
>>
>> Is there a way to show feedback with the cursor?
>>
>
>
Re: Change cursor for DND [message #206335 is a reply to message #206300] Wed, 28 December 2005 20:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

When dragging from the palette to the GV, I'm sure that we cheat and just
take the data from the transfer and make it available on the request, even
before drop occurs. But, this is only useful for targeting since we still
don't check the command's enablement (unless the client turns it on).

"Felix L J Mayer" <felix.mayer@objectaid.com> wrote in message
news:doucu5$mfl$1@utils.eclipse.org...
> Thanks a lot, unfortunately it looks like there is no solution. As you
> say, the data being dropped is not available until the drop is completed,
> so canExecute() does not work. I am not sure I understand the first part
> of your answer, but my issue is that I want to accept some things that
> come with a LocalSelectionTransfer and some I don't. So I have to install
> a listener for the LocalSelectionTransfer, but I need a look at the actual
> data before the drop is completed.
>
> For the benefit of others reading this thread: The correct method call is
> setEnablementDeterminedByCommand( true ).
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:doqh6d$aa0$1@utils.eclipse.org...
>> If there is no target editpart, the droptarget should not indicate that
>> it is enabled, which results in NOT sign if all are disabled. So, one
>> answer is to avoid being targeted when you don't accept a certain
>> transfer type.
>>
>> Why isn't canExecute used by default? Because the data being dropped is
>> not available until the drop is completed. If you want to use
>> canExecute(), call setEnabledDeterminedByCommand(true).
>>
>> "Felix L J Mayer" <felix.mayer@objectaid.com> wrote in message
>> news:dohlj9$9jn$1@utils.eclipse.org...
>>>I am using a TransferDropTargetListener to handle FileTransfer and
>>>LocalSelectionTransfer. Some of the items that can be dragged over I want
>>>to accept into the diagram, others I don't. Currently I have a check in
>>>Command.canExecute() which returns false if and item is not acceptable.
>>>This means that cursor shows that everything is okay, but when you
>>>release the mouse button, nothing happens.
>>>
>>> I would rather change mouse cursor to SWT.CURSOR_NO to give the user
>>> immediate feedback. I tried overriding the showTargetFeedback() method
>>> on my EditPolicy to change the cursor, but that lasted only for 1/10 of
>>> a second, then old cursor was back.
>>>
>>> Is there a way to show feedback with the cursor?
>>>
>>
>>
>
>
Re: Change cursor for DND [message #206383 is a reply to message #206335] Thu, 29 December 2005 18:01 Go to previous message
Felix L J Mayer is currently offline Felix L J MayerFriend
Messages: 202
Registered: July 2009
Senior Member
I got it to work for LocalSelectionTransfer with
setEnablementDeterminedByCommand(true)because it has the data in it right
away, event when the DropTargetEvent does not.

"Randy Hudson" <none@us.ibm.com> wrote in message
news:doutl4$gbp$1@utils.eclipse.org...
> When dragging from the palette to the GV, I'm sure that we cheat and just
> take the data from the transfer and make it available on the request, even
> before drop occurs. But, this is only useful for targeting since we still
> don't check the command's enablement (unless the client turns it on).
>
> "Felix L J Mayer" <felix.mayer@objectaid.com> wrote in message
> news:doucu5$mfl$1@utils.eclipse.org...
>> Thanks a lot, unfortunately it looks like there is no solution. As you
>> say, the data being dropped is not available until the drop is completed,
>> so canExecute() does not work. I am not sure I understand the first part
>> of your answer, but my issue is that I want to accept some things that
>> come with a LocalSelectionTransfer and some I don't. So I have to install
>> a listener for the LocalSelectionTransfer, but I need a look at the
>> actual data before the drop is completed.
>>
>> For the benefit of others reading this thread: The correct method call is
>> setEnablementDeterminedByCommand( true ).
>>
>> "Randy Hudson" <none@us.ibm.com> wrote in message
>> news:doqh6d$aa0$1@utils.eclipse.org...
>>> If there is no target editpart, the droptarget should not indicate that
>>> it is enabled, which results in NOT sign if all are disabled. So, one
>>> answer is to avoid being targeted when you don't accept a certain
>>> transfer type.
>>>
>>> Why isn't canExecute used by default? Because the data being dropped is
>>> not available until the drop is completed. If you want to use
>>> canExecute(), call setEnabledDeterminedByCommand(true).
>>>
>>> "Felix L J Mayer" <felix.mayer@objectaid.com> wrote in message
>>> news:dohlj9$9jn$1@utils.eclipse.org...
>>>>I am using a TransferDropTargetListener to handle FileTransfer and
>>>>LocalSelectionTransfer. Some of the items that can be dragged over I
>>>>want to accept into the diagram, others I don't. Currently I have a
>>>>check in Command.canExecute() which returns false if and item is not
>>>>acceptable. This means that cursor shows that everything is okay, but
>>>>when you release the mouse button, nothing happens.
>>>>
>>>> I would rather change mouse cursor to SWT.CURSOR_NO to give the user
>>>> immediate feedback. I tried overriding the showTargetFeedback() method
>>>> on my EditPolicy to change the cursor, but that lasted only for 1/10 of
>>>> a second, then old cursor was back.
>>>>
>>>> Is there a way to show feedback with the cursor?
>>>>
>>>
>>>
>>
>>
>
>
Previous Topic:How to add undo/redo of my actions to GEF CommandStack?
Next Topic:XMIResource
Goto Forum:
  


Current Time: Thu Apr 25 12:34:29 GMT 2024

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

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

Back to the top