Java 类org.eclipse.gef.requests.CreateConnectionRequest 实例源码

项目:Hydrograph    文件:NodeConnectionEditPolicy.java   
@Override
protected Command getConnectionCreateCommand(
        CreateConnectionRequest request) {

    LinkCommand command = new LinkCommand();
    command.setConnection(new Link());
    command.setSource(getComponentEditPart().getCastedModel());
    ConnectionAnchor ctor = getComponentEditPart().getSourceConnectionAnchor(
            request);
    if (ctor == null)
        return null;

    command.setSourceTerminal(getComponentEditPart()
            .mapConnectionAnchorToTerminal(ctor));

    request.setStartCommand(command);
    return command;

}
项目:Hydrograph    文件:NodeConnectionEditPolicy.java   
@Override
protected Command getConnectionCompleteCommand(
        CreateConnectionRequest request) {

    LinkCommand command = (LinkCommand) request
            .getStartCommand();
    command.setTarget(getComponentEditPart().getCastedModel());
    ConnectionAnchor ctor = getComponentEditPart().getTargetConnectionAnchor(
            request);
    if (ctor == null)
        return null;


    command.setTargetTerminal(getComponentEditPart()
            .mapConnectionAnchorToTerminal(ctor));

    return command;
}
项目:ermasterr    文件:ConnectionGraphicalNodeEditPolicy.java   
@Override
protected Command getConnectionCreateCommand(final CreateConnectionRequest request) {
    final Object object = request.getNewObject();

    if (object instanceof CommentConnection) {
        final CommentConnection connection = (CommentConnection) object;

        final CreateConnectionCommand command = new CreateCommentConnectionCommand(connection);

        command.setSource(request.getTargetEditPart());
        request.setStartCommand(command);

        return command;
    }

    return null;
}
项目:ermaster-k    文件:ConnectionGraphicalNodeEditPolicy.java   
@Override
protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
    Object object = request.getNewObject();

    if (object instanceof CommentConnection) {
        CommentConnection connection = (CommentConnection) object;

        CreateConnectionCommand command = new CreateCommentConnectionCommand(
                this.diagram, connection);

        command.setSource(request.getTargetEditPart());
        request.setStartCommand(command);

        return command;
    }

    return null;
}
项目:erflute    文件:DiagramWalkerGraphicalNodeEditPolicy.java   
@Override
protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
    final AbstractCreateConnectionCommand command = (AbstractCreateConnectionCommand) request.getStartCommand();
    final DiagramWalkerEditPart targetEditPart = (DiagramWalkerEditPart) request.getTargetEditPart();
    if (command instanceof AbstractCreateRelationshipCommand) {
        if (!(targetEditPart instanceof TableViewEditPart)) {
            return null;
        }
    }
    final String validatedMessage = command.validate();
    if (validatedMessage != null) {
        Activator.showErrorDialog(validatedMessage);
        return null;
    }
    command.setTarget(targetEditPart);
    if (!command.canExecute()) {
        return null;
    }
    return command;
}
项目:ermaster-nhit    文件:ConnectionGraphicalNodeEditPolicy.java   
@Override
protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
    Object object = request.getNewObject();

    if (object instanceof CommentConnection) {
        CommentConnection connection = (CommentConnection) object;

        CreateConnectionCommand command = new CreateCommentConnectionCommand(
                connection);

        command.setSource(request.getTargetEditPart());
        request.setStartCommand(command);

        return command;
    }

    return null;
}
项目:gef-gwt    文件:GraphicalNodeEditPolicy.java   
/**
 * Returns the FeedbackHelper that is ready to use. The feedback helper must
 * be configured with the connection that will be used to display feedback,
 * and that connection must be added to the appropriate layer in the
 * diagram.
 * 
 * @param request
 *            the CreateConnectionRequest
 * @return a FeedbackHelper
 */
