Search in sources :

Example 1 with ConnectionLayer

use of org.eclipse.draw2d.ConnectionLayer in project jbosstools-hibernate by jbosstools.

the class DiagramEditPart method setupFanConnectionRouter.

public void setupFanConnectionRouter() {
    ConnectionLayer connLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER);
    connLayer.setConnectionRouter(new FanRouter());
    getOrmDiagram().setupFanConnectionRouter();
}
Also used : FanRouter(org.eclipse.draw2d.FanRouter) ConnectionLayer(org.eclipse.draw2d.ConnectionLayer)

Example 2 with ConnectionLayer

use of org.eclipse.draw2d.ConnectionLayer in project jbosstools-hibernate by jbosstools.

the class GEFRootEditPart method setToFront.

@SuppressWarnings("unchecked")
public void setToFront(AbstractConnectionEditPart editpart) {
    ConnectionLayer layer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER);
    IFigure fig = editpart.getFigure();
    layer.getChildren().remove(fig);
    layer.getChildren().add(fig);
}
Also used : ConnectionLayer(org.eclipse.draw2d.ConnectionLayer) IFigure(org.eclipse.draw2d.IFigure)

Example 3 with ConnectionLayer

use of org.eclipse.draw2d.ConnectionLayer in project statecharts by Yakindu.

the class TreeLayoutUtil method getOrderedTreeChildren.

public static ArrayList<IGraphicalEditPart> getOrderedTreeChildren(IGraphicalEditPart parentTreeNodeEditPart) {
    final List<IGraphicalEditPart> children = new ArrayList<IGraphicalEditPart>();
    final DiagramEditPart diagramEditPart = UIUtils.getDiagramEditPart();
    if (diagramEditPart != null) {
        final ConnectionLayer connectionLayer = (ConnectionLayer) diagramEditPart.getLayer(LayerConstants.CONNECTION_LAYER);
        for (final Connection connection : getTreeFigureIncomingConnections(connectionLayer, parentTreeNodeEditPart.getFigure())) {
            final Object object = parentTreeNodeEditPart.getParent().getViewer().getVisualPartMap().get(connection.getSourceAnchor().getOwner());
            if (object instanceof IGraphicalEditPart) {
                children.add((IGraphicalEditPart) object);
            }
        }
    }
    final IGraphicalEditPart[] orderedChildren = new IGraphicalEditPart[children.size()];
    final List<IGraphicalEditPart> unorderedChildren = new ArrayList<IGraphicalEditPart>();
    for (final IGraphicalEditPart editPart : children) {
        final int treePosition = getTreeNodePosition(editPart);
        if (treePosition == -1 || treePosition >= orderedChildren.length || orderedChildren[treePosition] != null) {
            unorderedChildren.add(editPart);
        } else {
            orderedChildren[treePosition] = editPart;
        }
    }
    for (final IGraphicalEditPart editPart : unorderedChildren) {
        orderedChildren[getNextEmptyIndex(orderedChildren)] = editPart;
    }
    return new ArrayList<IGraphicalEditPart>(Arrays.asList(orderedChildren));
}
Also used : IGraphicalEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) DiagramEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart) ArrayList(java.util.ArrayList) Connection(org.eclipse.draw2d.Connection) ConnectionLayer(org.eclipse.draw2d.ConnectionLayer) Point(org.eclipse.draw2d.geometry.Point)

Example 4 with ConnectionLayer

use of org.eclipse.draw2d.ConnectionLayer in project dbeaver by serge-rider.

the class DiagramPart method createFigure.

