コード例 #1
0
 @Override
 protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
   DiagramNodeModel source = (DiagramNodeModel) getHost().getModel();
   Object def = request.getNewObjectType();
   CreateConnectionCommand cmd = new CreateConnectionCommand(source, (IDiagramConnectionDef) def);
   request.setStartCommand(cmd);
   return cmd;
 }
コード例 #2
0
  /**
   * @see
   *     org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy#getConnectionCreateCommand(org.eclipse.gef.requests.CreateConnectionRequest)
   */
  protected Command getConnectionCreateCommand(CreateConnectionRequest request) {

    // check meta node policy
    Object m = getHost().getModel();
    if (m instanceof MetaNode) {
      String edgeType = ((MetaNode) m).getEdgeType();
      if (edgeType != null && !edgeType.equals(request.getNewObjectType())) {
        return null;
      }
    }

    ConnectionCommand command = new ConnectionCommand();
    command.setSourceNode((INode) getHost().getModel());
    command.setType((String) request.getNewObjectType());
    request.setStartCommand(command);
    return command;
  }
コード例 #3
0
 @Override
 protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
   int style = ((Integer) request.getNewObjectType()).intValue();
   Activity source = getActivity();
   NextConnectionCreateCommand cmd =
       new NextConnectionCreateCommand(source.getDiagram().getTextEditor(), style);
   cmd.setSource(source);
   request.setStartCommand(cmd);
   return cmd;
 }
 @SuppressWarnings("unchecked") // $NON-NLS-1$
 protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
   Node source = (Node) getHost().getModel();
   if (source.isReadOnly()) {
     return null;
   }
   String style = (String) request.getNewObjectType();
   ConnectionCreateCommand cmd =
       new ConnectionCreateCommand(source, style, (List<Object>) request.getNewObject());
   request.setStartCommand(cmd);
   return cmd;
 }
コード例 #5
0
 public ConnectionAnchor getTargetConnectionAnchor(Request request) {
   CreateConnectionRequest r = (CreateConnectionRequest) request;
   if (r.getNewObjectType().equals(NoteConnectionEditPart.NOTE_CONNECTION)
       || r.getNewObjectType() == Relationship.class) return getConnectionAnchor();
   return null;
 }