protected FeedbackHelper getFeedbackHelper(CreateConnectionRequest request) {
    if (feedbackHelper == null) {
        feedbackHelper = new FeedbackHelper();
        Point p = request.getLocation();
        connectionFeedback = createDummyConnection(request);
        connectionFeedback
                .setConnectionRouter(getDummyConnectionRouter(request));
        connectionFeedback
                .setSourceAnchor(getSourceConnectionAnchor(request));
        feedbackHelper.setConnection(connectionFeedback);
        addFeedback(connectionFeedback);
        feedbackHelper.update(null, p);
    }
    return feedbackHelper;
}
项目:gef-gwt    文件:AbstractConnectionCreationTool.java   
/**
 * When the button is first pressed, the source node and its command
 * contribution are determined and locked in. After that time, the tool will
 * be looking for the target node to complete the connection
 * 
 * @see org.eclipse.gef.tools.AbstractTool#handleButtonDown(int)
 * @param button
 *            which button is pressed
 * @return <code>true</code> if the button down was processed
 */
protected boolean handleButtonDown(int button) {
    if (isInState(STATE_INITIAL) && button == 1) {
        updateTargetRequest();
        updateTargetUnderMouse();
        setConnectionSource(getTargetEditPart());
        Command command = getCommand();
        ((CreateConnectionRequest) getTargetRequest())
                .setSourceEditPart(getTargetEditPart());
        if (command != null) {
            setState(STATE_CONNECTION_STARTED);
            setCurrentCommand(command);
            viewer = getCurrentViewer();
        }
    }

    if (isInState(STATE_INITIAL) && button != 1) {
        setState(STATE_INVALID);
        handleInvalidInput();
    }
    return true;
}
项目:FRaMED    文件:ORMShapeGraphicalNodeEditPolicy.java   
/**
 * This method creates and return the creation command for all {@link Relation}s except the
 * relations from type cyclic, total, acyclic, reflexive and irrflexive.
 * 
 * @return {@link ORMRelationCreateCommand}
 * */
private ORMRelationCreateCommand setupConnectionStartCommand(
    final CreateConnectionRequest request, final Model container) {
  final ORMRelationCreateCommand result = new ORMRelationCreateCommand();
  result.setSource((Shape) getHost().getModel());
  result.setRelation((Relation) request.getNewObject());
  result.setRelationContainer(container);

  if (request.getNewObjectType().equals(Type.RELATIONSHIP)) {
    NamedElement ele = OrmFactory.eINSTANCE.createNamedElement();
    ele.setName("*");
    result.setSourceLabel(ele);
    NamedElement ele2 = OrmFactory.eINSTANCE.createNamedElement();
    ele2.setName("*");
    result.setTargetLabel(ele2);
    ((Relation) request.getNewObject()).getConnectionAnchor().setContainer(container);
  }
  request.setStartCommand(result);
  return result;
}
项目:FRaMED    文件:ORMShapeGraphicalNodeEditPolicy.java   
/**
 * This method tests if the conditions for the creation start of a {@link Relation} kind(except
 * {@link Relation}s from type total, cyclic, acyclic, reflexive and irreflexive) are fulfilled.
 * 
 * @return boolean
 * */
public boolean isStartOK(final CreateConnectionRequest request) {
  // Fufillment start
  return oTCheck(request, Type.FULFILLMENT, Type.NATURAL_TYPE)
      || oTCheck(request, Type.FULFILLMENT, Type.DATA_TYPE)
      || oTCheck(request, Type.FULFILLMENT, Type.COMPARTMENT_TYPE)
      // Role Implication start
      || oTCheck(request, Type.ROLE_IMPLICATION, Type.ROLE_TYPE)
      || oTCheck(request, Type.ROLE_IMPLICATION, Type.ROLE_GROUP)
      // Role Equivalence start
      || oTCheck(request, Type.ROLE_EQUIVALENCE, Type.ROLE_TYPE)
      || oTCheck(request, Type.ROLE_EQUIVALENCE, Type.ROLE_GROUP)
      // Role Prohibition start
      || oTCheck(request, Type.ROLE_PROHIBITION, Type.ROLE_TYPE)
      || oTCheck(request, Type.ROLE_PROHIBITION, Type.ROLE_GROUP)
      // Inheritance start
      || oTCheck(request, Type.INHERITANCE, Type.NATURAL_TYPE)
      || oTCheck(request, Type.INHERITANCE, Type.DATA_TYPE)
      || oTCheck(request, Type.INHERITANCE, Type.ROLE_TYPE)
      || oTCheck(request, Type.INHERITANCE, Type.COMPARTMENT_TYPE)
      // Relationship start
      || oTCheck(request, Type.RELATIONSHIP, Type.ROLE_TYPE);
}
项目:FRaMED    文件:ORMShapeGraphicalNodeEditPolicy.java   
/**
 * This method tests if between source edit part and traget edit part already exist a
 * relationshipConstraint(total,irrflexive,cyclic, acyclic, reflexive) kind of the requested relationshipConstraint
 * kind.
 * 
 * @return boolean
 * */
