Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Snap to grid on creation?
Snap to grid on creation? [message #167764] Thu, 10 February 2005 18:01 Go to next message
Sean Neeley is currently offline Sean NeeleyFriend
Messages: 22
Registered: July 2009
Junior Member
I noticed in the logic example, that parts snap to the grid when they
are moved or resized. What changes would be involved to make it so
that new parts snap to the grid when they are dropped onto the figure
canvas? I can't figure out how to do this.

- Sean
Re: Snap to grid on creation? [message #167772 is a reply to message #167764] Thu, 10 February 2005 20:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: no.mail.please

You could add a layout editpolicy to the parent editpart and do the
stuff in createChangeConstraintCommand method.

I think this should work.

--
Arnaud
Re: Snap to grid on creation? [message #167800 is a reply to message #167764] Fri, 11 February 2005 06:01 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
You should do this in CreationTool#updateTargetRequest(). Look at how
DragEditPartsTracker#updateTargetRequest() does that.

"Sean Neeley" <sean.neeley@dbcsoftware.com> wrote in message
news:cug7lk$sds$1@www.eclipse.org...
> I noticed in the logic example, that parts snap to the grid when they
> are moved or resized. What changes would be involved to make it so
> that new parts snap to the grid when they are dropped onto the figure
> canvas? I can't figure out how to do this.
>
> - Sean
Re: Snap to grid on creation? [message #168223 is a reply to message #167800] Mon, 14 February 2005 16:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Pratik, size-on-create snaps, but accepting the default size on create does
not snap.

"Pratik Shah" <ppshah@us.ibm.com> escreveu na mensagem
news:cuhhok$sr$1@www.eclipse.org...
> You should do this in CreationTool#updateTargetRequest(). Look at how
> DragEditPartsTracker#updateTargetRequest() does that.
>
> "Sean Neeley" <sean.neeley@dbcsoftware.com> wrote in message
> news:cug7lk$sds$1@www.eclipse.org...
>> I noticed in the logic example, that parts snap to the grid when they
>> are moved or resized. What changes would be involved to make it so
>> that new parts snap to the grid when they are dropped onto the figure
>> canvas? I can't figure out how to do this.
>>
>> - Sean
>
>
Re: Snap to grid on creation? [message #168397 is a reply to message #168223] Tue, 15 February 2005 19:50 Go to previous messageGo to next message
Sean Neeley is currently offline Sean NeeleyFriend
Messages: 22
Registered: July 2009
Junior Member
So how do I do it? BTW, I'm not using a Palette. I add a part by
listening for a mouse click on the figure canvas, then I instantiate my
own CreateRequest and CreateCommand.

Randy Hudson wrote:
> Pratik, size-on-create snaps, but accepting the default size on create does
> not snap.
>
> "Pratik Shah" <ppshah@us.ibm.com> escreveu na mensagem
> news:cuhhok$sr$1@www.eclipse.org...
>
>>You should do this in CreationTool#updateTargetRequest(). Look at how
>>DragEditPartsTracker#updateTargetRequest() does that.
>>
>>"Sean Neeley" <sean.neeley@dbcsoftware.com> wrote in message
>>news:cug7lk$sds$1@www.eclipse.org...
>>
>>>I noticed in the logic example, that parts snap to the grid when they
>>>are moved or resized. What changes would be involved to make it so
>>>that new parts snap to the grid when they are dropped onto the figure
>>>canvas? I can't figure out how to do this.
>>>
>>>- Sean
>>
>>
>
>
Re: Snap to grid on creation? [message #168450 is a reply to message #168397] Wed, 16 February 2005 04:43 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

You'll have to send that request through the SnapToHelper. See how other
tools work with that interface.

"Sean Neeley" <sean.neeley@dbcsoftware.com> escreveu na mensagem
news:cutjuk$sud$1@www.eclipse.org...
> So how do I do it? BTW, I'm not using a Palette. I add a part by
> listening for a mouse click on the figure canvas, then I instantiate my
> own CreateRequest and CreateCommand.
>
Previous Topic:Chaning properties don't make dirty
Next Topic:GEF and MultiPageEditorPart
Goto Forum:
  


Current Time: Thu Sep 19 01:02:38 GMT 2024

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

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

Back to the top