org.eclipse.gef.requests.ReconnectRequest Java Examples
The following examples show how to use
org.eclipse.gef.requests.ReconnectRequest.
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: LinkPart.java From olca-app with Mozilla Public License 2.0 | 6 votes |
@Override public void showSourceFeedback(Request req) { ReconnectRequest request = ((ReconnectRequest) req); Link link = (Link) request.getConnectionEditPart().getModel(); ExchangeNode target = link.inputNode.getInput(link.processLink); ExchangeNode source = link.outputNode.getOutput(link.processLink); ExchangeNode n1 = request.isMovingStartAnchor() ? target : source; ExchangeNode n2 = request.isMovingStartAnchor() ? source : target; if (n1 != null) { ProductSystemNode productSystemNode = n1.parent().parent(); productSystemNode.highlightMatchingExchanges(n1); n1.setHighlighted(true); } if (n2 != null) n2.setHighlighted(true); super.showSourceFeedback(req); }
Example #2
Source File: DiagramWalkerGraphicalNodeEditPolicy.java From erflute with Apache License 2.0 | 5 votes |
@Override protected Command getReconnectSourceCommand(ReconnectRequest reconnectrequest) { final WalkerConnection connection = (WalkerConnection) reconnectrequest.getConnectionEditPart().getModel(); if (!(connection instanceof Relationship)) { return null; } final Relationship relation = (Relationship) connection; if (relation.getSourceWalker() == relation.getTargetWalker()) { return null; } final DiagramWalker newSource = ((DiagramWalker) reconnectrequest.getTarget().getModel()).toMaterialize(); if (!relation.getSourceWalker().equals(newSource)) { return null; } final DiagramWalkerEditPart sourceEditPart = (DiagramWalkerEditPart) reconnectrequest.getConnectionEditPart().getSource(); final Point location = new Point(reconnectrequest.getLocation()); final IFigure sourceFigure = sourceEditPart.getFigure(); sourceFigure.translateToRelative(location); int xp = -1; int yp = -1; 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 = ERTableEditPart.getIntersectionPoint(location, sourceFigure); xp = 100 * (point.x - bounds.x) / bounds.width; yp = 100 * (point.y - bounds.y) / bounds.height; } final ReconnectSourceCommand command = new ReconnectSourceCommand(relation, xp, yp); return command; }
Example #3
Source File: AbstractNodeEditPart.java From olca-app with Mozilla Public License 2.0 | 5 votes |
@Override public ConnectionAnchor getTargetConnectionAnchor(Request req) { if (req instanceof CreateConnectionRequest) return targetAnchor((CreateConnectionRequest) req); if (req instanceof ReconnectRequest) return targetAnchor((ReconnectRequest) req); return null; }
Example #4
Source File: AbstractNodeEditPart.java From olca-app with Mozilla Public License 2.0 | 5 votes |
private ConnectionAnchor sourceAnchor(ReconnectRequest req) { Link link = (Link) req.getConnectionEditPart().getModel(); ProcessNode process = ((ExchangePart) req.getTarget()).getModel().parent(); ExchangeNode output = process.getOutput(link.processLink); ExchangeNode input = link.inputNode.getInput(link.processLink); if (input == null || !input.matches(output)) return null; return LinkAnchor.forOutput(process, output); }
Example #5
Source File: AbstractNodeEditPart.java From olca-app with Mozilla Public License 2.0 | 5 votes |
@Override public ConnectionAnchor getSourceConnectionAnchor(Request req) { if (req instanceof CreateConnectionRequest) return sourceAnchor((CreateConnectionRequest) req); if (req instanceof ReconnectRequest) return sourceAnchor((ReconnectRequest) req); return null; }
Example #6
Source File: ProcessBaseItemSemanticEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * Extended request data key to hold editpart visual id. * Add visual id of edited editpart to extended data of the request * so command switch can decide what kind of diagram element is being edited. * It is done in those cases when it's not possible to deduce diagram * element kind from domain element. * * @generated */ public Command getCommand(Request request) { if (request instanceof ReconnectRequest) { Object view = ((ReconnectRequest) request).getConnectionEditPart().getModel(); if (view instanceof View) { Integer id = new Integer(ProcessVisualIDRegistry.getVisualID((View) view)); request.getExtendedData().put(VISUAL_ID_KEY, id); } } return super.getCommand(request); }
Example #7
Source File: InsertElementOnSequenceFlowCommand.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected CommandResult doUndoWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException { if (setBendpointsCmdForOriginalEdge != null) { setBendpointsCmdForOriginalEdge.undo(monitor, info); } if (createConnectionCommand != null) { createConnectionCommand.undo(monitor, info); } if (targetEditPart instanceof ConnectionEditPart && originalTargetEditPart != null) { final ReconnectRequest reconnect = new ReconnectRequest(RequestConstants.REQ_RECONNECT_TARGET); reconnect.setConnectionEditPart((ConnectionEditPart) targetEditPart); reconnect.setTargetEditPart(originalTargetEditPart); final CompoundCommand reconnectCommand = (CompoundCommand) originalTargetEditPart.getCommand(reconnect); final CompoundCommand ccc = (CompoundCommand) reconnectCommand.getChildren()[1]; for (final Object proxy : ccc.getChildren()) { if (proxy instanceof ICommandProxy) { ((ICommandProxy) proxy).getICommand().execute(monitor, info); } } } if (correctOffset && correctOffsetCmd != null && correctOffsetCmd.canUndo()) { correctOffsetCmd.undo(monitor, info); } if (creationCommand != null && creationCommand.canUndo()) { creationCommand.undo(); creationCommand.dispose(); } return CommandResult.newOKCommandResult(); }
Example #8
Source File: CrossflowBaseItemSemanticEditPolicy.java From scava with Eclipse Public License 2.0 | 5 votes |
/** * Extended request data key to hold editpart visual id. * Add visual id of edited editpart to extended data of the request * so command switch can decide what kind of diagram element is being edited. * It is done in those cases when it's not possible to deduce diagram * element kind from domain element. * * @generated */ public Command getCommand(Request request) { if (request instanceof ReconnectRequest) { Object view = ((ReconnectRequest) request).getConnectionEditPart().getModel(); if (view instanceof View) { Integer id = new Integer(CrossflowVisualIDRegistry.getVisualID((View) view)); request.getExtendedData().put(VISUAL_ID_KEY, id); } } return super.getCommand(request); }
Example #9
Source File: AbstractNodeEditPart.java From olca-app with Mozilla Public License 2.0 | 5 votes |
private ConnectionAnchor targetAnchor(ReconnectRequest req) { Link link = (Link) req.getConnectionEditPart().getModel(); ExchangeNode input = ((ExchangePart) req.getTarget()).getModel(); ExchangeNode output = link.outputNode.getOutput(link.processLink); if (output == null || !output.matches(input)) return null; // TODO: waste links if (input.exchange.id != link.processLink.exchangeId && input.parent().isConnected(input.exchange.id)) return null; return LinkAnchor.forInput(input.parent(), input); }
Example #10
Source File: DiagramWalkerGraphicalNodeEditPolicy.java From erflute with Apache License 2.0 | 5 votes |
@Override protected Command getReconnectTargetCommand(ReconnectRequest reconnectrequest) { final WalkerConnection connection = (WalkerConnection) reconnectrequest.getConnectionEditPart().getModel(); if (!(connection instanceof Relationship)) { return null; } final Relationship relation = (Relationship) connection; if (relation.getSourceWalker() == relation.getTargetWalker()) { return null; } final DiagramWalker newTarget = ((DiagramWalker) reconnectrequest.getTarget().getModel()).toMaterialize(); if (!relation.getTargetWalker().equals(newTarget)) { return null; } final DiagramWalkerEditPart targetEditPart = (DiagramWalkerEditPart) reconnectrequest.getConnectionEditPart().getTarget(); final Point location = new Point(reconnectrequest.getLocation()); final IFigure targetFigure = targetEditPart.getFigure(); targetFigure.translateToRelative(location); int xp = -1; int yp = -1; 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 = ERTableEditPart.getIntersectionPoint(location, targetFigure); xp = 100 * (point.x - bounds.x) / bounds.width; yp = 100 * (point.y - bounds.y) / bounds.height; } final ReconnectTargetCommand command = new ReconnectTargetCommand(relation, xp, yp); return command; }
Example #11
Source File: ProcessLinkCreatePolicy.java From olca-app with Mozilla Public License 2.0 | 5 votes |
@Override protected Command getReconnectSourceCommand(ReconnectRequest request) { Link link = (Link) request.getConnectionEditPart().getModel(); ExchangeNode toConnect = (ExchangeNode) request.getTarget().getModel(); ExchangeNode other = link.inputNode.getInput(link.processLink); if (!toConnect.matches(other)) return null; return new ReconnectLinkCommand(toConnect.parent(), other, link); }
Example #12
Source File: ProcessLinkCreatePolicy.java From olca-app with Mozilla Public License 2.0 | 5 votes |
@Override protected Command getReconnectTargetCommand(ReconnectRequest request) { Link link = (Link) request.getConnectionEditPart().getModel(); ExchangeNode toConnect = (ExchangeNode) request.getTarget().getModel(); ExchangeNode other = link.outputNode.getOutput(link.processLink); if (!toConnect.matches(other)) return null; boolean sameNode = toConnect.exchange.id == link.processLink.exchangeId; if (!sameNode && toConnect.parent().isConnected(toConnect.exchange.id)) return null; return new ReconnectLinkCommand(link.outputNode, toConnect, link); }
Example #13
Source File: NodeElementGraphicalNodeEditPolicy.java From ermasterr with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override protected Command getReconnectTargetCommand(final ReconnectRequest reconnectrequest) { final ConnectionElement connection = (ConnectionElement) reconnectrequest.getConnectionEditPart().getModel(); if (connection.getSource() == connection.getTarget()) { return null; } final NodeElement newTarget = (NodeElement) reconnectrequest.getTarget().getModel(); if (connection.getTarget() != newTarget) { return null; } final NodeElementEditPart targetEditPart = (NodeElementEditPart) reconnectrequest.getConnectionEditPart().getTarget(); final Point location = new Point(reconnectrequest.getLocation()); final IFigure targetFigure = targetEditPart.getFigure(); targetFigure.translateToRelative(location); int xp = -1; int yp = -1; 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 = NodeElementEditPart.getIntersectionPoint(location, targetFigure); xp = 100 * (point.x - bounds.x) / bounds.width; yp = 100 * (point.y - bounds.y) / bounds.height; } final ReconnectTargetCommand command = new ReconnectTargetCommand(connection, xp, yp); return command; }
Example #14
Source File: NodeElementGraphicalNodeEditPolicy.java From ermasterr with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override protected Command getReconnectSourceCommand(final ReconnectRequest reconnectrequest) { final ConnectionElement connection = (ConnectionElement) reconnectrequest.getConnectionEditPart().getModel(); if (connection.getSource() == connection.getTarget()) { return null; } final NodeElement newSource = (NodeElement) reconnectrequest.getTarget().getModel(); if (connection.getSource() != newSource) { return null; } final NodeElementEditPart sourceEditPart = (NodeElementEditPart) reconnectrequest.getConnectionEditPart().getSource(); final Point location = new Point(reconnectrequest.getLocation()); final IFigure sourceFigure = sourceEditPart.getFigure(); sourceFigure.translateToRelative(location); int xp = -1; int yp = -1; 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 = NodeElementEditPart.getIntersectionPoint(location, sourceFigure); xp = 100 * (point.x - bounds.x) / bounds.width; yp = 100 * (point.y - bounds.y) / bounds.height; } final ReconnectSourceCommand command = new ReconnectSourceCommand(connection, xp, yp); return command; }
Example #15
Source File: InsertElementOnSequenceFlowCommand.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override protected CommandResult doExecuteWithResult( final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException { if (targetEditPart instanceof ConnectionEditPart) { final ConnectionEditPart targetConnectionEditPart = (ConnectionEditPart) targetEditPart; for (final Iterator i = objects.iterator(); i.hasNext();) { final Object object = i.next(); if (object instanceof ViewAndElementDescriptor) { final ViewAndElementDescriptor descriptor = (ViewAndElementDescriptor) object; final ShapeEditPart editPart = (ShapeEditPart) epRegistry.get(descriptor.getAdapter(View.class)); final Bounds b = (Bounds) ((Node) editPart.getNotationView()).getLayoutConstraint(); correctOffsetCmd = new SetBoundsCommand(editPart.getEditingDomain(), "", descriptor, new Point(b.getX() - 25, b.getY() - 25)); final ReconnectRequest reconnect = new ReconnectRequest(RequestConstants.REQ_RECONNECT_TARGET); reconnect.setConnectionEditPart(targetConnectionEditPart); reconnect.setTargetEditPart(editPart); final CompoundCommand reconnectCommand = (CompoundCommand) editPart.getCommand(reconnect); final CreateConnectionViewAndElementRequest connectionRequest = new CreateConnectionViewAndElementRequest( BonitaConnectionTypes.getElementType("org.bonitasoft.studio.diagram.SequenceFlow_4001"), ((IHintedType) BonitaConnectionTypes.getElementType("org.bonitasoft.studio.diagram.SequenceFlow_4001")).getSemanticHint(), new PreferencesHint("org.bonitasoft.studio.diagram")); originalTargetEditPart = targetConnectionEditPart.getTarget(); createConnectionCommand = new DeferredCreateConnectionViewAndElementCommand(connectionRequest, descriptor, originalTargetEditPart, editPart.getViewer()); if (correctOffset) { correctOffsetCmd.execute(monitor, info); } final CompoundCommand ccc = (CompoundCommand) reconnectCommand.getChildren()[1]; for (final Object proxy : ccc.getChildren()) { if (proxy instanceof ICommandProxy) { final ICommand iCommand = ((ICommandProxy) proxy).getICommand(); if (iCommand.canExecute()) { iCommand.execute(monitor, info); } } } createConnectionCommand.execute(monitor, info); if (connectionRequest != null) { final ConnectionViewAndElementDescriptor connectionDescriptor = (ConnectionViewAndElementDescriptor) connectionRequest.getNewObject(); final Connector edge = (Connector) connectionDescriptor.getAdapter(Edge.class); final org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart connectionEP = (org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart) editPart .getViewer().getEditPartRegistry().get(edge); if (connectionEP != null) { final TransactionalEditingDomain editingDomain = connectionEP.getEditingDomain(); setBendpointsCmdForNewEdge = createSetBendpointsCommand(monitor, info, edge, editingDomain); setBendpointsCmdForNewEdge.execute(monitor, info); setBendpointsCmdForOriginalEdge = createSetBendpointsCommand(monitor, info, (Connector) targetEditPart.getNotationView(), editingDomain); setBendpointsCmdForOriginalEdge.execute(monitor, info); } } } } } correctBoundsToAvoidCollisions(monitor, info); return CommandResult.newOKCommandResult(); }
Example #16
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 #17
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()); }
Example #18
Source File: NodeElementGraphicalNodeEditPolicy.java From ermaster-b with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override protected Command getReconnectSourceCommand( ReconnectRequest reconnectrequest) { ConnectionElement connection = (ConnectionElement) reconnectrequest .getConnectionEditPart().getModel(); if (!(connection instanceof Relation)) { return null; } Relation relation = (Relation) connection; if (relation.getSource() == relation.getTarget()) { return null; } NodeElement newSource = (NodeElement) reconnectrequest.getTarget().getModel(); if (!relation.getSource().equals(newSource)) { return null; } NodeElementEditPart sourceEditPart = (NodeElementEditPart) reconnectrequest .getConnectionEditPart().getSource(); Point location = new Point(reconnectrequest.getLocation()); IFigure sourceFigure = sourceEditPart.getFigure(); sourceFigure.translateToRelative(location); int xp = -1; int yp = -1; 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 = ERTableEditPart.getIntersectionPoint(location, sourceFigure); xp = 100 * (point.x - bounds.x) / bounds.width; yp = 100 * (point.y - bounds.y) / bounds.height; } ReconnectSourceCommand command = new ReconnectSourceCommand(relation, xp, yp); return command; }
Example #19
Source File: NodeElementGraphicalNodeEditPolicy.java From ermaster-b with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override protected Command getReconnectTargetCommand( ReconnectRequest reconnectrequest) { ConnectionElement connection = (ConnectionElement) reconnectrequest .getConnectionEditPart().getModel(); if (!(connection instanceof Relation)) { return null; } Relation relation = (Relation) connection; if (relation.getSource() == relation.getTarget()) { return null; } NodeElement newTarget = (NodeElement) reconnectrequest.getTarget() .getModel(); if (!relation.getTarget().equals(newTarget)) { return null; } NodeElementEditPart targetEditPart = (NodeElementEditPart) reconnectrequest .getConnectionEditPart().getTarget(); Point location = new Point(reconnectrequest.getLocation()); IFigure targetFigure = targetEditPart.getFigure(); targetFigure.translateToRelative(location); int xp = -1; int yp = -1; 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 = ERTableEditPart.getIntersectionPoint(location, targetFigure); xp = 100 * (point.x - bounds.x) / bounds.width; yp = 100 * (point.y - bounds.y) / bounds.height; } ReconnectTargetCommand command = new ReconnectTargetCommand(relation, xp, yp); return command; }
Example #20
Source File: ConnectionCreationEditPolicy.java From birt with Eclipse Public License 1.0 | 4 votes |
protected Command getReconnectSourceCommand( ReconnectRequest request ) { return null; }
Example #21
Source File: ConnectionCreationEditPolicy.java From birt with Eclipse Public License 1.0 | 4 votes |
protected Command getReconnectTargetCommand( ReconnectRequest request ) { return null; }
Example #22
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 #23
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 #24
Source File: ConnectionGraphicalNodeEditPolicy.java From ermasterr with Apache License 2.0 | 4 votes |
@Override protected Command getReconnectSourceCommand(final ReconnectRequest paramReconnectRequest) { return null; }
Example #25
Source File: ConnectionGraphicalNodeEditPolicy.java From ermasterr with Apache License 2.0 | 4 votes |
@Override protected Command getReconnectTargetCommand(final ReconnectRequest paramReconnectRequest) { return null; }
Example #26
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 #27
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()); }