Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Cannot automatically snap to grid!
Cannot automatically snap to grid! [message #210708] Sat, 04 March 2006 06:32 Go to next message
Eclipse UserFriend
Originally posted by: java.freshman.cx.gmail.com

Hi, all.

Now I have encountered a amazing problem about Grid.
It is know that grid is a new support feature since GEF 3.1.
According to reference, if we want show grid in gef editor and make node
snaped to geid when dragging, all we need to do is set the property
SnapToGrid.PROPERTY_GRID_VISIBLE and SnapToGrid.PROPERTY_GRID_ENABLED of
GroghicalViewer
as true.

Actually, I have done it and grid can be seen in the backgroud, but node in
the editor cannot be snapped to the grid automatically when dragged. Are
there any more code I should added to my editor or any control I should
perform on EditPart and EditPolicy?

I doubt that the problem may be related with my EditPart hierarchy. My
ediparts are like follows:
RootEditPart
--DiagramEditPart
--NodeEditPart(non-dragable)
--SubnodeEditPart(dragable)
Problem occurs when I try to drag SubnodeEditPart in its container
NodeEditPart and into DiagramEditPart. Is it because the DiagramEditPart
whose figure is FreeformLayer is not direct container of SubnodeEditPart?

I am not sure whther I have gave enough detailsot not, but thanks to those
who pay attention to the problem anyway.
Thank you very much!
Re: Cannot automatically snap to grid! [message #210827 is a reply to message #210708] Mon, 06 March 2006 14:52 Go to previous messageGo to next message
Steven R. Shaw is currently offline Steven R. ShawFriend
Messages: 128
Registered: July 2009
Senior Member
You need to add an adapter in your DiagramEditPart to the SnapToHelper
class.

@see LogicDiagramEditPart#getAdapter(...)

-Steve

"Shawn Chen" <java.freshman.cx@gmail.com> wrote in message
news:dubc9m$k5e$1@eclipse.org...
> Hi, all.
>
> Now I have encountered a amazing problem about Grid.
> It is know that grid is a new support feature since GEF 3.1.
> According to reference, if we want show grid in gef editor and make node
> snaped to geid when dragging, all we need to do is set the property
> SnapToGrid.PROPERTY_GRID_VISIBLE and SnapToGrid.PROPERTY_GRID_ENABLED of
> GroghicalViewer
> as true.
>
> Actually, I have done it and grid can be seen in the backgroud, but node
in
> the editor cannot be snapped to the grid automatically when dragged. Are
> there any more code I should added to my editor or any control I should
> perform on EditPart and EditPolicy?
>
> I doubt that the problem may be related with my EditPart hierarchy. My
> ediparts are like follows:
> RootEditPart
> --DiagramEditPart
> --NodeEditPart(non-dragable)
> --SubnodeEditPart(dragable)
> Problem occurs when I try to drag SubnodeEditPart in its container
> NodeEditPart and into DiagramEditPart. Is it because the DiagramEditPart
> whose figure is FreeformLayer is not direct container of SubnodeEditPart?
>
> I am not sure whther I have gave enough detailsot not, but thanks to those
> who pay attention to the problem anyway.
> Thank you very much!
>
>
Re: Cannot automatically snap to grid! [message #210899 is a reply to message #210827] Mon, 06 March 2006 22:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: harsh.ti.com

Steve,

Thank you so much. I am not sure if you saw my other thread related to
this issue but I have been scratching my head over this for days now.
This was the missing link.

Thank you,
Harsh
Re: Cannot automatically snap to grid! [message #211069 is a reply to message #210827] Wed, 08 March 2006 03:00 Go to previous message
Eclipse UserFriend
Originally posted by: java.freshman.cx.gmail.com

To Steve Shaw:

Thank you very much!
I found the solution just like you pointed out yesterday.
Thank you anyway!
Previous Topic:How to create and move bendpoints when I am using ManhattanConnectionRouter
Next Topic:Drill down diagrams
Goto Forum:
  


Current Time: Wed Jan 15 20:33:38 GMT 2025

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

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

Back to the top