Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » When getCreateCommand() will be called?
When getCreateCommand() will be called? [message #162680] Thu, 23 December 2004 13:59 Go to next message
Eclipse UserFriend
Originally posted by: zhlmmc.hotmail.com

If I write getCreateCommand() like this:
protected Command getCreateCommand(CreateRequest request) {
/*CreateCommand command = new CreateCommand();

Rectangle constraint = (Rectangle) getConstraintFor(request);

HelloModel model = (HelloModel) request.getNewObject();

model.setConstraint(constraint);

command.setContentsModel(getHost().getModel());
command.setHelloModel(model);
return command;*/
return null;
}
GEF will stop me dragging the component from palette to the
EditPartViewer,has this method been called before my operation?Otherwise
how could system know that this method returns null and should reject this
operation?

Thank you :)
Re: When getCreateCommand() will be called? [message #162688 is a reply to message #162680] Thu, 23 December 2004 17:21 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
If you're doing click-and-drop, it will. But not with drag-and-drop (which
is native). Set a breakpoint in that method to see when it's being called.

"zhlmmc" <zhlmmc@hotmail.com> wrote in message
news:cqej09$rid$1@www.eclipse.org...
> If I write getCreateCommand() like this:
> protected Command getCreateCommand(CreateRequest request) {
> /*CreateCommand command = new CreateCommand();
>
> Rectangle constraint = (Rectangle) getConstraintFor(request);
>
> HelloModel model = (HelloModel) request.getNewObject();
>
> model.setConstraint(constraint);
>
> command.setContentsModel(getHost().getModel());
> command.setHelloModel(model);
> return command;*/
> return null;
> }
> GEF will stop me dragging the component from palette to the
> EditPartViewer,has this method been called before my operation?Otherwise
> how could system know that this method returns null and should reject this
> operation?
>
> Thank you :)
>
Re: When getCreateCommand() will be called? [message #162711 is a reply to message #162680] Thu, 23 December 2004 21:40 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Do you have a TemplateTransferDropTarget on your graphical viewer? Put a
breakpoint in its handleDragOver or whatever the method is called.

"zhlmmc" <zhlmmc@hotmail.com> wrote in message
news:cqej09$rid$1@www.eclipse.org...
> If I write getCreateCommand() like this:
> protected Command getCreateCommand(CreateRequest request) {
> /*CreateCommand command = new CreateCommand();
>
> Rectangle constraint = (Rectangle) getConstraintFor(request);
>
> HelloModel model = (HelloModel) request.getNewObject();
>
> model.setConstraint(constraint);
>
> command.setContentsModel(getHost().getModel());
> command.setHelloModel(model);
> return command;*/
> return null;
> }
> GEF will stop me dragging the component from palette to the
> EditPartViewer,has this method been called before my operation?Otherwise
> how could system know that this method returns null and should reject this
> operation?
>
> Thank you :)
>
Previous Topic:Non printable layer and Outline Overview
Next Topic:Problem with picture using plugin
Goto Forum:
  


Current Time: Fri Apr 26 06:23:23 GMT 2024

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

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

Back to the top