private boolean hasConstraintsKind(final CreateConnectionRequest request) {
  if (testedRelationship != null) {
    for (Relation rel : testedRelationship.getReferencedRelation()) {
      if (request.getNewObjectType().equals(Type.IRREFLEXIVE)
          && rel.getType().equals(Type.IRREFLEXIVE))
        return true;
      if (request.getNewObjectType().equals(Type.TOTAL) && rel.getType().equals(Type.TOTAL))
        return true;
      if (request.getNewObjectType().equals(Type.CYCLIC) && rel.getType().equals(Type.CYCLIC))
        return true;
      if (request.getNewObjectType().equals(Type.ACYCLIC) && rel.getType().equals(Type.ACYCLIC))
          return true;
      if (request.getNewObjectType().equals(Type.REFLEXIVE) && rel.getType().equals(Type.REFLEXIVE))
          return true;
    }
  }
  return false;
}
项目:birt    文件:ConnectionCreationEditPolicy.java   
protected org.eclipse.gef.commands.Command getConnectionCompleteCommand(
        CreateConnectionRequest request )
{

    ConnectionCommand command = (ConnectionCommand) request.getStartCommand( );

    if ( command == null )
        return null;
    EditPart sourcePart = command.getSource( );
    if ( !( getHost( ) instanceof ColumnEditPart )
            || getHost( ) == sourcePart
            || getHost( ).getParent( ) == sourcePart.getParent( ) )
    {
        return null;
    }
    ColumnEditPart targetPart = (ColumnEditPart) getHost( );
    command.setTarget( targetPart );

    AddJoinConditionCommand addJoinConditionCommand = new AddJoinConditionCommand( sourcePart,
            targetPart );
    return addJoinConditionCommand;
}
项目:olca-app    文件:ProcessLinkCreatePolicy.java   
@Override
protected Command getConnectionCompleteCommand(CreateConnectionRequest req) {
    CreateLinkCommand cmd = (CreateLinkCommand) req.getStartCommand();
    if (cmd == null)
        return null;
    ExchangeNode toConnect = (ExchangeNode) req.getTargetEditPart().getModel();
    ExchangeNode other = cmd.startedFromOutput ? cmd.output : cmd.input;
    if (!toConnect.matches(other) || toConnect.parent().isConnected(toConnect.exchange.getId())) {
        cmd.completeWith(null);
        req.setStartCommand(cmd);
        return null;
    }
    cmd.completeWith(toConnect);
    req.setStartCommand(cmd);
    if (cmd.output == null || cmd.input == null)
        return null;
    return cmd;
}
项目:Open_Source_ECOA_Toolset_AS5    文件:LinkCreatePolicy.java   
@Override
protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
    Node start = (Node) getHost().getModel();
    if (start instanceof ServiceOperationNode || start instanceof TriggerInstanceTerminalNode || start instanceof DynamicTriggerInstanceTerminalNode || start instanceof ModuleOperationNode) {
        LinkCreateCommand cmd = new LinkCreateCommand();
        cmd.setSource(start);
        cmd.setLink((Link) request.getNewObject());
        request.setStartCommand(cmd);
        return cmd;
    }
    return null;
}
项目:Open_Source_ECOA_Toolset_AS5    文件:LinkCreatePolicy.java   
@Override
protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
    LinkCreateCommand cmd = (LinkCreateCommand) request.getStartCommand();
    Node end = (Node) getHost().getModel();
    Node start = cmd.getSource();
    if (end instanceof ReferenceNode && (!(start.getParent().getId().equalsIgnoreCase(end.getParent().getId())))) {
        ReferenceNode nd = (ReferenceNode) end;
        ServiceNode st = (ServiceNode) start;
        if (nd.getIntf().equalsIgnoreCase(st.getIntf())) {
            cmd.setTarget(end);
            return cmd;
        }
    }
    return null;
}
项目:Open_Source_ECOA_Toolset_AS5    文件:LinkCreatePolicy.java   
@Override
protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
    Node start = (Node) getHost().getModel();
    if (start instanceof ServiceNode) {
        LinkCreateCommand cmd = new LinkCreateCommand();
        cmd.setSource(start);
        cmd.setLink((Link) request.getNewObject());
        request.setStartCommand(cmd);
        return cmd;
    }
    return null;
}
项目:Open_Source_ECOA_Toolset_AS5    文件:LinkCreatePolicy.java   
@Override
protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
    LinkCreateCommand cmd = (LinkCreateCommand) request.getStartCommand();
    Node end = (Node) getHost().getModel();
    Node start = cmd.getSource();
    if (end instanceof ReferenceNode && (!(start.getParent().getId().equalsIgnoreCase(end.getParent().getId())))) {
        ReferenceNode nd = (ReferenceNode) end;
        ServiceNode st = (ServiceNode) start;
        if (nd.getIntf().equalsIgnoreCase(st.getIntf())) {
            cmd.setTarget(end);
            return cmd;
        }
    }
    return null;
}
项目:Open_Source_ECOA_Toolset_AS5    文件:LinkCreatePolicy.java   
@Override
protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
    Node start = (Node) getHost().getModel();
    if (start instanceof ServiceNode) {
        LinkCreateCommand cmd = new LinkCreateCommand();
        cmd.setSource(start);
        cmd.setLink((Link) request.getNewObject());
        request.setStartCommand(cmd);
        return cmd;
    }
    return null;
}
项目:gw4e.project    文件:GW4ENodeGraphicalNodeEditPolicy.java   
@Override
protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
    LinkCreateCommand result = (LinkCreateCommand) request.getStartCommand();
    if (getHost().getModel() instanceof GraphElement) {
        GraphElement target = (GraphElement) getHost().getModel();
        result.setLink((GWLink) request.getNewObject());
        result.setTarget(target);
        return result;
    }
    return UnexecutableCommand.INSTANCE;
}
项目:gw4e.project    文件:GW4ENodeGraphicalNodeEditPolicy.java   
@Override
protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
    LinkCreateCommand result = new LinkCreateCommand();
    if (getHost().getModel() instanceof GraphElement) {
        result.setSource((GraphElement) getHost().getModel());

        result.setGraph(((GraphElement) getHost().getModel()).getGraph());
        request.setStartCommand(result);
        return result;
    }
    return UnexecutableCommand.INSTANCE;
}
项目:bdf2    文件:TableEditPart.java   
@Override
public ConnectionAnchor getTargetConnectionAnchor(Request request) {
    if (request instanceof CreateConnectionRequest) {
        CreateConnectionRequest crequest = (CreateConnectionRequest) request;
        Table table = (Table) crequest.getSourceEditPart().getModel();
        Column c = table.getFirstPkColumn();
        if (c == null) {
            MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "提示", "此表没有主键,请先设置主键!");
            crequest.setStartCommand(null);
        }
    }
    return new ChopboxAnchor(getFigure());
}
项目:bdf2    文件:BaseGraphicalNodeEditPolicy.java   
@Override
protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
    if (request.getStartCommand() != null) {
        ConnectionCreateCommand cmd = (ConnectionCreateCommand) request.getStartCommand();
        cmd.setTarget((Table) getHost().getModel());
        return cmd;
    }
    return null;
}
项目:bdf2    文件:BaseGraphicalNodeEditPolicy.java   
@Override
protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
    Table source = (Table) getHost().getModel();
    Connection c = (Connection) request.getNewObject();
    ConnectionCreateCommand cmd = new ConnectionCreateCommand(source, c);
    request.setStartCommand(cmd);
    return cmd;
}
项目:DarwinSPL    文件:DwFeatureGraphicalNodeEditPolicy.java   
@Override
protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
    DwParentChildConnectionCreateCommand command = (DwParentChildConnectionCreateCommand)request.getStartCommand();
    command.setFeatureModel(featureModel);
    command.setTarget((DwFeatureWrapped)getHost().getModel());
    return command;


}
项目:DarwinSPL    文件:DwFeatureGraphicalNodeEditPolicy.java   
@Override
protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
    DwFeatureModelWrapped featureModel = ((DwFeatureEditPart)getHost()).getFeatureModel();

    DwParentChildConnection connection = (DwParentChildConnection)request.getNewObject();
    connection.setModel(featureModel);

    DwParentChildConnectionCreateCommand command = new DwParentChildConnectionCreateCommand();
    command.setSource((DwFeatureWrapped)getHost().getModel());
    command.setConnection(connection);
    command.setFeatureModel(featureModel);

    request.setStartCommand(command);
    return command;
}
项目:ermasterr    文件:ConnectionGraphicalNodeEditPolicy.java   
@Override
protected Command getConnectionCompleteCommand(final CreateConnectionRequest request) {
    final CreateCommentConnectionCommand command = (CreateCommentConnectionCommand) request.getStartCommand();

    command.setTarget(request.getTargetEditPart());

    if (!command.canExecute()) {
        return null;
    }

    return command;
}
项目:ermasterr    文件:NodeElementGraphicalNodeEditPolicy.java   
/**
 * {@inheritDoc}
 */
