[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools.gef] Re: Cannot automatically snap to grid!
|
You need to add an adapter in your DiagramEditPart to the SnapToHelper
class.
@see LogicDiagramEditPart#getAdapter(...)
-Steve
"Shawn Chen" <java.freshman.cx@xxxxxxxxx> wrote in message
news:dubc9m$k5e$1@xxxxxxxxxxxxxx
> 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!
>
>