public override void doRuleQuickFix(SQLElement eaElement, SQLWrapperClasses.SQLRepository repository, int i, String errorMessage) { if (errorMessage == "AttributeAssignments and BindingOperator check_only is not allowed") { if (i == 0) { TGGObjectVariable tggOv = new TGGObjectVariable(eaElement, repository); tggOv.loadTreeFromTaggedValue(); TGGModelingUtil.assignmentsToConstraints(tggOv, repository); tggOv.saveTreeToEATaggedValue(true); } else if (i == 1) { TGGObjectVariable tggOv = new TGGObjectVariable(eaElement, repository); tggOv.loadTreeFromTaggedValue(); tggOv.BindingOperator = BindingOperator.CREATE; tggOv.saveTreeToEATaggedValue(true); } } }
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(); }