Community
Participate
Working Groups
Currently the generated code for edit parts includes: /** * @generated */ protected void setForegroundColor(Color color) { if (primaryShape != null) { primaryShape.setForegroundColor(color); } } /** * @generated */ protected void setBackgroundColor(Color color) { if (primaryShape != null) { primaryShape.setBackgroundColor(color); } } But there are no equivalent methods for determining the background color of the enclosed shape. And because there doesn't appear to be a common interface that allows us to find the primary shape for an arbitrary edit part, there is no way to discover this except by assuming that the first child will be that primary shape.
What do you mean by enclosed shape? The draw2d figure? What is your usecase?
(In reply to comment #1) > What do you mean by enclosed shape? The draw2d figure? What is your usecase? Yes...for example in the generated EcoreTools EClassEditPart, a "primaryshape" is created which is then the actual shape being drawn. So the figure provided by the getFigure method is essentially useless for extension. But there is no ability to access that primary figure for usage that assumes a generic generated GMF editor. A getter is generated but it is specific to the concrete class: /** * @generated */ public ClassFigure getPrimaryShape() { return (ClassFigure) primaryShape; }
I am not sure I fully understand. Can you please detail why the getFigure method does not fit to your use-case?
(In reply to comment #3) > I am not sure I fully understand. Can you please detail why the getFigure > method does not fit to your use-case? Because getFigure does not return the actual figure used to represent the edit part.
We had recently encountered the different use case that may be easily solved by providing something like IPrimaryShapeEditPart extends IGraphicalEditPart {IFigure getPrimaryShape();} We also decided to finally have a tooling-runtime feature / plugin(s) that will provide the common API and glue code for all generated editors (see bugzilla #368169) I think it is a time to reconsider this bugzilla.