org.eclipse.gef.requests.BendpointRequest Java Examples
The following examples show how to use
org.eclipse.gef.requests.BendpointRequest.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ERDiagramBendpointEditPolicy.java From ermasterr with Apache License 2.0 | 6 votes |
/** * {@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; }
Example #2
Source File: ERDiagramBendpointEditPolicy.java From ermaster-b with Apache License 2.0 | 6 votes |
/** * {@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; }
Example #3
Source File: ERDiagramBendpointEditPolicy.java From erflute with Apache License 2.0 | 6 votes |
@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; }
Example #4
Source File: ERDiagramBendpointEditPolicy.java From ermasterr with Apache License 2.0 | 5 votes |
/** * {@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; }
Example #5
Source File: RelationBendpointEditPolicy.java From ermaster-b with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override protected void showCreateBendpointFeedback(BendpointRequest bendpointrequest) { Relation relation = (Relation) getHost().getModel(); if (relation.getSource() == relation.getTarget()) { return; } super.showCreateBendpointFeedback(bendpointrequest); }
Example #6
Source File: ERDiagramBendpointEditPolicy.java From ermaster-b with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override protected Command getMoveBendpointCommand(BendpointRequest bendpointrequest) { ConnectionEditPart editPart = (ConnectionEditPart) this.getHost(); Point point = bendpointrequest.getLocation(); this.getConnection().translateToRelative(point); MoveBendpointCommand command = new MoveBendpointCommand(editPart, point.x, point.y, bendpointrequest.getIndex()); return command; }
Example #7
Source File: ERDiagramBendpointEditPolicy.java From ermaster-b with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override protected Command getDeleteBendpointCommand( BendpointRequest bendpointrequest) { ConnectionElement connection = (ConnectionElement) getHost().getModel(); if (connection.getSource() == connection.getTarget()) { return null; } DeleteBendpointCommand command = new DeleteBendpointCommand(connection, bendpointrequest.getIndex()); return command; }
Example #8
Source File: RelationBendpointEditPolicy.java From erflute with Apache License 2.0 | 5 votes |
@Override protected void showCreateBendpointFeedback(BendpointRequest bendpointrequest) { final Relationship relation = (Relationship) getHost().getModel(); if (relation.getSourceWalker() == relation.getTargetWalker()) { return; } super.showCreateBendpointFeedback(bendpointrequest); }
Example #9
Source File: ERDiagramBendpointEditPolicy.java From erflute with Apache License 2.0 | 5 votes |
@Override protected Command getMoveBendpointCommand(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; }
Example #10
Source File: ERDiagramBendpointEditPolicy.java From erflute with Apache License 2.0 | 5 votes |
@Override protected Command getDeleteBendpointCommand(BendpointRequest bendpointrequest) { final WalkerConnection connection = (WalkerConnection) getHost().getModel(); if (connection.getSourceWalker() == connection.getTargetWalker()) { return null; } final DeleteBendpointCommand command = new DeleteBendpointCommand(connection, bendpointrequest.getIndex()); return command; }
Example #11
Source File: InitialPointsConnectionBendpointEditPolicy.java From statecharts with Eclipse Public License 1.0 | 5 votes |
@Override protected void eraseConnectionFeedback(BendpointRequest request, boolean removeFeedbackFigure) { super.eraseConnectionFeedback(request, removeFeedbackFigure); if (removeFeedbackFigure) { initialPointsManager.eraseInitialPoints(getConnection()); } }
Example #12
Source File: InitialPointsConnectionBendpointEditPolicy.java From statecharts with Eclipse Public License 1.0 | 5 votes |
@Override protected Command getBendpointsChangedCommand(BendpointRequest request) { PointList originalPoints = InitialPointsOfRequestDataManager.getOriginalPoints(request); Command result = super.getBendpointsChangedCommand(request); if (result instanceof ICommandProxy) { ICommand iCommand = ((ICommandProxy) result).getICommand(); if (iCommand instanceof SetConnectionBendpointsAndLabelCommmand) { ((SetConnectionBendpointsAndLabelCommmand) iCommand).setLabelsToUpdate( (org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart) getHost(), originalPoints); } } return result; }
Example #13
Source File: RelationBendpointEditPolicy.java From ermasterr with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override protected void showCreateBendpointFeedback(final BendpointRequest bendpointrequest) { final Relation relation = (Relation) getHost().getModel(); if (relation.getSource() == relation.getTarget()) { return; } super.showCreateBendpointFeedback(bendpointrequest); }
Example #14
Source File: ERDiagramBendpointEditPolicy.java From ermasterr with Apache License 2.0 | 5 votes |
/** * {@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; }
Example #15
Source File: InitialPointsConnectionBendpointEditPolicy.java From statecharts with Eclipse Public License 1.0 | 4 votes |
@Override protected void showMoveLineSegFeedback(BendpointRequest request) { initialPointsManager.storeInitialPointsInRequest(request, (ConnectionEditPart) getHost()); super.showMoveLineSegFeedback(request); }
Example #16
Source File: InitialPointsConnectionBendpointEditPolicy.java From statecharts with Eclipse Public License 1.0 | 4 votes |
@Override protected void showCreateBendpointFeedback(BendpointRequest request) { initialPointsManager.storeInitialPointsInRequest(request, (ConnectionEditPart) getHost()); super.showCreateBendpointFeedback(request); }
Example #17
Source File: InitialPointsConnectionBendpointEditPolicy.java From statecharts with Eclipse Public License 1.0 | 4 votes |
@Override protected void showMoveBendpointFeedback(BendpointRequest request) { initialPointsManager.storeInitialPointsInRequest(request, (ConnectionEditPart) getHost()); super.showMoveBendpointFeedback(request); }
Example #18
Source File: RelationBendpointEditPolicy.java From erflute with Apache License 2.0 | 4 votes |
@Override protected void showMoveBendpointFeedback(BendpointRequest bendpointrequest) { final Relationship relation = (Relationship) getHost().getModel(); final RelationEditPart editPart = (RelationEditPart) getHost(); if (relation.getSourceWalker() == relation.getTargetWalker()) { if (bendpointrequest.getIndex() != 1) { return; } final Point point = bendpointrequest.getLocation(); getConnection().translateToRelative(point); final Bendpoint rate = getRate(point); rate.setRelative(true); final float rateX = (100f - (rate.getX() / 2)) / 100; final float rateY = (100f - (rate.getY() / 2)) / 100; final ERTableEditPart tableEditPart = (ERTableEditPart) editPart.getSource(); final Rectangle bounds = tableEditPart.getFigure().getBounds(); final Rectangle rect = new Rectangle(); rect.x = (int) (bounds.x + (bounds.width * rateX)); rect.y = (int) (bounds.y + (bounds.height * rateY)); rect.width = (int) (bounds.width * rate.getX() / 100); rect.height = (int) (bounds.height * rate.getY() / 100); relation.setSourceLocationp(100, (int) (100 * rateY)); relation.setTargetLocationp((int) (100 * rateX), 100); final LayerManager manager = (LayerManager) tableEditPart.getRoot(); final IFigure layer = manager.getLayer(LayerConstants.PRIMARY_LAYER); getFeedbackLayer().setBounds(layer.getBounds()); final List<?> children = getFeedbackLayer().getChildren(); children.clear(); getFeedbackLayer().repaint(); final ZoomManager zoomManager = ((ScalableFreeformRootEditPart) getHost().getRoot()).getZoomManager(); final double zoom = zoomManager.getZoom(); final Polyline feedbackFigure = new Polyline(); feedbackFigure.addPoint(new Point((int) (rect.x * zoom), (int) (rect.y * zoom))); feedbackFigure.addPoint(new Point((int) (rect.x * zoom), (int) ((rect.y + rect.height) * zoom))); feedbackFigure.addPoint(new Point((int) ((rect.x + rect.width) * zoom), (int) ((rect.y + rect.height) * zoom))); feedbackFigure.addPoint(new Point((int) ((rect.x + rect.width) * zoom), (int) (rect.y * zoom))); feedbackFigure.addPoint(new Point((int) (rect.x * zoom), (int) (rect.y * zoom))); feedbackFigure.setLineStyle(SWT.LINE_DASH); feedbackFigure.translateToRelative(feedbackFigure.getLocation()); addFeedback(feedbackFigure); } else { super.showMoveBendpointFeedback(bendpointrequest); } }
Example #19
Source File: RelationBendpointEditPolicy.java From erflute with Apache License 2.0 | 4 votes |
@Override protected void eraseConnectionFeedback(BendpointRequest request) { getFeedbackLayer().getChildren().clear(); super.eraseConnectionFeedback(request); }
Example #20
Source File: RelationBendpointEditPolicy.java From ermasterr with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override protected void eraseConnectionFeedback(final BendpointRequest request) { getFeedbackLayer().getChildren().clear(); super.eraseConnectionFeedback(request); }
Example #21
Source File: RelationBendpointEditPolicy.java From ermasterr with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override protected void showMoveBendpointFeedback(final BendpointRequest bendpointrequest) { final Relation relation = (Relation) getHost().getModel(); final RelationEditPart editPart = (RelationEditPart) getHost(); if (relation.getSource() == relation.getTarget()) { if (bendpointrequest.getIndex() != 1) { return; } final Point point = bendpointrequest.getLocation(); getConnection().translateToRelative(point); final Bendpoint rate = getRate(point); rate.setRelative(true); final float rateX = (100f - (rate.getX() / 2)) / 100; final float rateY = (100f - (rate.getY() / 2)) / 100; final ERTableEditPart tableEditPart = (ERTableEditPart) editPart.getSource(); final Rectangle bounds = tableEditPart.getFigure().getBounds(); final Rectangle rect = new Rectangle(); rect.x = (int) (bounds.x + (bounds.width * rateX)); rect.y = (int) (bounds.y + (bounds.height * rateY)); rect.width = bounds.width * rate.getX() / 100; rect.height = bounds.height * rate.getY() / 100; relation.setSourceLocationp(100, (int) (100 * rateY)); relation.setTargetLocationp((int) (100 * rateX), 100); final LayerManager manager = (LayerManager) tableEditPart.getRoot(); final IFigure layer = manager.getLayer(LayerConstants.PRIMARY_LAYER); getFeedbackLayer().setBounds(layer.getBounds()); final List children = getFeedbackLayer().getChildren(); children.clear(); getFeedbackLayer().repaint(); final ZoomManager zoomManager = ((ScalableFreeformRootEditPart) getHost().getRoot()).getZoomManager(); final double zoom = zoomManager.getZoom(); final Polyline feedbackFigure = new Polyline(); feedbackFigure.addPoint(new Point((int) (rect.x * zoom), (int) (rect.y * zoom))); feedbackFigure.addPoint(new Point((int) (rect.x * zoom), (int) ((rect.y + rect.height) * zoom))); feedbackFigure.addPoint(new Point((int) ((rect.x + rect.width) * zoom), (int) ((rect.y + rect.height) * zoom))); feedbackFigure.addPoint(new Point((int) ((rect.x + rect.width) * zoom), (int) (rect.y * zoom))); feedbackFigure.addPoint(new Point((int) (rect.x * zoom), (int) (rect.y * zoom))); feedbackFigure.setLineStyle(SWT.LINE_DASH); feedbackFigure.translateToRelative(feedbackFigure.getLocation()); addFeedback(feedbackFigure); } else { super.showMoveBendpointFeedback(bendpointrequest); } }
Example #22
Source File: RelationBendpointEditPolicy.java From ermaster-b with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override protected void showMoveBendpointFeedback(BendpointRequest bendpointrequest) { Relation relation = (Relation) getHost().getModel(); RelationEditPart editPart = (RelationEditPart) this.getHost(); if (relation.getSource() == relation.getTarget()) { if (bendpointrequest.getIndex() != 1) { return; } Point point = bendpointrequest.getLocation(); this.getConnection().translateToRelative(point); Bendpoint rate = this.getRate(point); rate.setRelative(true); float rateX = (100f - (rate.getX() / 2)) / 100; float rateY = (100f - (rate.getY() / 2)) / 100; ERTableEditPart tableEditPart = (ERTableEditPart) editPart .getSource(); Rectangle bounds = tableEditPart.getFigure().getBounds(); Rectangle rect = new Rectangle(); rect.x = (int) (bounds.x + (bounds.width * rateX)); rect.y = (int) (bounds.y + (bounds.height * rateY)); rect.width = (int) (bounds.width * rate.getX() / 100); rect.height = (int) (bounds.height * rate.getY() / 100); relation.setSourceLocationp(100, (int) (100 * rateY)); relation.setTargetLocationp((int) (100 * rateX), 100); LayerManager manager = (LayerManager) tableEditPart.getRoot(); IFigure layer = manager.getLayer(LayerConstants.PRIMARY_LAYER); this.getFeedbackLayer().setBounds(layer.getBounds()); List children = this.getFeedbackLayer().getChildren(); children.clear(); this.getFeedbackLayer().repaint(); ZoomManager zoomManager = ((ScalableFreeformRootEditPart) this .getHost().getRoot()).getZoomManager(); double zoom = zoomManager.getZoom(); Polyline feedbackFigure = new Polyline(); feedbackFigure.addPoint(new Point((int) (rect.x * zoom), (int) (rect.y * zoom))); feedbackFigure.addPoint(new Point((int) (rect.x * zoom), (int) ((rect.y + rect.height) * zoom))); feedbackFigure.addPoint(new Point( (int) ((rect.x + rect.width) * zoom), (int) ((rect.y + rect.height) * zoom))); feedbackFigure .addPoint(new Point((int) ((rect.x + rect.width) * zoom), (int) (rect.y * zoom))); feedbackFigure.addPoint(new Point((int) (rect.x * zoom), (int) (rect.y * zoom))); feedbackFigure.setLineStyle(SWT.LINE_DASH); feedbackFigure.translateToRelative(feedbackFigure.getLocation()); this.addFeedback(feedbackFigure); } else { super.showMoveBendpointFeedback(bendpointrequest); } }
Example #23
Source File: RelationBendpointEditPolicy.java From ermaster-b with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override protected void eraseConnectionFeedback(BendpointRequest request) { this.getFeedbackLayer().getChildren().clear(); super.eraseConnectionFeedback(request); }