/** @see org.eclipse.bpel.ui.actions.editpart.IEditPartAction#onButtonPressed() */
  public boolean onButtonPressed() {
    CompoundCommand command = new CompoundCommand(IBPELUIConstants.CMD_ADD_TERMINATIONHANDLER);
    final EObject child =
        UIObjectFactoryProvider.getInstance()
            .getFactoryFor(BPELPackage.eINSTANCE.getTerminationHandler())
            .createInstance();

    command.add(new InsertInContainerCommand((EObject) modelObject, child, null));
    command.add(new SetNameAndDirectEditCommand(child, viewer));
    ModelHelper.getBPELEditor(modelObject).getCommandStack().execute(command);
    BPELUtil.setShowTerminationHandler(editPart, true);
    return true;
  }
示例#2
0
  public boolean onButtonPressed() {
    CompoundCommand command = new CompoundCommand();
    final ElseIf child =
        (ElseIf)
            UIObjectFactoryProvider.getInstance()
                .getFactoryFor(BPELPackage.eINSTANCE.getElseIf())
                .createInstance();

    command.add(new InsertInContainerCommand((EObject) modelObject, child, null));
    command.add(new SetNameAndDirectEditCommand(child, viewer));
    BPELEditor bpelEditor = ModelHelper.getBPELEditor(modelObject);
    bpelEditor.getCommandStack().execute(command);
    return true;
  }
示例#3
0
    @Override
    protected ArrayList<PolylineConnection> createHorizontalConnections(BPELEditPart parent) {
      ArrayList<PolylineConnection> connections = new ArrayList<PolylineConnection>();
      List children = getConnectionChildren(parent);
      BPELEditPart sourcePart, targetPart;
      ConnectionAnchor sourceAnchor = null, targetAnchor = null;

      sourcePart = parent;
      sourceAnchor = sourcePart.getConnectionAnchor(CenteredConnectionAnchor.LEFT);

      if (children != null) {
        for (int i = 0; i < children.size(); i++) {
          if (i == 0) {
            // Link from the left border to the first child
            targetPart = (BPELEditPart) children.get(i);
            targetAnchor = targetPart.getConnectionAnchor(CenteredConnectionAnchor.LEFT);
            if (sourceAnchor != null && targetAnchor != null)
              connections.add(createConnection(sourceAnchor, targetAnchor, arrowColor));
          }
          if (i < children.size() - 1) {
            sourcePart = (BPELEditPart) children.get(i);
            sourceAnchor = sourcePart.getConnectionAnchor(CenteredConnectionAnchor.RIGHT);

            targetPart = (BPELEditPart) children.get(i + 1);
            targetAnchor = targetPart.getConnectionAnchor(CenteredConnectionAnchor.LEFT);
          } else {
            // Link from the last child to the right border
            sourcePart = (BPELEditPart) children.get(i);
            sourceAnchor = sourcePart.getConnectionAnchor(CenteredConnectionAnchor.RIGHT);
            targetAnchor = parent.getConnectionAnchor(CenteredConnectionAnchor.RIGHT);
          }
          if (sourceAnchor != null && targetAnchor != null) {
            PolylineConnection connection =
                createConnection(sourceAnchor, targetAnchor, arrowColor);

            if (sourcePart instanceof StartNodeEditPart
                || sourcePart instanceof ScopeEditPart
                || sourcePart instanceof InvokeEditPart) {
              boolean horizontal =
                  ModelHelper.getBPELEditor(getHost().getModel()).isHorizontalLayout();
              connection.setConnectionRouter(new ImplicitLinkHandlerConnectionRouter(horizontal));
            }
            connections.add(connection);
          }
        }
      }
      return connections;
    }
 public boolean onButtonPressed() {
   CompoundCommand command = new CompoundCommand(IBPELUIConstants.CMD_ADD_EVENTHANDLER);
   final EventHandler eventHandler = BPELFactory.eINSTANCE.createEventHandler();
   // Create an empty OnEvent inside it.
   final OnEvent onEvent =
       (OnEvent)
           UIObjectFactoryProvider.getInstance()
               .getFactoryFor(BPELPackage.eINSTANCE.getOnEvent())
               .createInstance();
   eventHandler.getEvents().add(onEvent);
   command.add(new InsertInContainerCommand((EObject) modelObject, eventHandler, null));
   command.add(new SetNameAndDirectEditCommand(onEvent, viewer));
   ModelHelper.getBPELEditor(modelObject).getCommandStack().execute(command);
   BPELUtil.setShowEventHandler(editPart, true);
   return true;
 }
  protected boolean handleAddImport(Object obj) {

    // Do not import schema for schemas
    if (obj instanceof XSDSimpleTypeDefinition) {

      String targetNamespace = ((XSDSimpleTypeDefinition) obj).getTargetNamespace();
      if (targetNamespace != null) {
        if (((XSDSimpleTypeDefinition) obj)
            .getTargetNamespace()
            .equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001)) {
          return false;
        }
      }
    }

    AddImportCommand cmd = new AddImportCommand(BPELUtils.getProcess(modelObject), obj);

    if (cmd.canDoExecute() && cmd.wouldCreateDuplicateImport() == false) {
      ModelHelper.getBPELEditor(modelObject).getCommandStack().execute(cmd);
      // Now refresh the view to imported types.
      return true;
    }
    return false;
  }