Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to undo a drag operation
How to undo a drag operation [message #119411] Wed, 25 February 2004 17:20 Go to next message
Eclipse UserFriend
Originally posted by: sandip.us.ibm.com

Here's the problem, I am tweaking LogicEditor so that if I drag one of the
objects on the viewer and release it over another object, I want to undo the
drag operation if the latter is an "invalid" object to "accept" the dragged
object. The DragEditPartsTracker class seems to maintain a command stack
(using getCommand()) but all methods for accessing this are protected. How
can I access this object or is there any other elegant method of doing this?

TIA.

- Sandip
Re: How to undo a drag operation [message #119423 is a reply to message #119411] Wed, 25 February 2004 18:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Why not just prevent the operation from happening in your
Command#isExecutable() method?
There are also ways of preventing the targeting form occurring, so that
there is no target editpart, in which case the NOT cursor appears.

"Sandip Lahiri" <sandip@us.ibm.com> wrote in message
news:c1ildi$52j$1@eclipse.org...
> Here's the problem, I am tweaking LogicEditor so that if I drag one of the
> objects on the viewer and release it over another object, I want to undo
the
> drag operation if the latter is an "invalid" object to "accept" the
dragged
> object. The DragEditPartsTracker class seems to maintain a command stack
> (using getCommand()) but all methods for accessing this are protected. How
> can I access this object or is there any other elegant method of doing
this?
>
> TIA.
>
> - Sandip
>
>
Re: How to undo a drag operation [message #119451 is a reply to message #119423] Wed, 25 February 2004 20:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: phil.williams.toadmail.com

This is a multi-part message in MIME format.
--------------050901060908010207070802
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Randy,

How would do you go about preventing the targeting from happening. I am
close to getting the read only editor complete and the one thing that I
want to be able to have happen is when the user drags something onto an
editor that is read only, the NOT cursor appears. Right now I still get
the ADD(?) cursor but my edit domain rejects all commands so nothing
gets added, but I would like to have the better visual que of the NOT
cursor.

Thanks,
Phil

Randy Hudson wrote:

>Why not just prevent the operation from happening in your
>Command#isExecutable() method?
>There are also ways of preventing the targeting form occurring, so that
>there is no target editpart, in which case the NOT cursor appears.
>
>"Sandip Lahiri" <sandip@us.ibm.com> wrote in message
>news:c1ildi$52j$1@eclipse.org...
>
>
>>Here's the problem, I am tweaking LogicEditor so that if I drag one of the
>>objects on the viewer and release it over another object, I want to undo
>>
>>
>the
>
>
>>drag operation if the latter is an "invalid" object to "accept" the
>>
>>
>dragged
>
>
>>object. The DragEditPartsTracker class seems to maintain a command stack
>>(using getCommand()) but all methods for accessing this are protected. How
>>can I access this object or is there any other elegant method of doing
>>
>>
>this?
>
>
>>TIA.
>>
>>- Sandip
>>
>>
>>
>>
>
>
>
>

--------------050901060908010207070802
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body>
Randy,<br>
<br>
How would do you go about preventing the targeting from happening.&nbsp; I
am close to getting the read only editor complete and the one thing
that I want to be able to have happen is when the user drags something
onto an editor that is read only, the NOT cursor appears.&nbsp; Right now I
still get the ADD(?) cursor but my edit domain rejects all commands so
nothing gets added, but I would like to have the better visual que of
the NOT cursor.<br>
<br>
Thanks,<br>
Phil<br>
<br>
Randy Hudson wrote:<br>
<blockquote cite="midc1invf$8n9$1@eclipse.org" type="cite">
<pre wrap="">Why not just prevent the operation from happening in your
Command#isExecutable() method?
There are also ways of preventing the targeting form occurring, so that
there is no target editpart, in which case the NOT cursor appears.

"Sandip Lahiri" <a class="moz-txt-link-rfc2396E" href="mailto:sandip@us.ibm.com">&lt;sandip@us.ibm.com&gt;</a> wrote in message
<a class="moz-txt-link-freetext" href="news:c1ildi$52j$1@eclipse.org">news:c1ildi$52j$1@eclipse.org</a>...
</pre>
<blockquote type="cite">
<pre wrap="">Here's the problem, I am tweaking LogicEditor so that if I drag one of the
objects on the viewer and release it over another object, I want to undo
</pre>
</blockquote>
<pre wrap=""><!---->the
</pre>
<blockquote type="cite">
<pre wrap="">drag operation if the latter is an "invalid" object to "accept" the
</pre>
</blockquote>
<pre wrap=""><!---->dragged
</pre>
<blockquote type="cite">
<pre wrap="">object. The DragEditPartsTracker class seems to maintain a command stack
(using getCommand()) but all methods for accessing this are protected. How
can I access this object or is there any other elegant method of doing
</pre>
</blockquote>
<pre wrap=""><!---->this?
</pre>
<blockquote type="cite">
<pre wrap="">TIA.

- Sandip


</pre>
</blockquote>
<pre wrap=""><!---->

</pre>
</blockquote>
</body>
</html>

--------------050901060908010207070802--
Re: How to undo a drag operation [message #119464 is a reply to message #119451] Wed, 25 February 2004 22:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

This is a multi-part message in MIME format.

------=_NextPart_000_0030_01C3FBC3.99199150
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

One way would be to add a universal DropTarget listener which accepts =
all transfer types, but changes the droptargetevent detail to DND.NONE.
You might be able to add a TransferDropTargetListener, or just a plain =
DropTargetListener to the DropTarget which is automatically created.

There are some places in the provided editpartviewers where we add a =
"last" listener which gets to go last and has the last say in what =
actually happens.
"Phil Williams" <phil.williams@toadmail.com> wrote in message =
news:c1ivi7$jvh$1@eclipse.org...
Randy,

How would do you go about preventing the targeting from happening. I =
am close to getting the read only editor complete and the one thing that =
I want to be able to have happen is when the user drags something onto =
an editor that is read only, the NOT cursor appears. Right now I still =
get the ADD(?) cursor but my edit domain rejects all commands so nothing =
gets added, but I would like to have the better visual que of the NOT =
cursor.

Thanks,
Phil

Randy Hudson wrote:

Why not just prevent the operation from happening in your
Command#isExecutable() method?
There are also ways of preventing the targeting form occurring, so that
there is no target editpart, in which case the NOT cursor appears.

"Sandip Lahiri" <sandip@us.ibm.com> wrote in message
news:c1ildi$52j$1@eclipse.org...
Here's the problem, I am tweaking LogicEditor so that if I drag one of =
the
objects on the viewer and release it over another object, I want to undo
the
drag operation if the latter is an "invalid" object to "accept" the
dragged
object. The DragEditPartsTracker class seems to maintain a command =
stack
(using getCommand()) but all methods for accessing this are protected. =
How
can I access this object or is there any other elegant method of doing
this?
TIA.

- Sandip


=20


------=_NextPart_000_0030_01C3FBC3.99199150
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>One way would be to add a universal =
DropTarget=20
listener which accepts all transfer types, but changes the =
droptargetevent=20
detail to DND.NONE.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>You might be able to add a=20
TransferDropTargetListener, or just a plain DropTargetListener to the =
DropTarget=20
which is automatically created.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>There are some places in the provided=20
editpartviewers where we add a "last" listener which gets to go last and =
has the=20
last say in what actually happens.</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Phil Williams" &lt;<A=20
=
href=3D"mailto:phil.williams@toadmail.com">phil.williams@toadmail.com</A>=
&gt;=20
wrote in message <A=20
=
href=3D"news:c1ivi7$jvh$1@eclipse.org">news:c1ivi7$jvh$1@eclipse.org</A>.=
...</DIV>Randy,<BR><BR>How=20
would do you go about preventing the targeting from happening.&nbsp; I =
am=20
close to getting the read only editor complete and the one thing that =
I want=20
to be able to have happen is when the user drags something onto an =
editor that=20
is read only, the NOT cursor appears.&nbsp; Right now I still get the =
ADD(?)=20
cursor but my edit domain rejects all commands so nothing gets added, =
but I=20
would like to have the better visual que of the NOT=20
cursor.<BR><BR>Thanks,<BR>Phil<BR><BR>Randy Hudson wrote:<BR>
<BLOCKQUOTE cite=3Dmidc1invf$8n9$1@eclipse.org type=3D"cite"><PRE =
wrap=3D"">Why not just prevent the operation from happening in your
Command#isExecutable() method?
There are also ways of preventing the targeting form occurring, so that
there is no target editpart, in which case the NOT cursor appears.

"Sandip Lahiri" <A class=3Dmoz-txt-link-rfc2396E =
href=3D"mailto:sandip@us.ibm.com">&lt;sandip@us.ibm.com&gt;</A> wrote in =
message
<A class=3Dmoz-txt-link-freetext =
href=3D"news:c1ildi$52j$1@eclipse.org">news:c1ildi$52j$1@eclipse.org</A>.=
...
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">Here's the problem, I am =
tweaking LogicEditor so that if I drag one of the
objects on the viewer and release it over another object, I want to undo
</PRE></BLOCKQUOTE><PRE wrap=3D""><!---->the
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">drag operation if the =
latter is an "invalid" object to "accept" the
</PRE></BLOCKQUOTE><PRE wrap=3D""><!---->dragged
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">object. The =
DragEditPartsTracker class seems to maintain a command stack
(using getCommand()) but all methods for accessing this are protected. =
How
can I access this object or is there any other elegant method of doing
</PRE></BLOCKQUOTE><PRE wrap=3D""><!---->this?
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">TIA.

- Sandip


</PRE></BLOCKQUOTE><PRE wrap=3D""><!---->

</PRE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0030_01C3FBC3.99199150--
Re: How to undo a drag operation [message #119694 is a reply to message #119423] Thu, 26 February 2004 21:14 Go to previous message
Eclipse UserFriend
Originally posted by: sandip.us.ibm.com

This is what I am doing to find out the valid drop location:

In the LogicXYLayoutEditPolicy.createAddCommand(EditPart childEditPart,
Object constraint) method I added the following lines:
EditPart currentEditPart =
getHost().getViewer().findObjectAt(rect.getTopLeft());

if( null == currentEditPart || false == currentEditPart instanceof
DropOKEditPart)

{

add.setAsNonExecutable();

}

The currentEditPart does not seem to be the right one. As a result the
object sometimes get dropped correctly and at other times gets dropped on
the incorrect objects.

- Sandip

"Randy Hudson" <none@us.ibm.com> wrote in message
news:c1invf$8n9$1@eclipse.org...
> Why not just prevent the operation from happening in your
> Command#isExecutable() method?
> There are also ways of preventing the targeting form occurring, so that
> there is no target editpart, in which case the NOT cursor appears.
>
> "Sandip Lahiri" <sandip@us.ibm.com> wrote in message
> news:c1ildi$52j$1@eclipse.org...
> > Here's the problem, I am tweaking LogicEditor so that if I drag one of
the
> > objects on the viewer and release it over another object, I want to undo
> the
> > drag operation if the latter is an "invalid" object to "accept" the
> dragged
> > object. The DragEditPartsTracker class seems to maintain a command stack
> > (using getCommand()) but all methods for accessing this are protected.
How
> > can I access this object or is there any other elegant method of doing
> this?
> >
> > TIA.
> >
> > - Sandip
> >
> >
>
>
Previous Topic:Line routing in GEF
Next Topic:Two input connections on one connectionanchor
Goto Forum:
  


Current Time: Thu Jul 04 11:31:51 GMT 2024

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

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

Back to the top