Java Code Examples for org.eclipse.gef.requests.ReconnectRequest#getTarget()
The following examples show how to use
org.eclipse.gef.requests.ReconnectRequest#getTarget() .
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: NodeElementEditPart.java From ermasterr with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override public ConnectionAnchor getSourceConnectionAnchor(final Request request) { if (request instanceof ReconnectRequest) { final ReconnectRequest reconnectRequest = (ReconnectRequest) request; final ConnectionEditPart connectionEditPart = reconnectRequest.getConnectionEditPart(); // if (!(connectionEditPart instanceof RelationEditPart)) { // return super.getSourceConnectionAnchor(request); // } final ConnectionElement connection = (ConnectionElement) connectionEditPart.getModel(); if (connection.getSource() == connection.getTarget()) { return new XYChopboxAnchor(getFigure()); } final EditPart editPart = reconnectRequest.getTarget(); if (editPart == null || !editPart.getModel().equals(connection.getSource())) { return new XYChopboxAnchor(getFigure()); } final Point location = new Point(reconnectRequest.getLocation()); getFigure().translateToRelative(location); final IFigure sourceFigure = ((TableViewEditPart) connectionEditPart.getSource()).getFigure(); final XYChopboxAnchor anchor = new XYChopboxAnchor(getFigure()); final Rectangle bounds = sourceFigure.getBounds(); final Rectangle centerRectangle = new Rectangle(bounds.x + (bounds.width / 4), bounds.y + (bounds.height / 4), bounds.width / 2, bounds.height / 2); if (!centerRectangle.contains(location)) { final Point point = getIntersectionPoint(location, sourceFigure); anchor.setLocation(point); } return anchor; } else if (request instanceof CreateConnectionRequest) { final CreateConnectionRequest connectionRequest = (CreateConnectionRequest) request; final Command command = connectionRequest.getStartCommand(); if (command instanceof CreateCommentConnectionCommand) { return new ChopboxAnchor(getFigure()); } } return new XYChopboxAnchor(getFigure()); }
Example 2
Source File: NodeElementEditPart.java From ermasterr with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override public ConnectionAnchor getTargetConnectionAnchor(final Request request) { if (request instanceof ReconnectRequest) { final ReconnectRequest reconnectRequest = (ReconnectRequest) request; final ConnectionEditPart connectionEditPart = reconnectRequest.getConnectionEditPart(); // if (!(connectionEditPart instanceof RelationEditPart)) { // return super.getTargetConnectionAnchor(request); // } final ConnectionElement connection = (ConnectionElement) connectionEditPart.getModel(); if (connection.getSource() == connection.getTarget()) { return new XYChopboxAnchor(getFigure()); } final EditPart editPart = reconnectRequest.getTarget(); if (editPart == null || !editPart.getModel().equals(connection.getTarget())) { return new XYChopboxAnchor(getFigure()); } final Point location = new Point(reconnectRequest.getLocation()); getFigure().translateToRelative(location); final IFigure targetFigure = ((AbstractModelEditPart) connectionEditPart.getTarget()).getFigure(); final XYChopboxAnchor anchor = new XYChopboxAnchor(getFigure()); final Rectangle bounds = targetFigure.getBounds(); final Rectangle centerRectangle = new Rectangle(bounds.x + (bounds.width / 4), bounds.y + (bounds.height / 4), bounds.width / 2, bounds.height / 2); if (!centerRectangle.contains(location)) { final Point point = getIntersectionPoint(location, targetFigure); anchor.setLocation(point); } return anchor; } else if (request instanceof CreateConnectionRequest) { final CreateConnectionRequest connectionRequest = (CreateConnectionRequest) request; final Command command = connectionRequest.getStartCommand(); if (command instanceof CreateCommentConnectionCommand) { return new ChopboxAnchor(getFigure()); } } return new XYChopboxAnchor(getFigure()); }
Example 3
Source File: TableViewEditPart.java From erflute with Apache License 2.0 | 4 votes |
@Override public ConnectionAnchor getSourceConnectionAnchor(Request request) { if (request instanceof ReconnectRequest) { final ReconnectRequest reconnectRequest = (ReconnectRequest) request; final ConnectionEditPart connectionEditPart = reconnectRequest.getConnectionEditPart(); if (!(connectionEditPart instanceof RelationEditPart)) { return super.getSourceConnectionAnchor(request); } final Relationship relation = (Relationship) connectionEditPart.getModel(); if (relation.getSourceWalker() == relation.getTargetWalker()) { return new XYChopboxAnchor(getFigure()); } final EditPart editPart = reconnectRequest.getTarget(); if (editPart == null || !editPart.getModel().equals(relation.getSourceWalker())) { return new XYChopboxAnchor(getFigure()); } final Point location = new Point(reconnectRequest.getLocation()); getFigure().translateToRelative(location); final IFigure sourceFigure = ((TableViewEditPart) connectionEditPart.getSource()).getFigure(); final Rectangle bounds = sourceFigure.getBounds(); final Rectangle centerRectangle = new Rectangle(bounds.x + (bounds.width / 4), bounds.y + (bounds.height / 4), bounds.width / 2, bounds.height / 2); final XYChopboxAnchor anchor = new XYChopboxAnchor(getFigure()); if (!centerRectangle.contains(location)) { final Point point = getIntersectionPoint(location, sourceFigure); anchor.setLocation(point); } return anchor; } else if (request instanceof CreateConnectionRequest) { final CreateConnectionRequest connectionRequest = (CreateConnectionRequest) request; final Command command = connectionRequest.getStartCommand(); if (command instanceof CreateCommentConnectionCommand) { return super.getTargetConnectionAnchor(request); } } return new XYChopboxAnchor(getFigure()); }
Example 4
Source File: TableViewEditPart.java From erflute with Apache License 2.0 | 4 votes |
@Override public ConnectionAnchor getTargetConnectionAnchor(Request request) { if (request instanceof ReconnectRequest) { final ReconnectRequest reconnectRequest = (ReconnectRequest) request; final ConnectionEditPart connectionEditPart = reconnectRequest.getConnectionEditPart(); if (!(connectionEditPart instanceof RelationEditPart)) { return super.getTargetConnectionAnchor(request); } final Relationship relation = (Relationship) connectionEditPart.getModel(); if (relation.getSourceWalker() == relation.getTargetWalker()) { return new XYChopboxAnchor(getFigure()); } final EditPart editPart = reconnectRequest.getTarget(); if (editPart == null || !editPart.getModel().equals(relation.getTargetWalker())) { return new XYChopboxAnchor(getFigure()); } final Point location = new Point(reconnectRequest.getLocation()); getFigure().translateToRelative(location); final IFigure targetFigure = ((TableViewEditPart) connectionEditPart.getTarget()).getFigure(); final Rectangle bounds = targetFigure.getBounds(); final Rectangle centerRectangle = new Rectangle(bounds.x + (bounds.width / 4), bounds.y + (bounds.height / 4), bounds.width / 2, bounds.height / 2); final XYChopboxAnchor anchor = new XYChopboxAnchor(getFigure()); if (!centerRectangle.contains(location)) { final Point point = getIntersectionPoint(location, targetFigure); anchor.setLocation(point); } return anchor; } else if (request instanceof CreateConnectionRequest) { final CreateConnectionRequest connectionRequest = (CreateConnectionRequest) request; final Command command = connectionRequest.getStartCommand(); if (command instanceof CreateCommentConnectionCommand) { return super.getTargetConnectionAnchor(request); } } return new XYChopboxAnchor(getFigure()); }
Example 5
Source File: TableViewEditPart.java From ermaster-b with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override public ConnectionAnchor getSourceConnectionAnchor(Request request) { if (request instanceof ReconnectRequest) { ReconnectRequest reconnectRequest = (ReconnectRequest) request; ConnectionEditPart connectionEditPart = reconnectRequest .getConnectionEditPart(); if (!(connectionEditPart instanceof RelationEditPart)) { return super.getSourceConnectionAnchor(request); } Relation relation = (Relation) connectionEditPart.getModel(); if (relation.getSource() == relation.getTarget()) { return new XYChopboxAnchor(this.getFigure()); } EditPart editPart = reconnectRequest.getTarget(); if (editPart == null || !editPart.getModel().equals(relation.getSource())) { return new XYChopboxAnchor(this.getFigure()); } Point location = new Point(reconnectRequest.getLocation()); this.getFigure().translateToRelative(location); IFigure sourceFigure = ((TableViewEditPart) connectionEditPart .getSource()).getFigure(); XYChopboxAnchor anchor = new XYChopboxAnchor(this.getFigure()); Rectangle bounds = sourceFigure.getBounds(); Rectangle centerRectangle = new Rectangle(bounds.x + (bounds.width / 4), bounds.y + (bounds.height / 4), bounds.width / 2, bounds.height / 2); if (!centerRectangle.contains(location)) { Point point = getIntersectionPoint(location, sourceFigure); anchor.setLocation(point); } return anchor; } else if (request instanceof CreateConnectionRequest) { CreateConnectionRequest connectionRequest = (CreateConnectionRequest) request; Command command = connectionRequest.getStartCommand(); if (command instanceof CreateCommentConnectionCommand) { return super.getTargetConnectionAnchor(request); } } return new XYChopboxAnchor(this.getFigure()); }
Example 6
Source File: TableViewEditPart.java From ermaster-b with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override public ConnectionAnchor getTargetConnectionAnchor(Request request) { if (request instanceof ReconnectRequest) { ReconnectRequest reconnectRequest = (ReconnectRequest) request; ConnectionEditPart connectionEditPart = reconnectRequest .getConnectionEditPart(); if (!(connectionEditPart instanceof RelationEditPart)) { return super.getTargetConnectionAnchor(request); } Relation relation = (Relation) connectionEditPart.getModel(); if (relation.getSource() == relation.getTarget()) { return new XYChopboxAnchor(this.getFigure()); } EditPart editPart = reconnectRequest.getTarget(); if (editPart == null || !editPart.getModel().equals(relation.getTarget())) { return new XYChopboxAnchor(this.getFigure()); } Point location = new Point(reconnectRequest.getLocation()); this.getFigure().translateToRelative(location); IFigure targetFigure = ((TableViewEditPart) connectionEditPart .getTarget()).getFigure(); XYChopboxAnchor anchor = new XYChopboxAnchor(this.getFigure()); Rectangle bounds = targetFigure.getBounds(); Rectangle centerRectangle = new Rectangle(bounds.x + (bounds.width / 4), bounds.y + (bounds.height / 4), bounds.width / 2, bounds.height / 2); if (!centerRectangle.contains(location)) { Point point = getIntersectionPoint(location, targetFigure); anchor.setLocation(point); } return anchor; } else if (request instanceof CreateConnectionRequest) { CreateConnectionRequest connectionRequest = (CreateConnectionRequest) request; Command command = connectionRequest.getStartCommand(); if (command instanceof CreateCommentConnectionCommand) { return super.getTargetConnectionAnchor(request); } } return new XYChopboxAnchor(this.getFigure()); }