/// <summary>
        /// Pressing the OK Button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(Object sender, EventArgs e)
        {
            EA.Diagram openDiag = repository.GetCurrentDiagram();
            //No Association between the objects classifiers has been found
            if (listboxLinks.Items.Count == 0)
            {
                System.Windows.Forms.MessageBox.Show("There is no Association between these two elements");
                Close();
                return;
            }
            if (listboxLinks.SelectedItem != null)
            {
                BindingSemantics bindingSemantics = BindingSemantics.MANDATORY;
                BindingOperator  bindingOperator  = BindingOperator.CHECK_ONLY;
                if (radioButtonMandatory.Checked)
                {
                    bindingSemantics = BindingSemantics.MANDATORY;
                }
                else if (radioButtonNegative.Checked)
                {
                    bindingSemantics = BindingSemantics.NEGATIVE;
                }
                if (radioButtonDestroy.Checked)
                {
                    bindingOperator = BindingOperator.DESTROY;
                }
                else if (radioButtonCreate.Checked)
                {
                    bindingOperator = BindingOperator.CREATE;
                }
                else if (radioButtonCheckOnly.Checked)
                {
                    bindingOperator = BindingOperator.CHECK_ONLY;
                }

                if (complexNAC1.getNacIndexValue() != "" && radioButtonNegative.Checked)
                {
                    linkVariable.NacIndex = int.Parse(complexNAC1.getNacIndexValue());
                }
                else
                {
                    linkVariable.NacIndex = -1;
                }

                linkVariable.linkDialogueEntry = this.linkDialogueEntries[listboxLinks.SelectedIndex];

                //new linkvariable handling
                linkVariable.BindingSemantics = bindingSemantics;
                linkVariable.BindingOperator  = bindingOperator;

                linkVariable.saveTreeToEATaggedValue(true);
                EA.Diagram currentDiag = repository.GetCurrentDiagram();
                if (currentDiag != null)
                {
                    repository.ReloadDiagram(currentDiag.DiagramID);
                }
                Close();
            }
        }
        /// <summary>
        /// pressing the OK button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public Boolean btnOK_Click()
        {
            if (comboTypes.Text != "" && comboTypes.SelectedIndex != -1)
            {
                BindingSemantics bindingSemantics = BindingSemantics.MANDATORY;
                BindingOperator  bindingOperator  = BindingOperator.CHECK_ONLY;
                BindingState     bindingState     = BindingState.UNBOUND;

                if (radioButtonMandatory.Checked)
                {
                    bindingSemantics = BindingSemantics.MANDATORY;
                }
                else if (radioButtonNegative.Checked)
                {
                    bindingSemantics = BindingSemantics.NEGATIVE;
                }

                if (radioButtonCreate.Checked)
                {
                    bindingOperator = BindingOperator.CREATE;
                }
                else if (radioButtonCheckonly.Checked)
                {
                    bindingOperator = BindingOperator.CHECK_ONLY;
                }
                else if (radioButtonDestroy.Checked)
                {
                    bindingOperator = BindingOperator.DESTROY;
                }

                if (!checkBoxBound.Checked)
                {
                    bindingState = BindingState.UNBOUND;
                }
                if (checkBoxBound.Checked)
                {
                    bindingState = BindingState.BOUND;
                }


                objectVariable.Name             = comboNames.Text;
                objectVariable.Classifier       = comboTypes.Classifiers[comboTypes.SelectedIndex];
                objectVariable.BindingOperator  = bindingOperator;
                objectVariable.BindingSemantics = bindingSemantics;
                objectVariable.BindingState     = bindingState;
                if (complexNACControl.getNacIndexValue() != "" && radioButtonNegative.Checked)
                {
                    objectVariable.NacIndex = int.Parse(complexNACControl.getNacIndexValue());
                }
                else
                {
                    objectVariable.NacIndex = -1;
                }
                return(true);
            }
            return(false);
        }
