Regarding the DirectEditing with this technique; I'm not too sure.
If you choose to use a complete model / EditPart to implement labels, then
DirectEditing is not a big problem - it's exactly the same as direct editing
in Logic. If you wanted to allow the user the flexibility of positioning the
label himself, I think it would not be too hard either. The figure used for
the Label editpart is the same as detailed above. The label model must NOT
be added as a child of the model to be labelled - else the label will mess
up the layout of the figure again.
If i create separate Editpart, Model for Label, is it possible
to add Labels along with connections, figures?.
for example,
public IFigure createFigute(){
Connection con = new PolylineConnection();
con.add(new MyLabel());
}
If MyLabel is a model class, you cannot add it as a child to the connection
FIGURE. I would suggest that your model class (of the figure to be labelled)
should have a member variable for the labels model.
Depending on the flexibility you need, both approaches (with and without
model / editParts) are workable, (I started off without using a separate
model / editpart, but ultimately found that for my needs, using a model for
the label would be simpler and cleaner).
Have a look at my "Labelling EditParts" post for more details.
All the best,
Brian.