Package eu.admire.dispel.core

Examples of eu.admire.dispel.core.ProcessingElementDefinition


        }

        if (ref != null
            && ref.getTarget() instanceof ProcessingElementDefinition) {

          ProcessingElementDefinition pe = (ProcessingElementDefinition) ref
              .getTarget();

          if (pe != null && !pe.eIsProxy()) {

            ProcessingElementInstance instance = pe
                .createInstance();

            var.setValue(instance);

            if (!instance.getNamespaces().isEmpty()) {
View Full Code Here


   
        ProcessingElementReference ref = (ProcessingElementReference)var.getTypeReference();
     
        if ( ref.getTarget() instanceof ProcessingElementDefinition ) {
         
          ProcessingElementDefinition  def  =  (ProcessingElementDefinition)ref.getTarget();

          ProcessingElementDefinition newDef = (ProcessingElementDefinition) EcoreUtil
              .copy(def);
         
          newDef.setName(var.getName());

          var.getContainingPackage().getTypeDefinitions().add(newDef);
       
      }   
    }
View Full Code Here

      if (linked instanceof LocalVariableStatement) {
        LocalVariableStatement lvs = (LocalVariableStatement) linked;

        if (lvs.getVariable().getTypeReference().getTarget() instanceof
            ProcessingElementDefinition) {
          ProcessingElementDefinition pd =
              (ProcessingElementDefinition) lvs.getVariable(
                  ).getTypeReference().getTarget();
          if (pd.getName().equals(type)) {
            peShape = s;
            modelObject = lvs;
            break;
          }
        }
View Full Code Here

    ProcessingElementInstance modelElement = (ProcessingElementInstance) containerView
        .getElement();
    LinkedList<DispelNodeDescriptor> result = new LinkedList<DispelNodeDescriptor>();
    {
      //TODO:iFO     
      ProcessingElementDefinition childElement = (ProcessingElementDefinition) modelElement
          .getTypeReference().getTarget();

      int visualID = DispelVisualIDRegistry.getNodeVisualID(view,
          childElement);
      if (visualID == ProcessingElementMethodDefinitionEditPart.VISUAL_ID) {
View Full Code Here

  /**
   * Creates the PE with a generated name.
   */
  public Object[] create(ICreateContext context) {
 
    ProcessingElementDefinition pd = getSelectedPEDef();
    if (pd == null) {
      MessageDialog.openInformation(Utility.getShell(),
          "No Processing Element Selected",
          "First click on a Processing Element in the Registry " +
          "View to highlight it before selecting the tool from " +
View Full Code Here

   *
   * @return Currently selected PE or null if none.
   */
  private ProcessingElementDefinition getSelectedPEDef() {

    ProcessingElementDefinition p = null;

    IConfigurationElement[] config = Platform.getExtensionRegistry()
        .getConfigurationElementsFor(IREGISTRYCLIENT_VIEW_ID);

    for (IConfigurationElement e : config) {
View Full Code Here

      String peName,
      TransactionalEditingDomain editingDomain,
      eu.admire.dispel.containers.Package pck) {
 
    //Make a copy of the defintion and create our instance object
    ProcessingElementDefinition peDef =
        (ProcessingElementDefinition) EcoreUtil.copy(selectedPE);
    ProcessingElementInstance peInstance =
        (ProcessingElementInstance) peDef.createInstance();

    // PE
    DispelTypeReference ref1 = ReferencesFactory.eINSTANCE
        .createDispelTypeReference();
    DispelTypeReference ref2 = ReferencesFactory.eINSTANCE
        .createDispelTypeReference();
   
    Pair <AssignmentExpression, SuffixUnaryModificationExpression> p =
        Utility.createAssToSuffUModExpressionChain();

    //The "new" bit
    NewProcessingElementCall call = InstantiationsFactory.eINSTANCE
        .createNewProcessingElementCall();
    p.getRight().setChild(call);

    call.setTypeReference(ref2);
    ref1.setTarget(peDef);
    ref2.setTarget(peDef);

    // The variable we are setting to the PE.
    LocalVariableStatement statement = StatementsFactory.eINSTANCE
        .createLocalVariableStatement();
    LocalVariable variable = VariablesFactory.eINSTANCE
        .createLocalVariable();
    statement.setVariable(variable);

    variable.setTypeReference(ref1);
    variable.setName(peName);
    variable.setInitialValue(p.getLeft());
    variable.setValue(peInstance);

    // Think Ivan recently added this to deal with arrays of PEs.

    ArrayList<DispelType> tDefinitions = new ArrayList<DispelType>(
        pck.getTypeDefinitions());
    tDefinitions.add(peDef);
    ArrayList<Statement> tStatements = new ArrayList<Statement>(
        pck.getStatements());
    Utility.addAsLastNonSubmitStatement(statement, tStatements);
    ArrayList<ProcessingElementInstance> tPEs =
        new ArrayList<ProcessingElementInstance>
            (pck.getProcessingElementInstances());
    tPEs.add(peInstance);

    // Add Instance

    org.eclipse.emf.common.command.Command cmd = SetCommand.create(
        editingDomain,
        pck,
        (EStructuralFeature) pck.eClass().getEStructuralFeature(
            "typeDefinitions"), tDefinitions);

    editingDomain.getCommandStack().execute(cmd);

    // Add Instance

    cmd = SetCommand.create(
        editingDomain,
        pck,
        (EStructuralFeature) pck.eClass().getEStructuralFeature(
            "processingElementInstances"), tPEs);

    editingDomain.getCommandStack().execute(cmd);

    // Add Statement

    cmd = SetCommand.create(
        editingDomain,
        pck,
        (EStructuralFeature) pck.eClass().getEStructuralFeature(
            "statements"), tStatements);

    editingDomain.getCommandStack().execute(cmd);

    // IMPORTS:

    ArrayList<Import> tImports = new ArrayList<Import>(pck.getImports());
    TypeImport pImport = ImportsFactory.eINSTANCE.createTypeImport();
    pImport.setType(peDef);
    pImport.getNamespaces().addAll(peDef.getNamespaces());
    tImports.add(pImport);

    cmd = SetCommand.create(
        editingDomain,
        pck,
View Full Code Here

    .getDiagramView().getElement();

    eu.admire.dispel.containers.Package pck = (eu.admire.dispel.containers.Package) fnc.getContainingPackage();
   
   
    ProcessingElementDefinition peDef = (ProcessingElementDefinition) EcoreUtil
        .copy(selectedProcessingElement);

    ProcessingElementInstance peInstance = (ProcessingElementInstance) peDef
        .createInstance();

    // PE

    DispelTypeReference ref1 = ReferencesFactory.eINSTANCE
        .createDispelTypeReference();

    DispelTypeReference ref2 = ReferencesFactory.eINSTANCE
        .createDispelTypeReference();

    AssignmentExpression ex1 = ExpressionsFactory.eINSTANCE
        .createAssignmentExpression();

    ConditionalExpression ex2 = ExpressionsFactory.eINSTANCE
        .createConditionalExpression();

    ex1.setChild(ex2);

    ConditionalOrExpression ex3 = ExpressionsFactory.eINSTANCE
        .createConditionalOrExpression();

    ex2.setChild(ex3);

    ConditionalAndExpression ex4 = ExpressionsFactory.eINSTANCE
        .createConditionalAndExpression();

    ex3.getChildren().add(ex4);

    InclusiveOrExpression ex5 = ExpressionsFactory.eINSTANCE
        .createInclusiveOrExpression();

    ex4.getChildren().add(ex5);

    ExclusiveOrExpression ex6 = ExpressionsFactory.eINSTANCE
        .createExclusiveOrExpression();

    ex5.getChildren().add(ex6);

    AndExpression ex7 = ExpressionsFactory.eINSTANCE.createAndExpression();

    ex6.getChildren().add(ex7);

    EqualityExpression ex8 = ExpressionsFactory.eINSTANCE
        .createEqualityExpression();

    ex7.getChildren().add(ex8);

    RelationExpression ex9 = ExpressionsFactory.eINSTANCE
        .createRelationExpression();

    ex8.getChildren().add(ex9);

    ShiftExpression ex10 = ExpressionsFactory.eINSTANCE
        .createShiftExpression();

    ex9.getChildren().add(ex10);

    AdditiveExpression ex11 = ExpressionsFactory.eINSTANCE
        .createAdditiveExpression();

    ex10.getChildren().add(ex11);

    MultiplicativeExpression ex12 = ExpressionsFactory.eINSTANCE
        .createMultiplicativeExpression();

    ex11.getChildren().add(ex12);

    UnaryExpression ex13 = ExpressionsFactory.eINSTANCE
        .createUnaryExpression();

    ex12.getChildren().add(ex13);

    SuffixUnaryModificationExpression ex14 = ExpressionsFactory.eINSTANCE
        .createSuffixUnaryModificationExpression();

    ex13.setChild(ex14);

    NewProcessingElementCall call = InstantiationsFactory.eINSTANCE
        .createNewProcessingElementCall();

    ex14.setChild(call);

    call.setTypeReference(ref2);

    ref1.setTarget(peDef);
    ref2.setTarget(peDef);

    // VARIABLE:
    LocalVariableStatement statement = StatementsFactory.eINSTANCE
        .createLocalVariableStatement();

    LocalVariable variable = VariablesFactory.eINSTANCE
        .createLocalVariable();

    statement.setVariable(variable);

    variable.setTypeReference(ref1);
    variable.setName("new_variable");
    variable.setInitialValue(ex1);

    variable.setValue(peInstance);

    // iFOnew

    ArrayList<DispelType> tDefinitions = new ArrayList<DispelType>(
        pck.getTypeDefinitions());

    tDefinitions.add(peDef);

    ArrayList<Statement> tStatements = new ArrayList<Statement>(
        fnc.getStatements());

    tStatements.add(statement);

    ArrayList<ProcessingElementInstance> tPEs = new ArrayList<ProcessingElementInstance>(
        fnc.getProcessingElementInstances());

    tPEs.add(peInstance);

    // Add Instance

    cmd = SetCommand.create(
        diagram.getEditingDomain(),
        eObj,
        (EStructuralFeature) eObj.eClass().getEStructuralFeature(
            "typeDefinitions"), tDefinitions);

    diagram.getEditingDomain().getCommandStack().execute(cmd);

    // TODO: POSITION ??

    // Add Instance

    cmd = SetCommand.create(
        diagram.getEditingDomain(),
        eObj,
        (EStructuralFeature) eObj.eClass().getEStructuralFeature(
            "processingElementInstances"), tPEs);

    diagram.getEditingDomain().getCommandStack().execute(cmd);

    // Add Statement

    cmd = SetCommand.create(
        diagram.getEditingDomain(),
        eObj,
        (EStructuralFeature) eObj.eClass().getEStructuralFeature(
            "statements"), tStatements);

    diagram.getEditingDomain().getCommandStack().execute(cmd);

    // IMPORTS:

    ArrayList<Import> tImports = new ArrayList<Import>(pck.getImports());

    TypeImport pImport = ImportsFactory.eINSTANCE.createTypeImport();

    pImport.setType(peDef);

    pImport.getNamespaces().addAll(peDef.getNamespaces());

    tImports.add(pImport);

    cmd = SetCommand.create(
        diagram.getEditingDomain(),
View Full Code Here

   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetTypeDefinition(ProcessingElementDefinition newTypeDefinition, NotificationChain msgs) {
    ProcessingElementDefinition oldTypeDefinition = typeDefinition;
    typeDefinition = newTypeDefinition;
    if (eNotificationRequired()) {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StatementsPackage.PROCESSING_ELEMENT_TYPE_DEFINITION_STATEMENT__TYPE_DEFINITION, oldTypeDefinition, newTypeDefinition);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
View Full Code Here

              if (nPe.getName().equals(
                  fragments[fragments.length - 1])
                  && nPe.getNamespacesAsString().equals(
                      imp.getNamespacesAsString())) {

                ProcessingElementDefinition peDef = (ProcessingElementDefinition) EcoreUtil
                    .copy(nPe);

                if (pck.getTypeDefinition(
                    peDef.getNamespacesAsString(),
                    peDef.getName()) == null) {
                 
                  pck.getTypeDefinitions().add(
                      (ProcessingElementDefinition) peDef);
                 
                  peImp.setType(peDef);
View Full Code Here

TOP

Related Classes of eu.admire.dispel.core.ProcessingElementDefinition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.