Beispiel #3
0
 public static BindingSemantics computeBindingSemantics(String value)
 {
     try
     {
         BindingSemantics bS = (BindingSemantics)Enum.Parse(typeof(BindingSemantics), value.ToUpper());
         return(bS);
     }
     catch
     {
         return(BindingSemantics.MANDATORY);
     }
 }
        private void onPostLinkVariableConnector(SQLRepository sqlRepository, EA.Connector actCon2)
        {
            //save initial data for linkVariable
            SQLConnector     actCon           = sqlRepository.GetConnectorByID(actCon2.ConnectorID);
            TGGLinkVariable  linkVariable     = new TGGLinkVariable(actCon, sqlRepository);
            SQLElement       newClient        = sqlRepository.GetElementByID(actCon.ClientID);
            SQLElement       newSupplier      = sqlRepository.GetElementByID(actCon.SupplierID);
            String           clientObjMod     = EAEcoreAddin.Util.EAUtil.findTaggedValue(newClient, ObjectVariable.BindingOperatorTaggedValueName).Value;
            String           supplierObjMod   = EAEcoreAddin.Util.EAUtil.findTaggedValue(newSupplier, ObjectVariable.BindingOperatorTaggedValueName).Value;
            BindingSemantics bindingSemantics = BindingSemantics.MANDATORY;
            BindingOperator  bindingOperator  = BindingOperator.CHECK_ONLY;

            if (supplierObjMod == "create" || clientObjMod == "create")
            {
                bindingSemantics = BindingSemantics.MANDATORY;
                bindingOperator  = BindingOperator.CREATE;
            }
            else if (supplierObjMod == "destroy" || clientObjMod == "destroy")
            {
                bindingSemantics = BindingSemantics.MANDATORY;
                bindingOperator  = BindingOperator.DESTROY;
            }
            else if (supplierObjMod == "check_only" && clientObjMod == "check_only")
            {
                bindingSemantics = BindingSemantics.MANDATORY;
                bindingOperator  = BindingOperator.CHECK_ONLY;
            }
            else if (supplierObjMod == "create" && clientObjMod == "destroy" || supplierObjMod == "destroy" && clientObjMod == "create")
            {
                bindingSemantics = BindingSemantics.MANDATORY;
                bindingOperator  = BindingOperator.CHECK_ONLY;
            }

            linkVariable.BindingOperator  = bindingOperator;
            linkVariable.BindingSemantics = bindingSemantics;

            this.LinkVariableDialog = new LinkVariablePropertiesForm(linkVariable, sqlRepository, false);
            EAEcoreAddin.Util.EAUtil.setTaggedValue(sqlRepository, actCon.getRealConnector(), Main.MoflonVerboseTaggedValueName, Main.FalseValue);
        }
