XYLayoutEditPolicy in GMF generated code [message #196969] |
Mon, 14 July 2008 12:42  |
Eclipse User |
|
|
|
Originally posted by: jk6803.yahoo.com
Hi
I have an issues on XYLayoutEditPolicy.In GMF generated code itself,
shapes and connection works properly but after adding XYLayoutEditPolicy
to draw something, the shapes are always located at the left-top corner.
Here is part of DiagramEditPart code.
What should I override the methods?
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE,
new DiagramItemSemanticEditPolicy());
installEditPolicy(EditPolicyRoles.CANONICAL_ROLE,
new DiagramCanonicalEditPolicy());
installEditPolicy(EditPolicy.LAYOUT_ROLE,
new PointShapeXYLayoutEditPolicy());
}
thanks
|
|
|
|
|
|
Re: XYLayoutEditPolicy in GMF generated code [message #197581 is a reply to message #197494] |
Thu, 17 July 2008 05:28  |
Eclipse User |
|
|
|
Hello YJ,
> 1. Whenever I tried to cast Diagram object, it raised classcasting
> exeception.
> protected MyDiagram getCastedModel() {
> return (MyDiagram) getModel();
> }
If you are placing this code in an EditPart then you have to type something
like:
(MyDiagram) ((org.eclipse.gmf.runtime.notation.Diagram) getModel()).getElement()
> 2. I cannot add my own editpart in the EditFactoryPartClass.
The problem is: you do not have corresponding View createt isn't it?
> Once a custom menu is added on the palette, what classes are should be
> modified?.
You have to register own ???ViewProvider cresting corresponding View instance
for new diagram element (or modify generated ???ViewProvider in accordance)
+ register/modify generated ???EditPartProvider to create EditPart based
on a view created on step 1.
-----------------
Alex Shatalin
|
|
|
Powered by
FUDForum. Page generated in 0.05280 seconds