@Override
protected Command getConnectionCompleteCommand(final CreateConnectionRequest request) {
    final AbstractCreateConnectionCommand command = (AbstractCreateConnectionCommand) request.getStartCommand();

    final NodeElementEditPart targetEditPart = (NodeElementEditPart) request.getTargetEditPart();

    if (command instanceof AbstractCreateRelationCommand) {
        if (!(targetEditPart instanceof TableViewEditPart)) {
            return null;
        }
    }

    final String validatedMessage = command.validate();
    if (validatedMessage != null) {
        ERDiagramActivator.showErrorDialog(validatedMessage);

        return null;
    }

    command.setTarget(targetEditPart);

    if (!command.canExecute()) {
        return null;
    }

    return command;
}
项目:ermaster-k    文件:ConnectionGraphicalNodeEditPolicy.java   
@Override
protected Command getConnectionCompleteCommand(
        CreateConnectionRequest request) {
    CreateCommentConnectionCommand command = (CreateCommentConnectionCommand) request
            .getStartCommand();

    command.setTarget(request.getTargetEditPart());

    if (!command.canExecute()) {
        return null;
    }

    return command;
}
项目:ermaster-k    文件:NodeElementGraphicalNodeEditPolicy.java   
/**
 * {@inheritDoc}
 */
