Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » TextTransfer Drag and Drop Question in Logic Editor Example
TextTransfer Drag and Drop Question in Logic Editor Example [message #52736] Wed, 08 January 2003 15:49 Go to next message
Eclipse UserFriend
Originally posted by: truenoto.yahoo.com

In the logic Editor Example, only Label accepts Text Drop.
But when I look at the code of the DropTarget listener is add to the
GraphicalViewer, not to the label. Then why I can only drop Text to Label
only? Where it the code which restricts the I can only drop to Label?

What should I do if I want other figures to accept Text Drop Event?

What should I do so that I can drag text to the Main Graphic Panel, and the
editor will create a NEW label with the Text I drop?

Thank you for any help.
Re: TextTransfer Drag and Drop Question in Logic Editor Example [message #52764 is a reply to message #52736] Tue, 07 January 2003 16:34 Go to previous messageGo to next message
Manfred Goetz is currently offline Manfred GoetzFriend
Messages: 8
Registered: July 2009
Junior Member
"Takumi Fujiwara" <truenoto@yahoo.com> wrote in message
news:avhha6$q7k$1@rogue.oti.com...
> In the logic Editor Example, only Label accepts Text Drop.
> But when I look at the code of the DropTarget listener is add to the
> GraphicalViewer, not to the label. Then why I can only drop Text to Label
> only? Where it the code which restricts the I can only drop to Label?
>
> What should I do if I want other figures to accept Text Drop Event?
>
> What should I do so that I can drag text to the Main Graphic Panel, and
the
> editor will create a NEW label with the Text I drop?
>
> Thank you for any help.
>
>

As far as I understood, you can only drop on Editparts which provide
EditPolicies that are able to accept the request the DropTargetListener
transports.
In this case, the request is of class NativeDropRequest (in Package
logickdesigner.edit).
The only EditPolicy which can use that request is LogicLabelEditPolicy,
which will create a DropTextCommand. All other EditPolicies in LogicExample
can't use a NativeDropRequest - their getCommand(Request)-Method will return
null. That means you can't drop the text.
To enable other Editparts for dropping, you would have to handle the
NativeDropRequest (or what ever request you use) in one of their
EditPolicies.

Manfred Goetz.
Re: TextTransfer Drag and Drop Question in Logic Editor Example [message #52816 is a reply to message #52764] Wed, 08 January 2003 18:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: hudsonr.us.eye-bee-em.com

Exactly!

"Manfred Goetz" <xgoetz@de.ibm.com> wrote in message
news:avhj8f$rto$1@rogue.oti.com...
> "Takumi Fujiwara" <truenoto@yahoo.com> wrote in message
> news:avhha6$q7k$1@rogue.oti.com...
> > In the logic Editor Example, only Label accepts Text Drop.
> > But when I look at the code of the DropTarget listener is add to the
> > GraphicalViewer, not to the label. Then why I can only drop Text to
Label
> > only? Where it the code which restricts the I can only drop to Label?
> >
> > What should I do if I want other figures to accept Text Drop Event?
> >
> > What should I do so that I can drag text to the Main Graphic Panel, and
> the
> > editor will create a NEW label with the Text I drop?
> >
> > Thank you for any help.
> >
> >
>
> As far as I understood, you can only drop on Editparts which provide
> EditPolicies that are able to accept the request the DropTargetListener
> transports.
> In this case, the request is of class NativeDropRequest (in Package
> logickdesigner.edit).
> The only EditPolicy which can use that request is LogicLabelEditPolicy,
> which will create a DropTextCommand. All other EditPolicies in
LogicExample
> can't use a NativeDropRequest - their getCommand(Request)-Method will
return
> null. That means you can't drop the text.
> To enable other Editparts for dropping, you would have to handle the
> NativeDropRequest (or what ever request you use) in one of their
> EditPolicies.
>
> Manfred Goetz.
>
>
>
Re: TextTransfer Drag and Drop Question in Logic Editor Example [message #53134 is a reply to message #52764] Thu, 09 January 2003 16:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sy_cheung2.yahoo.com

Manfred,

I would like to modify the Logic Editor Example to achieve this as a
learning exercise:
When user drag a Task in the Task View, and drop it to the Logic Editor, it
will create an Label in the Logic Editor at the place when it is dropped.

Based on your suggestion, I modify the getCommand() of
LogicContainerEditPolicy to add a case for NativeDropRequestID. But I try it
(select a task with Ctrl) and drag it over to the Logic Edit Panel, it still
just shows a STOP icon, and when I move it over a Label, it changes to a
DROP icon. Could you please tell me what did I miss?

Thank you for your help.


public Command getCommand(Request request) {

if (AutoLayoutAction.AUTOLAYOUT.equals(request.getType())) {

// original implementation of LogicContainerEditPolicy


} else if (NativeDropRequest.ID.equals(request.getType())) {

return getDropTextCommand((NativeDropRequest)request);

}


return super.getCommand(request);

}



"Manfred Goetz" <xgoetz@de.ibm.com> wrote in message
news:avhj8f$rto$1@rogue.oti.com...
> "Takumi Fujiwara" <truenoto@yahoo.com> wrote in message
> news:avhha6$q7k$1@rogue.oti.com...
> > In the logic Editor Example, only Label accepts Text Drop.
> > But when I look at the code of the DropTarget listener is add to the
> > GraphicalViewer, not to the label. Then why I can only drop Text to
Label
> > only? Where it the code which restricts the I can only drop to Label?
> >
> > What should I do if I want other figures to accept Text Drop Event?
> >
> > What should I do so that I can drag text to the Main Graphic Panel, and
> the
> > editor will create a NEW label with the Text I drop?
> >
> > Thank you for any help.
> >
> >
>
> As far as I understood, you can only drop on Editparts which provide
> EditPolicies that are able to accept the request the DropTargetListener
> transports.
> In this case, the request is of class NativeDropRequest (in Package
> logickdesigner.edit).
> The only EditPolicy which can use that request is LogicLabelEditPolicy,
> which will create a DropTextCommand. All other EditPolicies in
LogicExample
> can't use a NativeDropRequest - their getCommand(Request)-Method will
return
> null. That means you can't drop the text.
> To enable other Editparts for dropping, you would have to handle the
> NativeDropRequest (or what ever request you use) in one of their
> EditPolicies.
>
> Manfred Goetz.
>
>
>
Re: TextTransfer Drag and Drop Question in Logic Editor Example [message #53209 is a reply to message #53134] Thu, 09 January 2003 16:48 Go to previous message
Eclipse UserFriend
Originally posted by: hudsonr.us.eye-bee-em.com

Don't forget that your EditPart (the logic container) will not get
*TARGETED* unless it returns itself for getTargetEditPart().
Therefore, your LogicConatinerEditPolicy should return its getHost() for
these requests.

"Sam Cheung" <sy_cheung2@yahoo.com> wrote in message
news:avk720$hcv$1@rogue.oti.com...
> Manfred,
>
> I would like to modify the Logic Editor Example to achieve this as a
> learning exercise:
> When user drag a Task in the Task View, and drop it to the Logic Editor,
it
> will create an Label in the Logic Editor at the place when it is dropped.
>
> Based on your suggestion, I modify the getCommand() of
> LogicContainerEditPolicy to add a case for NativeDropRequestID. But I try
it
> (select a task with Ctrl) and drag it over to the Logic Edit Panel, it
still
> just shows a STOP icon, and when I move it over a Label, it changes to a
> DROP icon. Could you please tell me what did I miss?
>
> Thank you for your help.
>
>
> public Command getCommand(Request request) {
>
> if (AutoLayoutAction.AUTOLAYOUT.equals(request.getType())) {
>
> // original implementation of LogicContainerEditPolicy
>
>
> } else if (NativeDropRequest.ID.equals(request.getType())) {
>
> return getDropTextCommand((NativeDropRequest)request);
>
> }
>
>
> return super.getCommand(request);
>
> }
>
>
>
> "Manfred Goetz" <xgoetz@de.ibm.com> wrote in message
> news:avhj8f$rto$1@rogue.oti.com...
> > "Takumi Fujiwara" <truenoto@yahoo.com> wrote in message
> > news:avhha6$q7k$1@rogue.oti.com...
> > > In the logic Editor Example, only Label accepts Text Drop.
> > > But when I look at the code of the DropTarget listener is add to the
> > > GraphicalViewer, not to the label. Then why I can only drop Text to
> Label
> > > only? Where it the code which restricts the I can only drop to Label?
> > >
> > > What should I do if I want other figures to accept Text Drop Event?
> > >
> > > What should I do so that I can drag text to the Main Graphic Panel,
and
> > the
> > > editor will create a NEW label with the Text I drop?
> > >
> > > Thank you for any help.
> > >
> > >
> >
> > As far as I understood, you can only drop on Editparts which provide
> > EditPolicies that are able to accept the request the DropTargetListener
> > transports.
> > In this case, the request is of class NativeDropRequest (in Package
> > logickdesigner.edit).
> > The only EditPolicy which can use that request is LogicLabelEditPolicy,
> > which will create a DropTextCommand. All other EditPolicies in
> LogicExample
> > can't use a NativeDropRequest - their getCommand(Request)-Method will
> return
> > null. That means you can't drop the text.
> > To enable other Editparts for dropping, you would have to handle the
> > NativeDropRequest (or what ever request you use) in one of their
> > EditPolicies.
> >
> > Manfred Goetz.
> >
> >
> >
>
>
Previous Topic:Printing Example
Next Topic:PrintFigureOperation doesn't print whole figure.
Goto Forum:
  


Current Time: Thu Dec 26 13:39:34 GMT 2024

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

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

Back to the top