[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Re: What is the right way to change the XXXDiagramEditPart IFigure?

Hi Dmitry,
I tried this trick with "Gen Diagram XXXEditPart" / "Figure Viewmap ..."
Unfortunately, no matter what you enter as Diagram Figure in the .gmfgen
the generated editor is the same file by file, char by char.
So, I guess tampering with the Diagram Figure simply isn't implemented yet 
in codegen

I tried it also with label mapping  "Gen Node Label XXXEditPart" / "Parent 
Assigned Viewmap".
I changed the default
org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel
to a plain
org.eclipse.draw2d.Label
In this case the new figure type is correctly used in setLabel() of the 
child label's EditPart, that is,
public void setLabel(WrapLabel figure)
became
public void setLabel(Label figure) ...

, but the parent's EditPart, which is supposed to provide the figure 
instance through
"Access to parent figure's child", still uses WrapLabel  = =  errors.

I think that this approach for now would only work with nodes ->
"GenTop Level Node ..." / "Inner Class Viewmap ..." / "Class Body"
since it is just a string pasted mot-a-mot by the generator.
Good luck,
Theo


"Dmitry Stadnik" <5d5@xxxxxxx> wrote in message 
news:eoistm$oel$1@xxxxxxxxxxxxxxxxxxxx
> FigureViewmap allows you to specify custom figure in gmfgen model. Just 
> use it instead of default InnerClassViewmap.
>
> Theo wrote:
>> A straightforward brute force approach is to override its 
>> createFigure(...),
>> and that the way I would do it in GEF, but maybe GMF offers a more
>> elegant workaround.
>> And does changing the IFigure necessarily require changing the View model 
>> element as well?
>> Thanks,
>> Theo