@Override
protected Command getConnectionCompleteCommand(
        CreateConnectionRequest request) {
    AbstractCreateConnectionCommand command = (AbstractCreateConnectionCommand) request
            .getStartCommand();

    NodeElementEditPart targetEditPart = (NodeElementEditPart) request
            .getTargetEditPart();

    if (command instanceof AbstractCreateRelationCommand) {
        if (!(targetEditPart instanceof TableViewEditPart)) {
            return null;
        }
    }

    String validatedMessage = command.validate();
    if (validatedMessage != null) {
        ERDiagramActivator.showErrorDialog(validatedMessage);

        return null;
    }

    command.setTarget(targetEditPart);

    if (!command.canExecute()) {
        return null;
    }

    return command;
}
项目:NEXCORE-UML-Modeler    文件:DiagramGraphicalNodeEditPolicy.java   
/**
 * @see org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy#getConnectionCreateCommand(org.eclipse.gef.requests.CreateConnectionRequest)
 */
@Override
protected Command getConnectionCreateCommand(CreateConnectionRequest request) {

    CreateConnectionCommand command = new CreateConnectionCommand();
    AbstractConnection connection = (AbstractConnection) request.getNewObject();

    AbstractView objNode = (AbstractNode) (getHost().getModel());

    if (objNode instanceof AbstractConnection) {
        return null;
    }
    AbstractNode abstractNode = (AbstractNode) objNode;

    if (!UMLPolicyManager.isConnectableFromSource(connection.getRelationType(), abstractNode.getNodeType())) {
        return null;
    }

    ConnectionAnchor sourceAnchor = ((NodeEditPart) getHost()).getSourceConnectionAnchor(request);
    command.setSourceAnchorPoint(sourceAnchor.getLocation(request.getLocation()));

    command.setConnection(connection);
    command.setSource((AbstractNode) getHost().getModel());
    request.setStartCommand(command);
    request.setSourceEditPart(getHost());

    return command;

}
项目:ermaster-nhit    文件:ConnectionGraphicalNodeEditPolicy.java   
@Override
protected Command getConnectionCompleteCommand(
        CreateConnectionRequest request) {
    CreateCommentConnectionCommand command = (CreateCommentConnectionCommand) request
            .getStartCommand();

    command.setTarget(request.getTargetEditPart());

    if (!command.canExecute()) {
        return null;
    }

    return command;
}
项目:ermaster-nhit    文件:NodeElementGraphicalNodeEditPolicy.java   
/**
 * {@inheritDoc}
 */
