Search in sources :

Example 1 with BorderedNodeFigure

use of org.eclipse.gmf.runtime.diagram.ui.figures.BorderedNodeFigure in project elk by eclipse.

the class GmfDiagramLayoutConnector method refreshDiagram.

/**
 * Refreshes all ports in the diagram. This is necessary in order correctly move ports, which
 * does not work due to GMF bugs. See Eclipse bug #291484.
 *
 * @param editor
 *            the diagram editor
 * @param rootPart
 *            the root edit part
 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=291484
 */
private static void refreshDiagram(final DiagramEditor editor, final IGraphicalEditPart rootPart) {
    EditPart editPart = rootPart;
    if (editPart == null) {
        editPart = editor.getDiagramEditPart();
    }
    for (Object obj : editPart.getViewer().getEditPartRegistry().values()) {
        if (obj instanceof ShapeNodeEditPart) {
            IFigure figure = ((ShapeNodeEditPart) obj).getFigure();
            if (figure instanceof BorderedNodeFigure) {
                IFigure portContainer = ((BorderedNodeFigure) figure).getBorderItemContainer();
                portContainer.invalidate();
                portContainer.validate();
            }
        }
    }
}
Also used : ShapeNodeEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart) BorderedNodeFigure(org.eclipse.gmf.runtime.diagram.ui.figures.BorderedNodeFigure) ResizableCompartmentEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.ResizableCompartmentEditPart) ShapeNodeEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart) RootEditPart(org.eclipse.gef.RootEditPart) CompartmentEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart) RenderedDiagramRootEditPart(org.eclipse.gmf.runtime.diagram.ui.render.editparts.RenderedDiagramRootEditPart) EditPart(org.eclipse.gef.EditPart) IGraphicalEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) AbstractBorderItemEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart) LabelEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart) ConnectionEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart) DiagramEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart) EObject(org.eclipse.emf.ecore.EObject) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

IFigure (org.eclipse.draw2d.IFigure)1 EObject (org.eclipse.emf.ecore.EObject)1 EditPart (org.eclipse.gef.EditPart)1 RootEditPart (org.eclipse.gef.RootEditPart)1 AbstractBorderItemEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart)1 CompartmentEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart)1 ConnectionEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart)1 DiagramEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart)1 IGraphicalEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)1 LabelEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart)1 ResizableCompartmentEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.ResizableCompartmentEditPart)1 ShapeNodeEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart)1 BorderedNodeFigure (org.eclipse.gmf.runtime.diagram.ui.figures.BorderedNodeFigure)1 RenderedDiagramRootEditPart (org.eclipse.gmf.runtime.diagram.ui.render.editparts.RenderedDiagramRootEditPart)1