/// <summary> /// Processes code generation request /// </summary> private void HandleCodeGeneration() { WhiteStarUML.IUMLClassDiagram selectedDiagram = ((DiagramListBoxItemWrapper)diagramListBox.SelectedItem).Diagram; bool operationSucceded = false; try { operationSucceded = CodeGenerator.Instance.GenerateCode(selectedDiagram); } catch (Exception e) { MessageBox.Show(this, e.Message, Symbols.MSG_GENERATION_FAILED, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (operationSucceded) { MessageBox.Show(this, Symbols.MSG_GENERATION_SUCCEEDED_LONG, Symbols.MSG_GENERATION_SUCCEEDED, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(this, Symbols.ERR_NO_ERD_DATA, Symbols.MSG_GENERATION_FAILED, MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// Top level generation routine /// </summary> /// <param name="diagram">ERD diagram</param> /// <returns>True if operation succeded</returns> internal bool GenerateCode(WhiteStarUML.IUMLClassDiagram diagram) { // Get IR data from diagram List <IR.Table> tables = ProjectManagerHandler.Instance.GetErdTables(diagram); if (tables.Count == 0) { return(false); } else { SetTemplateGroup(); // Repeated for template debugging GenerateDiagram(tables); return(true); } }
internal DiagramListBoxItemWrapper(WhiteStarUML.IUMLClassDiagram diag) { Diagram = diag; m_name = diag.Name; }