@Override protected Command getMoveBendpointCommand(BendpointRequest request) { Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport(); Point viewSize = vp.getViewLocation(); Point p = request.getLocation(); p.setX(p.x + viewSize.x); p.setY(p.y + viewSize.y); BendpointMoveCommand cmd = new BendpointMoveCommand(); cmd.setLink((Link) request.getSource().getModel()); cmd.setIndex(request.getIndex()); cmd.setNewLocation(p); return cmd; }
protected Command getCreateBendpointCommand(BendpointRequest request) { CreateBendpointCommand com = new CreateBendpointCommand(); Point p = request.getLocation(); conn = getConnection(); conn.translateToRelative(p); com.setLocation(p); Point ref1 = conn.getSourceAnchor().getReferencePoint(); Point ref2 = conn.getTargetAnchor().getReferencePoint(); conn.translateToRelative(ref1); conn.translateToRelative(ref2); com.setRelativeDimensions(p.getDifference(ref1), p.getDifference(ref2)); com.setConn((Connection) request.getSource().getModel()); com.setIndex(request.getIndex()); return com; }
protected Command getMoveBendpointCommand(BendpointRequest request) { MoveBendpointCommand com = new MoveBendpointCommand(); Point p = request.getLocation(); conn = getConnection(); conn.translateToRelative(p); com.setLocation(p); Point ref1 = getConnection().getSourceAnchor().getReferencePoint(); Point ref2 = getConnection().getTargetAnchor().getReferencePoint(); conn.translateToRelative(ref1); conn.translateToRelative(ref2); com.setRelativeDimensions(p.getDifference(ref1), p.getDifference(ref2)); com.setConn((Connection) request.getSource().getModel()); com.setIndex(request.getIndex()); return com; }
/** * {@inheritDoc} */ @Override protected Command getCreateBendpointCommand(final BendpointRequest bendpointrequest) { final AbstractConnectionEditPart connectionEditPart = (AbstractConnectionEditPart) getHost(); final ConnectionElement connection = (ConnectionElement) connectionEditPart.getModel(); if (connection.getSource() == connection.getTarget()) { return null; } final Point point = bendpointrequest.getLocation(); getConnection().translateToRelative(point); final CreateBendpointCommand createBendpointCommand = new CreateBendpointCommand(connection, point.x, point.y, bendpointrequest.getIndex()); return createBendpointCommand; }
/** * {@inheritDoc} */ @Override protected Command getCreateBendpointCommand( BendpointRequest bendpointrequest) { AbstractConnectionEditPart connectionEditPart = (AbstractConnectionEditPart) this .getHost(); ConnectionElement connection = (ConnectionElement) connectionEditPart .getModel(); if (connection.getSource() == connection.getTarget()) { return null; } Point point = bendpointrequest.getLocation(); this.getConnection().translateToRelative(point); CreateBendpointCommand createBendpointCommand = new CreateBendpointCommand( this.diagram.getCurrentCategory(), connection, point.x, point.y, bendpointrequest.getIndex()); return createBendpointCommand; }
/** * setReferencePoints * * @param request void */ private void setReferencePoints(BendpointRequest request) { PointList points = getConnection().getPoints(); int bpIndex = -1; List bendPoints = (List)getConnection().getRoutingConstraint(); Point bp = ((Bendpoint)bendPoints.get(request.getIndex())).getLocation(); int smallestDistance = -1; for (int i = 0; i < points.size(); i++) { if (smallestDistance == -1 || points.getPoint(i).getDistance2(bp) < smallestDistance) { bpIndex = i; smallestDistance = points.getPoint(i).getDistance2(bp); if (smallestDistance == 0) break; } } points.getPoint(ref1, bpIndex - 1); getConnection().translateToAbsolute(ref1); points.getPoint(ref2, bpIndex + 1); getConnection().translateToAbsolute(ref2); }
/** * Shows feedback when a bendpoint is being created. The original figure is used for * feedback and the original constraint is saved, so that it can be restored when feedback * is erased. * @param request the BendpointRequest */ protected void showCreateBendpointFeedback(BendpointRequest request) { Point p = new Point(request.getLocation()); List constraint; getConnection().translateToRelative(p); Bendpoint bp = new AbsoluteBendpoint(p); if (originalConstraint == null) { saveOriginalConstraint(); constraint = (List)getConnection().getRoutingConstraint(); constraint.add(request.getIndex(), bp); } else { constraint = (List)getConnection().getRoutingConstraint(); } constraint.set(request.getIndex(), bp); getConnection().setRoutingConstraint(constraint); }
/** * Shows feedback when a bendpoint is being moved. Also checks to see if the bendpoint * should be deleted and then calls {@link #showDeleteBendpointFeedback(BendpointRequest)} * if needed. The original figure is used for feedback and the original constraint is * saved, so that it can be restored when feedback is erased. * @param request the BendpointRequest */ protected void showMoveBendpointFeedback(BendpointRequest request) { Point p = new Point(request.getLocation()); if (!isDeleting) setReferencePoints(request); if (lineContainsPoint(ref1, ref2, p)) { if (!isDeleting) { isDeleting = true; eraseSourceFeedback(request); showDeleteBendpointFeedback(request); } return; } if (isDeleting) { isDeleting = false; eraseSourceFeedback(request); } if (originalConstraint == null) saveOriginalConstraint(); List constraint = (List)getConnection().getRoutingConstraint(); getConnection().translateToRelative(p); Bendpoint bp = new AbsoluteBendpoint(p); constraint.set(request.getIndex(), bp); getConnection().setRoutingConstraint(constraint); }
/** * @see org.eclipse.gef.editpolicies.BendpointEditPolicy#showCreateBendpointFeedback(org.eclipse.gef.requests.BendpointRequest) */ @Override protected void showCreateBendpointFeedback(BendpointRequest request) { IFigure feedback = getDragSourceFeedbackFigure(); Rectangle bounds = new Rectangle(getInitialFeedbackBounds().getCopy()); PrecisionRectangle rect = new PrecisionRectangle(bounds); getHostFigure().translateToAbsolute(rect); Point movePoint = request.getLocation(); movePoint.x = ((GraphicalEditPart) getHost()).getFigure().getBounds().x;//movePoint.x - rect.getSize().width / 2; rect.setLocation(movePoint); feedback.translateToRelative(rect); feedback.setBounds(rect); }
@Override protected Command getCreateBendpointCommand(BendpointRequest bendpointrequest) { final AbstractConnectionEditPart connectionEditPart = (AbstractConnectionEditPart) getHost(); final WalkerConnection connection = (WalkerConnection) connectionEditPart.getModel(); if (connection.getSourceWalker() == connection.getTargetWalker()) { return null; } final Point point = bendpointrequest.getLocation(); getConnection().translateToRelative(point); final CreateBendpointCommand createBendpointCommand = new CreateBendpointCommand(connection, point.x, point.y, bendpointrequest.getIndex()); return createBendpointCommand; }
/** * {@inheritDoc} */ @Override protected Command getCreateBendpointCommand( BendpointRequest bendpointrequest) { AbstractConnectionEditPart connectionEditPart = (AbstractConnectionEditPart) this .getHost(); ConnectionElement connection = (ConnectionElement) connectionEditPart .getModel(); if (connection.getSource() == connection.getTarget()) { return null; } Point point = bendpointrequest.getLocation(); this.getConnection().translateToRelative(point); CreateBendpointCommand createBendpointCommand = new CreateBendpointCommand( connection, point.x, point.y, bendpointrequest.getIndex()); return createBendpointCommand; }
private void setReferencePoints(BendpointRequest request) { PointList points = getConnection().getPoints(); int bpIndex = -1; List bendPoints = (List) getConnection().getRoutingConstraint(); Point bp = ((Bendpoint) bendPoints.get(request.getIndex())) .getLocation(); int smallestDistance = -1; for (int i = 0; i < points.size(); i++) { if (smallestDistance == -1 || points.getPoint(i).getDistance2(bp) < smallestDistance) { bpIndex = i; smallestDistance = points.getPoint(i).getDistance2(bp); if (smallestDistance == 0) break; } } points.getPoint(ref1, bpIndex - 1); getConnection().translateToAbsolute(ref1); points.getPoint(ref2, bpIndex + 1); getConnection().translateToAbsolute(ref2); }
/** * Shows feedback when a bendpoint is being created. The original figure is * used for feedback and the original constraint is saved, so that it can be * restored when feedback is erased. * * @param request * the BendpointRequest */ protected void showCreateBendpointFeedback(BendpointRequest request) { Point p = new Point(request.getLocation()); List constraint; getConnection().translateToRelative(p); Bendpoint bp = new AbsoluteBendpoint(p); if (originalConstraint == null) { saveOriginalConstraint(); constraint = (List) getConnection().getRoutingConstraint(); constraint.add(request.getIndex(), bp); } else { constraint = (List) getConnection().getRoutingConstraint(); } constraint.set(request.getIndex(), bp); getConnection().setRoutingConstraint(constraint); }
/** * Shows feedback when a bendpoint is being moved. Also checks to see if the * bendpoint should be deleted and then calls * {@link #showDeleteBendpointFeedback(BendpointRequest)} if needed. The * original figure is used for feedback and the original constraint is * saved, so that it can be restored when feedback is erased. * * @param request * the BendpointRequest */ protected void showMoveBendpointFeedback(BendpointRequest request) { Point p = new Point(request.getLocation()); if (!isDeleting) setReferencePoints(request); if (lineContainsPoint(ref1, ref2, p)) { if (!isDeleting) { isDeleting = true; eraseSourceFeedback(request); showDeleteBendpointFeedback(request); } return; } if (isDeleting) { isDeleting = false; eraseSourceFeedback(request); } if (originalConstraint == null) saveOriginalConstraint(); List constraint = (List) getConnection().getRoutingConstraint(); getConnection().translateToRelative(p); Bendpoint bp = new AbsoluteBendpoint(p); constraint.set(request.getIndex(), bp); getConnection().setRoutingConstraint(constraint); }
/** * This method creats and returns a command for changing the position of a {@link Bendpoint}. * * @return {@link ORMRelationMoveBendpointCommand} */ @Override protected Command getMoveBendpointCommand(final BendpointRequest request) { final ORMRelationMoveBendpointCommand command = new ORMRelationMoveBendpointCommand(); Point p = request.getLocation(); Connection conn = getConnection(); conn.translateToRelative(p); Point sourceP = conn.getSourceAnchor().getReferencePoint(); Point targetP = conn.getTargetAnchor().getReferencePoint(); conn.translateToRelative(sourceP); conn.translateToRelative(targetP); command.setRelation((Relation) request.getSource().getModel()); command.setNewDimension(p.getDifference(sourceP), p.getDifference(targetP)); command.setIndex(request.getIndex()); return command; }
protected Command getCreateBendpointCommand(BendpointRequest request) { CreateBendpointCommand cmd = new CreateBendpointCommand(); Point p = request.getLocation(); Connection conn = (Connection) getConnection(); conn.translateToRelative(p); Point ref1 = getConnection().getSourceAnchor().getReferencePoint(); Point ref2 = getConnection().getTargetAnchor().getReferencePoint(); conn.translateToRelative(ref1); conn.translateToRelative(ref2); cmd.setRelativeDimensions(p.getDifference(ref1), p.getDifference(ref2)); cmd.setConnection((com.wt.studio.plugin.modeldesigner.editor.model.NodeConnection) request.getSource() .getModel()); cmd.setIndex(request.getIndex()); return cmd; }
protected Command getMoveBendpointCommand(BendpointRequest request) { MoveBendpointCommand cmd = new MoveBendpointCommand(); Point p = request.getLocation(); Connection conn = getConnection(); conn.translateToRelative(p); Point ref1 = getConnection().getSourceAnchor().getReferencePoint(); Point ref2 = getConnection().getTargetAnchor().getReferencePoint(); conn.translateToRelative(ref1); conn.translateToRelative(ref2); cmd.setRelativeDimensions(p.getDifference(ref1), p.getDifference(ref2)); cmd.setConnection((com.wt.studio.plugin.modeldesigner.editor.model.NodeConnection) request.getSource() .getModel()); cmd.setIndex(request.getIndex()); return cmd; }
protected Command getCreateBendpointCommand(BendpointRequest request) { CreateBendpointCommand cmd = new CreateBendpointCommand(); Point p = request.getLocation(); Connection conn = (Connection) getConnection(); conn.translateToRelative(p); Point ref1 = getConnection().getSourceAnchor().getReferencePoint(); Point ref2 = getConnection().getTargetAnchor().getReferencePoint(); conn.translateToRelative(ref1); conn.translateToRelative(ref2); cmd.setRelativeDimensions(p.getDifference(ref1), p.getDifference(ref2)); cmd.setConnection((ColumnConnection)request.getSource() .getModel()); cmd.setIndex(request.getIndex()); return cmd; }
protected Command getMoveBendpointCommand(BendpointRequest request) { MoveBendpointCommand cmd = new MoveBendpointCommand(); Point p = request.getLocation(); Connection conn = getConnection(); conn.translateToRelative(p); Point ref1 = getConnection().getSourceAnchor().getReferencePoint(); Point ref2 = getConnection().getTargetAnchor().getReferencePoint(); conn.translateToRelative(ref1); conn.translateToRelative(ref2); cmd.setRelativeDimensions(p.getDifference(ref1), p.getDifference(ref2)); cmd.setConnection((ColumnConnection) request.getSource() .getModel()); cmd.setIndex(request.getIndex()); return cmd; }
@Override protected Command getCreateBendpointCommand(BendpointRequest request) { Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport(); Point viewSize = vp.getViewLocation(); Point p = request.getLocation(); p.setX(p.x + viewSize.x); p.setY(p.y + viewSize.y); BendpointCreateCommand cmd = new BendpointCreateCommand(); cmd.setLink((Link) request.getSource().getModel()); cmd.setLocation(p); cmd.setIndex(request.getIndex()); return cmd; }
@Override protected Command getDeleteBendpointCommand(BendpointRequest request) { Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport(); Point viewSize = vp.getViewLocation(); Point p = request.getLocation(); p.setX(p.x + viewSize.x); p.setY(p.y + viewSize.y); BendpointDeleteCommand cmd = new BendpointDeleteCommand(); cmd.setLink((Link) request.getSource().getModel()); cmd.setLocation(p); cmd.setIndex(request.getIndex()); return cmd; }
@Override protected Command getCreateBendpointCommand(BendpointRequest request) { Viewport vp = ((FigureCanvas) request.getSource().getViewer().getControl()).getViewport(); Point viewSize = vp.getViewLocation(); Point p = request.getLocation(); p.setX(p.x + viewSize.x); p.setY(p.y + viewSize.y); BendpointCreateCommand cmd = new BendpointCreateCommand(); cmd.setLink((Link) request.getSource().getModel()); cmd.setLocation(p); cmd.setIndex(request.getIndex()); return cmd; }
@Override protected Command getDeleteBendpointCommand(BendpointRequest request) { Viewport vp = ((FigureCanvas) request.getSource().getViewer().getControl()).getViewport(); Point viewSize = vp.getViewLocation(); Point p = request.getLocation(); p.setX(p.x + viewSize.x); p.setY(p.y + viewSize.y); BendpointDeleteCommand cmd = new BendpointDeleteCommand(); cmd.setLink((Link) request.getSource().getModel()); cmd.setLocation(p); cmd.setIndex(request.getIndex()); return cmd; }
@Override protected Command getMoveBendpointCommand(BendpointRequest request) { Viewport vp = ((FigureCanvas) request.getSource().getViewer().getControl()).getViewport(); Point viewSize = vp.getViewLocation(); Point p = request.getLocation(); p.setX(p.x + viewSize.x); p.setY(p.y + viewSize.y); BendpointMoveCommand cmd = new BendpointMoveCommand(); cmd.setLink((Link) request.getSource().getModel()); cmd.setIndex(request.getIndex()); cmd.setNewLocation(p); return cmd; }
/** * {@inheritDoc} */ @Override protected Command getCreateBendpointCommand(final BendpointRequest request) { LinkCreateBendpointCommand command = new LinkCreateBendpointCommand(); Point p = request.getLocation(); command.setLink((GWLink) request.getSource().getModel()); command.setLocation(p); command.setIndex(request.getIndex()); return command; }
/** * {@inheritDoc} */ @Override protected Command getMoveBendpointCommand(final BendpointRequest request) { LinkMoveBendpointCommand command = new LinkMoveBendpointCommand(); Point p = request.getLocation(); command.setLink((GWLink) request.getSource().getModel()); command.setLocation(p); command.setIndex(request.getIndex()); return command; }
/** * {@inheritDoc} */ @Override protected Command getDeleteBendpointCommand(final BendpointRequest request) { LinkDeleteBendpointCommand command = new LinkDeleteBendpointCommand(); command.setLink((GWLink) request.getSource().getModel()); command.setIndex(request.getIndex()); return command; }
@Override protected Command getCreateBendpointCommand(BendpointRequest request) { CreateBendpointCommand command=new CreateBendpointCommand(); Point point = request.getLocation(); int index=request.getIndex(); Transition transition=(Transition)getHost().getModel(); command.setIndex(index); command.setPoint(point); command.setTransition(transition); return command; }
@Override protected Command getDeleteBendpointCommand(BendpointRequest request) { DeleteBendpointCommand command=new DeleteBendpointCommand(); int index=request.getIndex(); Transition transition=(Transition)getHost().getModel(); command.setIndex(index); command.setTransition(transition); return command; }
@Override protected Command getMoveBendpointCommand(BendpointRequest request) { MoveBendpointCommand command=new MoveBendpointCommand(); Point point = request.getLocation(); int index=request.getIndex(); Transition transition=(Transition)getHost().getModel(); command.setIndex(index); command.setPoint(point); command.setTransition(transition); return command; }
protected Command getDeleteBendpointCommand(BendpointRequest request) { BaseBendpointCommand com = new DeleteBendpointCommand(); Point p = request.getLocation(); com.setLocation(p); com.setConn((Connection) request.getSource().getModel()); com.setIndex(request.getIndex()); return com; }
/** * {@inheritDoc} */ @Override protected Command getDeleteBendpointCommand(final BendpointRequest bendpointrequest) { final ConnectionElement connection = (ConnectionElement) getHost().getModel(); if (connection.getSource() == connection.getTarget()) { return null; } final DeleteBendpointCommand command = new DeleteBendpointCommand(connection, bendpointrequest.getIndex()); return command; }
/** * {@inheritDoc} */ @Override protected Command getMoveBendpointCommand(final BendpointRequest bendpointrequest) { final ConnectionEditPart editPart = (ConnectionEditPart) getHost(); final Point point = bendpointrequest.getLocation(); getConnection().translateToRelative(point); final MoveBendpointCommand command = new MoveBendpointCommand(editPart, point.x, point.y, bendpointrequest.getIndex()); return command; }
/** * {@inheritDoc} */ @Override protected void showCreateBendpointFeedback(final BendpointRequest bendpointrequest) { final Relation relation = (Relation) getHost().getModel(); if (relation.getSource() == relation.getTarget()) { return; } super.showCreateBendpointFeedback(bendpointrequest); }
/** * {@inheritDoc} */ @Override protected Command getDeleteBendpointCommand( BendpointRequest bendpointrequest) { ConnectionElement connection = (ConnectionElement) getHost().getModel(); if (connection.getSource() == connection.getTarget()) { return null; } DeleteBendpointCommand command = new DeleteBendpointCommand( diagram, connection, bendpointrequest.getIndex()); return command; }
/** * {@inheritDoc} */ @Override protected Command getMoveBendpointCommand(BendpointRequest bendpointrequest) { ConnectionEditPart editPart = (ConnectionEditPart) this.getHost(); Point point = bendpointrequest.getLocation(); this.getConnection().translateToRelative(point); MoveBendpointCommand command = new MoveBendpointCommand( diagram, editPart, point.x, point.y, bendpointrequest.getIndex()); return command; }
/** * {@inheritDoc} */ @Override protected void showCreateBendpointFeedback(BendpointRequest bendpointrequest) { Relation relation = (Relation) getHost().getModel(); if (relation.getSource() == relation.getTarget()) { return; } super.showCreateBendpointFeedback(bendpointrequest); }