private void buttonToMethodCallExpression_Click(object sender, EventArgs e) { Object selectedSource = expressionProvider.getSelectedSecond(); if (selectedSource is SDMExpressionHelper.SecondObject) { SDMExpressionHelper.SecondObject secondObject = selectedSource as SDMExpressionHelper.SecondObject; if (secondObject.eaObject is SQLMethod) { SQLMethod selectedOperation = secondObject.eaObject as SQLMethod; if (selectedOperation != null) { SQLMethod method = repository.GetMethodByID(selectedOperation.MethodID); EA.Diagram currentDiagram = repository.GetCurrentDiagram(); int sdmDiagramId = SDMUtil.getSDMDiagramID(repository, method); if (sdmDiagramId != SDMUtil.UNKNOWN_SDM_DIAGRAM_ID) { Navigator.addAnchorEntry(sdmDiagramId, currentDiagram.DiagramID); repository.OpenDiagram(sdmDiagramId); this.ParentForm.Close(); } else { CreateSDMDialog.CreateSDMDialog createSdmDialog = new CreateSDMDialog.CreateSDMDialog(); if (createSdmDialog.ShowDialog() == DialogResult.OK) { SDMModelingMain.createStoryDiagram(method, repository.eaRepository, currentDiagram); this.ParentForm.Close(); } } } } } }
private void buttonJump_Click(object sender, EventArgs e) { EA.Diagram currentDiagram = repository.GetCurrentDiagram(); Boolean handled = false; if (currentDiagram != null && currentDiagram.SelectedObjects.Count == 1) { EA.DiagramObject selectedDiagramObject = currentDiagram.SelectedObjects.GetAt(0) as EA.DiagramObject; SQLElement selectedElement = repository.GetElementByID(selectedDiagramObject.ElementID); EA.Diagram calledDiagram = null; Expression callExpression = null; if (selectedElement.Stereotype == SDMModelingMain.StatementNodeStereotype) { StatementNode statementNode = new StatementNode(repository, selectedElement); statementNode.loadTreeFromTaggedValue(); callExpression = statementNode.StatementExpression; } else if (selectedElement.Stereotype == SDMModelingMain.ObjectVariableStereotype) { ObjectVariable ov = new ObjectVariable(selectedElement, repository); ov.loadTreeFromTaggedValue(); callExpression = ov.BindingExpression; } else if (selectedElement.Stereotype == SDMModelingMain.StopNodeStereotype) { StopNode stopNode = new StopNode(repository, selectedElement); stopNode.loadTreeFromTaggedValue(); callExpression = stopNode.ReturnValue; } if (callExpression is MethodCallExpression) { MethodCallExpression mcE = callExpression as MethodCallExpression; SQLMethod calledMethod = repository.GetMethodByGuid(mcE.MethodGuid); if (calledMethod != null) { int sdmDiagramId = SDMUtil.getSDMDiagramID(repository, calledMethod); if (sdmDiagramId != SDMUtil.UNKNOWN_SDM_DIAGRAM_ID) { calledDiagram = repository.GetOriginalRepository().GetDiagramByID(sdmDiagramId); } } } if (calledDiagram != null) { Navigator.addAnchorEntry(calledDiagram.DiagramID, currentDiagram.DiagramID); repository.OpenDiagram(calledDiagram.DiagramID); handled = true; } } if (!handled) { if (currentDiagram != null) { Navigator.jumpToAnchorSuccessor(repository.GetOriginalRepository(), currentDiagram.DiagramID); } } }