Search in sources :

Example 1 with WrappingLabel

use of org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel in project statecharts by Yakindu.

the class ExternalXtextLabelEditPart method createFigure.

@Override
protected IFigure createFigure() {
    final WrappingLabel label = new SyntaxColoringLabel();
    label.setTextWrap(true);
    label.setAlignment(PositionConstants.LEFT | PositionConstants.TOP);
    return label;
}
Also used : SyntaxColoringLabel(org.yakindu.base.xtext.utils.gmf.figures.SyntaxColoringLabel) WrappingLabel(org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel)

Example 2 with WrappingLabel

use of org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel in project statecharts by Yakindu.

the class XtextDirectEditManager method hookListeners.

protected void hookListeners() {
    super.hookListeners();
    // TODO: This gets around the problem of the cell editor not growing big
    // enough when in autosize mode because it doesn't listen to textflow
    // size changes. The superclass should be modified to not assume we want
    // to listen to the editpart's figure.
    ILabelDelegate label = (ILabelDelegate) getEditPart().getAdapter(ILabelDelegate.class);
    if (label != null && getEditPart().getFigure() instanceof WrappingLabel) {
        textFigureListener = new AncestorListener.Stub() {

            public void ancestorMoved(IFigure ancestor) {
                getLocator().relocate(getCellEditor());
            }
        };
        ((IFigure) ((WrappingLabel) getEditPart().getFigure()).getTextFigure().getChildren().get(0)).addAncestorListener(textFigureListener);
    }
}
Also used : ILabelDelegate(org.eclipse.gmf.runtime.diagram.ui.label.ILabelDelegate) AncestorListener(org.eclipse.draw2d.AncestorListener) WrappingLabel(org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

WrappingLabel (org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel)2 AncestorListener (org.eclipse.draw2d.AncestorListener)1 IFigure (org.eclipse.draw2d.IFigure)1 ILabelDelegate (org.eclipse.gmf.runtime.diagram.ui.label.ILabelDelegate)1 SyntaxColoringLabel (org.yakindu.base.xtext.utils.gmf.figures.SyntaxColoringLabel)1