@Override
protected IFigure createFigure() {
    EntityDiagramFigure figure = new EntityDiagramFigure(this);
    delegatingLayoutManager = new DelegatingLayoutManager(this);
    figure.setLayoutManager(delegatingLayoutManager);
    /*
        ConnectionLayer cLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER);
        ViewportAwareConnectionLayerClippingStrategy clippingStrategy = new ViewportAwareConnectionLayerClippingStrategy(cLayer);
        figure.setClippingStrategy(clippingStrategy);
*/
    Control control = getViewer().getControl();
    ConnectionLayer cLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER);
    if ((control.getStyle() & SWT.MIRRORED) == 0) {
        cLayer.setAntialias(SWT.ON);
    }
    FanRouter router = new FanRouter();
    router.setSeparation(15);
    // router.setNextRouter(new BendpointConnectionRouter());
    router.setNextRouter(new ShortestPathConnectionRouter(figure));
    // router.setNextRouter(new ManhattanConnectionRouter());
    // router.setNextRouter(new BendpointConnectionRouter());
    cLayer.setConnectionRouter(router);
    return figure;
}
Also used : EntityDiagramFigure(org.jkiss.dbeaver.erd.ui.figures.EntityDiagramFigure) Control(org.eclipse.swt.widgets.Control) ShortestPathConnectionRouter(org.eclipse.draw2d.ShortestPathConnectionRouter) DelegatingLayoutManager(org.jkiss.dbeaver.erd.ui.layout.DelegatingLayoutManager) FanRouter(org.eclipse.draw2d.FanRouter) ConnectionLayer(org.eclipse.draw2d.ConnectionLayer)

Example 5 with ConnectionLayer

use of org.eclipse.draw2d.ConnectionLayer in project dbeaver by dbeaver.

the class DiagramPart method createFigure.

@Override
protected IFigure createFigure() {
    EntityDiagramFigure figure = new EntityDiagramFigure(this);
    delegatingLayoutManager = new DelegatingLayoutManager(this);
    figure.setLayoutManager(delegatingLayoutManager);
    /*
        ConnectionLayer cLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER);
        ViewportAwareConnectionLayerClippingStrategy clippingStrategy = new ViewportAwareConnectionLayerClippingStrategy(cLayer);
        figure.setClippingStrategy(clippingStrategy);
*/
    Control control = getViewer().getControl();
    ConnectionLayer cLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER);
    if ((control.getStyle() & SWT.MIRRORED) == 0) {
        cLayer.setAntialias(SWT.ON);
    }
    FanRouter router = new FanRouter();
    router.setSeparation(15);
    // router.setNextRouter(new BendpointConnectionRouter());
    router.setNextRouter(new ShortestPathConnectionRouter(figure));
    // router.setNextRouter(new ManhattanConnectionRouter());
    // router.setNextRouter(new BendpointConnectionRouter());
    cLayer.setConnectionRouter(router);
    return figure;
}
Also used : EntityDiagramFigure(org.jkiss.dbeaver.erd.ui.figures.EntityDiagramFigure) Control(org.eclipse.swt.widgets.Control) ShortestPathConnectionRouter(org.eclipse.draw2d.ShortestPathConnectionRouter) DelegatingLayoutManager(org.jkiss.dbeaver.erd.ui.layout.DelegatingLayoutManager) FanRouter(org.eclipse.draw2d.FanRouter) ConnectionLayer(org.eclipse.draw2d.ConnectionLayer)

Aggregations

ConnectionLayer (org.eclipse.draw2d.ConnectionLayer)17 FanRouter (org.eclipse.draw2d.FanRouter)4 ArrayList (java.util.ArrayList)3 ShortestPathConnectionRouter (org.eclipse.draw2d.ShortestPathConnectionRouter)3 Control (org.eclipse.swt.widgets.Control)3 WidgetEditPartFactory (org.csstudio.opibuilder.editparts.WidgetEditPartFactory)2 BendpointConnectionRouter (org.eclipse.draw2d.BendpointConnectionRouter)2 FreeformLayer (org.eclipse.draw2d.FreeformLayer)2 FreeformLayeredPane (org.eclipse.draw2d.FreeformLayeredPane)2 IFigure (org.eclipse.draw2d.IFigure)2 ManhattanConnectionRouter (org.eclipse.draw2d.ManhattanConnectionRouter)2 ScalableFreeformLayeredPane (org.eclipse.draw2d.ScalableFreeformLayeredPane)2 ContextMenuProvider (org.eclipse.gef.ContextMenuProvider)2 ScalableFreeformRootEditPart (org.eclipse.gef.editparts.ScalableFreeformRootEditPart)2 ScrollingGraphicalViewer (org.eclipse.gef.ui.parts.ScrollingGraphicalViewer)2 EntityDiagramFigure (org.jkiss.dbeaver.erd.ui.figures.EntityDiagramFigure)2 DelegatingLayoutManager (org.jkiss.dbeaver.erd.ui.layout.DelegatingLayoutManager)2 Date (java.util.Date)1 Map (java.util.Map)1 RunOPIAction (org.csstudio.opibuilder.actions.RunOPIAction)1