@Override
protected Command getConnectionCompleteCommand(
        CreateConnectionRequest request) {
    AbstractCreateConnectionCommand command = (AbstractCreateConnectionCommand) request
            .getStartCommand();

    NodeElementEditPart targetEditPart = (NodeElementEditPart) request
            .getTargetEditPart();

    if (command instanceof AbstractCreateRelationCommand) {
        if (!(targetEditPart instanceof TableViewEditPart)) {
            return null;
        }
    }

    String validatedMessage = command.validate();
    if (validatedMessage != null) {
        ERDiagramActivator.showErrorDialog(validatedMessage);

        return null;
    }

    command.setTarget(targetEditPart);

    if (!command.canExecute()) {
        return null;
    }

    return command;
}
项目:gef-gwt    文件:GraphicalNodeEditPolicy.java   
/**
 * Erases connection feedback if necessary. Frees unused fields.
 * 
 * @param request
 *            the CreateConnectionRequest
 */
protected void eraseCreationFeedback(CreateConnectionRequest request) {
    if (connectionFeedback != null) {
        removeFeedback(connectionFeedback);
        feedbackHelper = null;
        connectionFeedback = null;
    }
}
项目:gef-gwt    文件:GraphicalNodeEditPolicy.java   
/**
 * Factors the request into one of four abstract methods. Subclasses must
 * implement these methods.
 * 
 * @see org.eclipse.gef.EditPolicy#getCommand(Request)
 */
public Command getCommand(Request request) {
    if (REQ_CONNECTION_START.equals(request.getType()))
        return getConnectionCreateCommand((CreateConnectionRequest) request);
    if (REQ_CONNECTION_END.equals(request.getType()))
        return getConnectionCompleteCommand((CreateConnectionRequest) request);
    if (REQ_RECONNECT_TARGET.equals(request.getType()))
        return getReconnectTargetCommand((ReconnectRequest) request);
    if (REQ_RECONNECT_SOURCE.equals(request.getType()))
        return getReconnectSourceCommand((ReconnectRequest) request);

    return null;
}
项目:FRaMED    文件:ORMRelationGraphicalNodeEditPolicy.java   
/**
 * {@inheritDoc}
 * 
 * @return {@link ORMRelationCreateCommand} or null(when no condition is fufilled)
 * */
@Override
protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
 //TODO: check if implementation is correct
  if ((oSTCheck(request, Type.RELATIONSHIP_IMPLICATION, Type.RELATIONSHIP, Type.RELATIONSHIP) ||
    oSTCheck(request, Type.RELATIONSHIP_EXCLUSION, Type.RELATIONSHIP, Type.RELATIONSHIP)) 
      && tNotEqualSCheck(request)) {
    return setupConnectionCompleteCommand(request);
  }
  return null;
}
项目:FRaMED    文件:ORMRelationGraphicalNodeEditPolicy.java   
/**
 * {@inheritDoc}
 * 
 * @return {@link ORMRelationCreateCommand} or null(when no condition is fufilled)
 * */