Beispiel #5
0
        private void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            BindingSemantics bindingSemantics = BindingSemantics.MANDATORY;
            BindingOperator  bindingOperator  = BindingOperator.CHECK_ONLY;

            if (radioButtonMandatory.Checked)
            {
                bindingSemantics = BindingSemantics.MANDATORY;
            }
            else if (radioButtonNegative.Checked)
            {
                bindingSemantics = BindingSemantics.NEGATIVE;
            }
            if (radioButtonDestroy.Checked)
            {
                bindingOperator = BindingOperator.DESTROY;
            }
            else if (radioButtonCreate.Checked)
            {
                bindingOperator = BindingOperator.CREATE;
            }
            else if (radioButtonCheckOnly.Checked)
            {
                bindingOperator = BindingOperator.CHECK_ONLY;
            }


            foreach (EA.Element selectedOv in this.selectedObjectVariables)
            {
                ObjectVariable currentOV = ObjectVariable.createCorrectOvType(repository.GetElementByID(selectedOv.ElementID), repository);
                currentOV.loadTreeFromTaggedValue();

                currentOV.BindingSemantics = bindingSemantics;
                currentOV.BindingOperator  = bindingOperator;

                if (bindingOperator == BindingOperator.CHECK_ONLY)
                {
                    TGGModelingUtil.assignmentsToConstraints(currentOV, repository);
                }
                else if (bindingOperator == BindingOperator.CREATE)
                {
                    TGGModelingUtil.constraintsToAssignments(currentOV, repository);
                }

                currentOV.saveTreeToEATaggedValue(true);
            }

            if (checkBoxLinksToo.Checked)
            {
                foreach (EA.Connector selectedLink in this.selectedLinkVariables)
                {
                    LinkVariable lv = null;
                    if (selectedLink.Stereotype == SDMModelingMain.LinkVariableStereotype)
                    {
                        lv = new LinkVariable(repository.GetConnectorByID(selectedLink.ConnectorID), repository);
                    }
                    else if (selectedLink.Stereotype == TGGModelingMain.TggLinkVariableStereotype)
                    {
                        lv = new TGGLinkVariable(repository.GetConnectorByID(selectedLink.ConnectorID), repository);
                    }

                    lv.loadTreeFromTaggedValue();
                    lv.BindingOperator  = bindingOperator;
                    lv.BindingSemantics = bindingSemantics;

                    lv.saveTreeToEATaggedValue(true);
                }
            }
            repository.ReloadDiagram(repository.GetCurrentDiagram().DiagramID);
            Close();
        }
        public Boolean EA_OnPostNewConnector(SQLRepository sqlRep, EA.Connector actCon, EA.Diagram currentDiagram)
        {
            if (SdmDiagramMetatype.Contains(currentDiagram.MetaType))
            {
                sqlRep.SaveDiagram(currentDiagram.DiagramID);
                if (actCon.Stereotype == SDMModelingMain.LinkVariableStereotype)
                {
                    //save initial data for linkVariable
                    LinkVariable   linkVariable = new LinkVariable(sqlRep.GetConnectorByID(actCon.ConnectorID), sqlRep);
                    ObjectVariable newClient    = new ObjectVariable(sqlRep.GetElementByID(actCon.ClientID), sqlRep);
                    ObjectVariable newSupplier  = new ObjectVariable(sqlRep.GetElementByID(actCon.SupplierID), sqlRep);
                    newClient.loadTreeFromTaggedValue();
                    newSupplier.loadTreeFromTaggedValue();
                    String           clientBindingOperator   = newClient.BindingOperator.ToString().ToLower();
                    String           supplierBindingOperator = newSupplier.BindingOperator.ToString().ToLower();
                    BindingSemantics bindingSemantics        = BindingSemantics.MANDATORY;
                    BindingOperator  bindingOperator         = BindingOperator.CHECK_ONLY;

                    if (supplierBindingOperator == BindingOperator.CREATE.ToString().ToLower() || clientBindingOperator == BindingOperator.CREATE.ToString().ToLower())
                    {
                        bindingSemantics = BindingSemantics.MANDATORY;
                        bindingOperator  = BindingOperator.CREATE;
                    }
                    else if (supplierBindingOperator == BindingOperator.DESTROY.ToString().ToLower() || clientBindingOperator == BindingOperator.DESTROY.ToString().ToLower())
                    {
                        bindingSemantics = BindingSemantics.MANDATORY;
                        bindingOperator  = BindingOperator.DESTROY;
                    }
                    else if (supplierBindingOperator == BindingOperator.CHECK_ONLY.ToString().ToLower() && clientBindingOperator == BindingOperator.CHECK_ONLY.ToString().ToLower())
                    {
                        bindingSemantics = BindingSemantics.MANDATORY;
                        bindingOperator  = BindingOperator.CHECK_ONLY;
                    }
                    else if (supplierBindingOperator == BindingOperator.CHECK_ONLY.ToString().ToLower() && clientBindingOperator == BindingOperator.DESTROY.ToString().ToLower() || supplierBindingOperator == BindingOperator.DESTROY.ToString().ToLower() && clientBindingOperator == BindingOperator.CREATE.ToString().ToLower())
                    {
                        bindingSemantics = BindingSemantics.MANDATORY;
                        bindingOperator  = BindingOperator.CHECK_ONLY;
                    }
                    linkVariable.BindingOperator  = bindingOperator;
                    linkVariable.BindingSemantics = bindingSemantics;
                    LinkVariablePropertiesForm linkVariableDialogue = new LinkVariablePropertiesForm(linkVariable, sqlRep, false);
                }
                else if (actCon.Type.Equals(Main.EAControlFlowType))
                {
                    ActivityEdge activityEdge = new ActivityEdge(sqlRep, sqlRep.GetConnectorByID(actCon.ConnectorID));

                    //if there is already Success / Failure / ForEach / End guarded edge set new Edge respectively
                    foreach (SQLConnector outgoingEdge in activityEdge.Source.Connectors)
                    {
                        if (outgoingEdge.ClientID == activityEdge.Source.ElementID && outgoingEdge.ConnectorID != activityEdge.EaConnector.ConnectorID)
                        {
                            if (outgoingEdge.TransitionGuard == ActivityEdge.EdgeGuardFailureGui)
                            {
                                activityEdge.GuardType = EdgeGuard.SUCCESS;
                                break;
                            }
                            else if (outgoingEdge.TransitionGuard == ActivityEdge.EdgeGuardSuccessGui)
                            {
                                activityEdge.GuardType = EdgeGuard.FAILURE;
                                break;
                            }
                            else if (outgoingEdge.TransitionGuard == ActivityEdge.EdgeGuardEachTimeGui)
                            {
                                activityEdge.GuardType = EdgeGuard.END;
                                break;
                            }
                            else if (outgoingEdge.TransitionGuard == ActivityEdge.EdgeGuardEndGui)
                            {
                                activityEdge.GuardType = EdgeGuard.EACH_TIME;
                                break;
                            }
                        }
                    }

                    if (activityEdge.GuardType == EdgeGuard.NONE)
                    {
                        SQLElement sourceNode = sqlRep.GetElementByID(actCon.ClientID);
                        if (sourceNode.Stereotype == SDMModelingMain.StoryNodeStereotype)
                        {
                            StoryNode storyNode = new StoryNode(sqlRep, sourceNode);
                            storyNode.loadTreeFromTaggedValue();
                            if (storyNode.ForEach)
                            {
                                activityEdge.GuardType = EdgeGuard.END;
                            }
                        }
                    }

                    activityEdge.saveTreeToEATaggedValue(true);
                }
            }
            return(true);
        }