Search in sources :

Example 26 with GraphicalEditPart

use of org.eclipse.gef.GraphicalEditPart in project tdi-studio-se by Talend.

the class MapperRootEditPart method addChildVisual.

@Override
protected void addChildVisual(EditPart childEditPart, int index) {
    IFigure child = ((GraphicalEditPart) childEditPart).getFigure();
    if (childEditPart instanceof InputTablePart) {
        /* get first figure to put all input tables figures in */
        Object model = childEditPart.getModel();
        index = getRootModelManager().getInputTables().indexOf(model);
        if (index != -1) {
            leftFigure.add(child, index);
        } else {
            leftFigure.add(child);
        }
    }
    if (childEditPart instanceof OutputTablePart) {
        /* get third figure to put all output tables figures in */
        Object model = childEditPart.getModel();
        index = getRootModelManager().getOutputTables().indexOf(model);
        if (index != -1) {
            rightFigure.add(child, index);
        } else {
            rightFigure.add(child);
        }
    }
    if (childEditPart instanceof VarTablePart) {
        Object model = childEditPart.getModel();
        index = getRootModelManager().getVarTables().indexOf(model);
        if (index != -1) {
            // had added search figure when inited the center figure.
            if (centerFigure.getChildren() != null && centerFigure.getChildren().size() != 0) {
                centerFigure.add(child, index + centerFigure.getChildren().size());
            } else {
                centerFigure.add(child, index);
            }
        } else {
            centerFigure.add(child);
        }
    }
}
Also used : GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) IFigure(org.eclipse.draw2d.IFigure)

Example 27 with GraphicalEditPart

use of org.eclipse.gef.GraphicalEditPart in project tdi-studio-se by Talend.

the class DocumentBusinessItemNameEditPart method createDefaultEditPolicies.

/**
     * @generated
     */
protected void createDefaultEditPolicies() {
    super.createDefaultEditPolicies();
    installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
    installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {

        protected List createSelectionHandles() {
            List handles = new ArrayList();
            NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
            return handles;
        }

        public Command getCommand(Request request) {
            return null;
        }

        public boolean understandsRequest(Request request) {
            return false;
        }
    });
}
Also used : LabelDirectEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy) Command(org.eclipse.gef.commands.Command) ArrayList(java.util.ArrayList) Request(org.eclipse.gef.Request) DirectEditRequest(org.eclipse.gef.requests.DirectEditRequest) List(java.util.List) ArrayList(java.util.ArrayList) NonResizableEditPolicy(org.eclipse.gef.editpolicies.NonResizableEditPolicy) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) IGraphicalEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)

Example 28 with GraphicalEditPart

use of org.eclipse.gef.GraphicalEditPart in project tdi-studio-se by Talend.

the class GearBusinessItemNameEditPart method createDefaultEditPolicies.

/**
     * @generated
     */
protected void createDefaultEditPolicies() {
    super.createDefaultEditPolicies();
    installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
    installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {

        protected List createSelectionHandles() {
            List handles = new ArrayList();
            NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
            return handles;
        }

        public Command getCommand(Request request) {
            return null;
        }

        public boolean understandsRequest(Request request) {
            return false;
        }
    });
}
Also used : LabelDirectEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy) Command(org.eclipse.gef.commands.Command) ArrayList(java.util.ArrayList) Request(org.eclipse.gef.Request) DirectEditRequest(org.eclipse.gef.requests.DirectEditRequest) List(java.util.List) ArrayList(java.util.ArrayList) NonResizableEditPolicy(org.eclipse.gef.editpolicies.NonResizableEditPolicy) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) IGraphicalEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)

Example 29 with GraphicalEditPart

use of org.eclipse.gef.GraphicalEditPart in project tdi-studio-se by Talend.

the class EllipseBusinessItemNameEditPart method createDefaultEditPolicies.

/**
     * @generated
     */
protected void createDefaultEditPolicies() {
    super.createDefaultEditPolicies();
    installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
    installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {

        protected List createSelectionHandles() {
            List handles = new ArrayList();
            NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
            return handles;
        }

        public Command getCommand(Request request) {
            return null;
        }

        public boolean understandsRequest(Request request) {
            return false;
        }
    });
}
Also used : LabelDirectEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy) Command(org.eclipse.gef.commands.Command) ArrayList(java.util.ArrayList) Request(org.eclipse.gef.Request) DirectEditRequest(org.eclipse.gef.requests.DirectEditRequest) List(java.util.List) ArrayList(java.util.ArrayList) NonResizableEditPolicy(org.eclipse.gef.editpolicies.NonResizableEditPolicy) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) IGraphicalEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)

Example 30 with GraphicalEditPart

use of org.eclipse.gef.GraphicalEditPart in project tdi-studio-se by Talend.

the class BusinessExtNodeLabelEditPart method refreshBounds.

/**
     * @generated
     */
public void refreshBounds() {
    IFigure refFigure = ((GraphicalEditPart) getParent()).getFigure();
    int dx = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
    int dy = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
    Point offset = new Point(dx, dy);
    getFigure().getParent().setConstraint(getFigure(), new LabelLocator(refFigure, offset, getKeyPoint()) {

        public void relocate(IFigure target) {
            Point location = getReferencePoint().getTranslated(getOffset());
            location.translate(-target.getBounds().width / 2, 0);
            target.setLocation(location);
            target.setSize(new Dimension(target.getPreferredSize().width, target.getPreferredSize().height));
        }

        protected Point getReferencePoint() {
            return getLabelLocation(parent);
        }
    });
}
Also used : LabelLocator(org.eclipse.gmf.runtime.diagram.ui.figures.LabelLocator) Point(org.eclipse.draw2d.geometry.Point) Dimension(org.eclipse.draw2d.geometry.Dimension) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) Point(org.eclipse.draw2d.geometry.Point) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)36 ArrayList (java.util.ArrayList)14 List (java.util.List)14 Command (org.eclipse.gef.commands.Command)13 Request (org.eclipse.gef.Request)12 AbstractGraphicalEditPart (org.eclipse.gef.editparts.AbstractGraphicalEditPart)12 Rectangle (org.eclipse.draw2d.geometry.Rectangle)11 NonResizableEditPolicy (org.eclipse.gef.editpolicies.NonResizableEditPolicy)11 DirectEditRequest (org.eclipse.gef.requests.DirectEditRequest)11 IGraphicalEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)11 LabelDirectEditPolicy (org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy)11 IFigure (org.eclipse.draw2d.IFigure)10 Point (org.eclipse.draw2d.geometry.Point)10 Dimension (org.eclipse.draw2d.geometry.Dimension)6 EditPart (org.eclipse.gef.EditPart)3 HANode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.HANode)2 HANodePart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HANodePart)2 Iterator (java.util.Iterator)2 UnexecutableCommand (org.eclipse.gef.commands.UnexecutableCommand)2 NodeContainer (org.talend.designer.core.ui.editor.nodecontainer.NodeContainer)2