@Override
protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
 //TODO: check if implementation is correct
  if (oTCheck(request, Type.RELATIONSHIP_IMPLICATION, Type.RELATIONSHIP) ||
    oTCheck(request, Type.RELATIONSHIP_EXCLUSION, Type.RELATIONSHIP)) {
    Relation target = (Relation) request.getTargetEditPart().getModel();
    return setupConnectionStartCommand(request, target.getContainer());
  }
  return null;
}
项目:FRaMED    文件:ORMRelationGraphicalNodeEditPolicy.java   
/**
 * This method completes and return the creation commands for all {@link Relation}s except for
 * {@link Relation}s from type cyclic, irreflexive, acyclic, reflexive and total.
 * 
 * @return {@link ORMRelationCreateCommand}
 * */
private ORMRelationCreateCommand setupConnectionCompleteCommand(
    final CreateConnectionRequest request) {
  final ORMRelationCreateCommand result = (ORMRelationCreateCommand) request.getStartCommand();
  result.setTarget(((Relation) getHost().getModel()).getConnectionAnchor());
  return result;
}
项目:FRaMED    文件:ORMRelationGraphicalNodeEditPolicy.java   
/**
 * This method creates and return the creation command for all {@link Relation}s except the
 * relations from type cyclic, total, acyclic, reflexive and irrflexive.
 * 
 * @return {@link ORMRelationCreateCommand}
 * */
private ORMRelationCreateCommand setupConnectionStartCommand(
    final CreateConnectionRequest request, final Model container) {
  final ORMRelationCreateCommand result = new ORMRelationCreateCommand();
  result.setSource(((Relation) getHost().getModel()).getConnectionAnchor());
  result.setRelation((Relation) request.getNewObject());
  result.setRelationContainer(container);

  request.setStartCommand(result);
  return result;
}
项目:FRaMED    文件:ORMShapeGraphicalNodeEditPolicy.java   
/**
 * {@inheritDoc} The feedback is only shown when the target edit part model is not the model
 * parent of the source edit part model. (this restriction is important for the creation of
 * {@link Relation}s in a {@link Shape} from type role group)
 */
@Override
protected void showCreationFeedback(final CreateConnectionRequest request) {
  if (!parentTest(request.getTargetEditPart(), request.getSourceEditPart())) {
    super.showCreationFeedback(request);
  }
}
项目:FRaMED    文件:ORMShapeGraphicalNodeEditPolicy.java   
/**
 * {@inheritDoc}
 * 
 * @return {@link ORMRelationshipConstraintCreateCommand}( in case a {@link Relation} from type
 *         cyclic, total, acyclic, reflexive or irreflexive should be created) or {@link ORMRelationCreateCommand}( in
 *         case any other Relation should be created)
 * */
@Override
protected Command getConnectionCompleteCommand(final CreateConnectionRequest request) {
  Command retVal = null;
  if (!(request.getNewObjectType().equals(Type.RELATIONSHIP_IMPLICATION)||
      request.getNewObjectType().equals(Type.RELATIONSHIP_EXCLUSION))) {
    if (isCompleteOK(request)) {
      retVal = setupConnectionCompleteCommand(request);
    }

    // Irreflexive Acyclic Total Cyclic Reflexive End
    if ((oSTCheck(request, Type.CYCLIC, Type.ROLE_TYPE, Type.ROLE_TYPE)
        || oSTCheck(request, Type.IRREFLEXIVE, Type.ROLE_TYPE, Type.ROLE_TYPE) || oSTCheck(
          request, Type.TOTAL, Type.ROLE_TYPE, Type.ROLE_TYPE) || oSTCheck(
          request, Type.ACYCLIC, Type.ROLE_TYPE, Type.ROLE_TYPE) || oSTCheck(
          request, Type.REFLEXIVE, Type.ROLE_TYPE, Type.ROLE_TYPE))
        && tNotEqualSCheck(request)
        && hasARelationship(request, true) && !hasConstraintsKind(request)) {
      final ORMRelationshipConstraintCreateCommand result =
          (ORMRelationshipConstraintCreateCommand) request.getStartCommand();
      result.setTarget((Shape) getHost().getModel());
      ArrayList<Relation> refrencedRelations = new ArrayList<Relation>();
      refrencedRelations.add(testedRelationship);
      result.setRefrencedRelations(refrencedRelations);

      retVal = result;
    }
  }
  return retVal;
}