Search in sources :

Example 1 with ITextFigure

use of com.archimatetool.editor.diagram.figures.ITextFigure in project archi by archimatetool.

the class AbstractDiagramEditor method refreshFiguresWithLabelFeature.

/**
 * Refresh all figures with label features
 */
protected void refreshFiguresWithLabelFeature() {
    for (Object editPart : getGraphicalViewer().getEditPartRegistry().values()) {
        if (editPart instanceof GraphicalEditPart) {
            IFigure figure = ((GraphicalEditPart) editPart).getFigure();
            Object model = ((GraphicalEditPart) editPart).getModel();
            // If it is a text figure and has a label render feature update text
            if (model instanceof IDiagramModelComponent && TextRenderer.getDefault().hasFormatExpression((IDiagramModelComponent) model) && figure instanceof ITextFigure) {
                ((ITextFigure) figure).setText();
            }
        }
    }
}
Also used : ITextFigure(com.archimatetool.editor.diagram.figures.ITextFigure) IDiagramModelComponent(com.archimatetool.model.IDiagramModelComponent) EventObject(java.util.EventObject) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

ITextFigure (com.archimatetool.editor.diagram.figures.ITextFigure)1 IDiagramModelComponent (com.archimatetool.model.IDiagramModelComponent)1 EventObject (java.util.EventObject)1 IFigure (org.eclipse.draw2d.IFigure)1 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)1