private void outputChangedDetailAttribute(ArtifactVO atf, ElementVO elem, AttributeVO attr, StreamWriter sw) { sw.Write("\"" + atf.changed + "\""); sw.Write(",\"" + atf.guid + "\""); sw.Write(",\"" + atf.name + "\""); sw.Write(",\"" + atf.pathName + "\""); sw.Write(",\"" + elem.changed + "\""); sw.Write(",\"" + elem.guid + "\""); sw.Write(",\"" + elem.name + "\""); sw.Write(",\"属性\""); sw.Write(",\"" + attr.changed + "\""); sw.Write(",\"" + attr.guid + "\""); sw.Write(",\"" + attr.name + "\""); if (attr.changed == 'D' || attr.changed == 'U') { sw.Write(",\"#attribute_" + attr.guid.Substring(1, 36) + "_L.xml\""); } else { sw.Write(",\"\""); } if (attr.changed == 'C' || attr.changed == 'U') { sw.Write(",\"#attribute_" + attr.guid.Substring(1, 36) + "_R.xml\""); } else { sw.Write(",\"\""); } sw.WriteLine(""); }
/// <summary> /// t_attr_meth テーブルに属性行の追加 /// </summary> /// <param name="atf"></param> /// <param name="elem"></param> private void insertAttrTable(ArtifactVO atf, ElementVO elem, AttributeVO attr) { string sql = @"insert into t_attr_mth ( attrMthId, elemId, elemGuid, attrMthFlg, attrMthType, attrMthGuid, attrMthName, attrMthAlias, attrMthNotes ) values ( @attrMthId, @elemId, @elemGuid, @attrMthFlg, @attrMthType, @attrMthGuid, @attrMthName, @attrMthAlias, @attrMthNotes ) " ; using (SQLiteCommand command2 = conn.CreateCommand()) { SQLiteParameter[] parameters = new SQLiteParameter[] { new SQLiteParameter("@attrMthId", (attr.attributeId) * -1) , new SQLiteParameter("@elemId", elem.elementId) , new SQLiteParameter("@elemGuid", elem.guid) , new SQLiteParameter("@attrMthFlg", "a") , new SQLiteParameter("@attrMthType", attr.eaType) , new SQLiteParameter("@attrMthGuid", attr.guid) , new SQLiteParameter("@attrMthName", attr.name) , new SQLiteParameter("@attrMthAlias", attr.alias) , new SQLiteParameter("@attrMthNotes", attr.notes) }; command2.CommandText = sql; command2.Parameters.AddRange(parameters); command2.ExecuteNonQuery(); } }
/// <summary> /// コンテキストメニュー:EAに反映 のクリックイベント /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void ReflectToEAToolStripMenuItemClick(object sender, EventArgs e) { EA.Repository repo = ProjectSetting.getVO().eaRepo; if (repo != null) { Control source = contextMenuStrip1.SourceControl; if (source != null) { if (source.Tag is AttributeVO) { AttributeVO att = (AttributeVO)source.Tag; confirmUpdateAttribute(repo, att); } else if (source.Tag is MethodVO) { MethodVO mth = (MethodVO)source.Tag; confirmUpdateMethod(repo, mth); } } } else { MessageBox.Show("EAにアタッチしていないため、反映できません"); } }
void MethodListClick(object sender, EventArgs e) { ListBox touchedList = (ListBox)sender; selectedMethod = (MethodVO)touchedList.Tag; selectedAttribute = null; }
private static void Main(string[] args) { bool isAttribute; if (args != null && args.Length >= 5) { string prjfile = "project.bdprj"; if (ProjectSetting.load(args[0] + "\\" + prjfile)) { ElementVO elem = new ElementVO(); elem.guid = args[3]; elem.attributes = new List <AttributeVO>(); elem.methods = new List <MethodVO>(); if (args[1] == "a" || args[1] == "A") { isAttribute = true; } else { isAttribute = false; } char changed; if (args[2] == "C" || args[2] == "U" || args[2] == "D") { changed = args[2][0]; } else { MessageBox.Show("コマンド: DiffViewer <ArtifactPath> <属性:a/操作:m> <CUD> <ElementGuid> <MethodGuid>"); return; } if (isAttribute) { AttributeVO att = new AttributeVO(); att.guid = args[4]; att.changed = changed; elem.attributes.Add(att); } else { MethodVO mth = new MethodVO(); mth.guid = args[4]; mth.changed = changed; elem.methods.Add(mth); } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm(elem)); } } else { MessageBox.Show("コマンド: DiffViewer <ArtifactPath> <属性:a/操作:m> <CUD> <ElementGuid> <MethodGuid>"); } }
// 1.2.1 属性のタグ付き値を出力 private static void outputAttributeTags(AttributeVO attr, int depth, StreamWriter sw) { if (attr.taggedValues == null || attr.taggedValues.Count <= 0) { return; } sw.WriteLine(indent(depth) + "<taggedValues>"); // 取得できたタグ付き値の情報をファイルに展開する foreach (AttributeTagVO tagv in attr.taggedValues) { if ("<memo>".Equals(tagv.tagValue)) { if (tagv.notes != null) { sw.WriteLine(indent(depth) + " <tv guid=\"" + escapeXML(tagv.guid) + "\" name=\"" + escapeXML(tagv.name) + "\" value=\"" + escapeXML(tagv.tagValue) + "\">" + escapeXML(tagv.notes) + "</tv>"); } } else { sw.WriteLine(indent(depth) + " <tv guid=\"" + escapeXML(tagv.guid) + "\" name=\"" + escapeXML(tagv.name) + "\" value=\"" + escapeXML(tagv.tagValue) + "\"/>"); } } sw.WriteLine(indent(depth) + "</taggedValues>"); }
/// <summary> /// 差異が検出された2つの属性の不一致な項目=値をつなげた文字列を作成 /// </summary> /// <param name="leftAttr">(in)左の属性VO</param> /// <param name="rightAttr">(in)右の属性VO</param> /// <param name="leftText">(out)左用の出力テキスト</param> /// <param name="rightText">(out)右用の出力テキスト</param> /// <returns></returns> private void getDisagreedAttributeDesc(AttributeVO leftAttr, AttributeVO rightAttr, ref string leftText, ref string rightText) { System.Text.StringBuilder lsb = new System.Text.StringBuilder(); lsb.Append(leftAttr.name + "[" + leftAttr.alias + "]" + "\r\n"); lsb.Append(leftAttr.guid + "\r\n"); lsb.Append(leftAttr.getComparedString(rightAttr)); leftText = lsb.ToString(); System.Text.StringBuilder rsb = new System.Text.StringBuilder(); rsb.Append(rightAttr.name + "[" + rightAttr.alias + "]" + "\r\n"); rsb.Append(rightAttr.guid + "\r\n"); rsb.Append(rightAttr.getComparedString(leftAttr)); rightText = rsb.ToString(); // if ( !compareNullable(leftAttr.stereoType, rightAttr.stereoType) ) { // lsb.Append("stereoType=" + leftAttr.stereoType + "\r\n"); // rsb.Append("stereoType=" + rightAttr.stereoType + "\r\n"); // } //// if( leftAtr.pos != rightAtr.pos ) { //// lsb.Append("pos=" + leftAtr.pos + "\n"); //// rsb.Append("pos=" + rightAtr.pos + "\n"); //// } // if( !compareNullable(leftAttr.notes, rightAttr.notes) ) { // lsb.Append("[notes]\r\n" + leftAttr.notes + "\r\n"); // rsb.Append("[notes]\r\n" + rightAttr.notes + "\r\n"); // } return; }
private void outputAttribute(AttributeVO att, int depth, StreamWriter sw) { sw.Write(indent(depth) + "<attribute "); if (att.changed != ' ') { sw.Write(" changed='" + att.changed + "' "); } sw.Write(" guid='" + escapeXML(att.guid) + "' "); sw.Write(" pos='" + att.pos + "' "); // sw.Write( " type='" + escapeXML(m_Att.EA_Type) + "' " ); sw.Write(" name='" + escapeXML(att.name) + "' "); sw.Write(" alias='" + escapeXML(att.alias) + "' "); sw.Write(" position='" + att.pos + "'"); if (att.stereoType != null) { sw.Write(" stereotype='" + att.stereoType + "' "); } sw.WriteLine(" >"); // if (m_Att.Default != null) { // sw.WriteLine( indent(depth) + " <default>" + escapeXML(m_Att.Default) + "</default>" ); // } // sw.WriteLine( indent(depth) + " <visibility>" + m_Att.Visibility + "</visibility>" ); if (att.notes != null) { sw.WriteLine(indent(depth) + " <notes>" + escapeXML(att.notes) + "</notes>"); } sw.WriteLine(indent(depth) + "</attribute>"); }
/// <summary> /// 不一致な属性の抽出 /// </summary> /// <param name="leftAtr"></param> /// <param name="rightAtr"></param> /// <returns></returns> private AttributeVO getDisagreedAttribute(AttributeVO leftAtr, AttributeVO rightAtr) { AttributeVO outAtr; outAtr = leftAtr.Clone(); outAtr.changed = ' '; if (!compareNullable(leftAtr.name, rightAtr.name)) { outAtr.name = leftAtr.name + " → " + rightAtr.name; outAtr.changed = 'U'; } if (!compareNullable(leftAtr.stereoType, rightAtr.stereoType)) { outAtr.stereoType = leftAtr.stereoType + " → " + rightAtr.stereoType; outAtr.changed = 'U'; } if (!compareNullable(leftAtr.alias, rightAtr.alias)) { outAtr.alias = leftAtr.alias + " → " + rightAtr.alias; outAtr.changed = 'U'; } if (!skipAttributePosFlg) { if (leftAtr.pos != rightAtr.pos) { outAtr.pos = rightAtr.pos; outAtr.changed = 'U'; } } if (!skipAttributeNoteFlg) { if (!compareNullable(leftAtr.notes, rightAtr.notes)) { outAtr.notes = leftAtr.notes + "\r\n------ ↓ ↓ ↓ ↓ ------\r\n" + rightAtr.notes; outAtr.changed = 'U'; } } if (outAtr.changed == ' ') { return(null); } else { // 空白以外なら 'U' で何かしら変更があったとみなされるため、左を比較元、右を比較先として情報を残す outAtr.srcAttribute = leftAtr; outAtr.destAttribute = rightAtr; return(outAtr); } }
/// <summary> /// 文書の末尾に属性の情報を出力する. /// </summary> private void outputAttribute(ref Document document, AttributeVO changedAttr) { // パラグラフを追加 document.Content.Paragraphs.Add(); addAttributeText(ref document, WdColorIndex.wdBlack, "□属性: " + changedAttr.name + "[" + changedAttr.alias + "]" + "\r\n"); addAttributeText_detail(ref document, WdColorIndex.wdBlack, "ID: " + changedAttr.guid + "\r\n"); addAttributeText_detail(ref document, WdColorIndex.wdBlack, changedAttr.notes + "\r\n"); }
/// <summary> /// 属性アイコンクリック時のイベントハンドラ /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void AttributeSymbolClick(object sender, EventArgs e) { PictureBox targetIcon = (PictureBox)sender; AttributeVO attrvo = (AttributeVO)targetIcon.Tag; AttributePropertyForm attrPropForm = new AttributePropertyForm(attrvo); attrPropForm.Show(this); }
/// <summary> /// 不一致な属性の抽出 /// </summary> /// <param name="leftAtr"></param> /// <param name="rightAtr"></param> /// <returns></returns> private AttributeVO getDisagreedAttribute(AttributeVO leftAtr, AttributeVO rightAtr) { AttributeVO outAtr; outAtr = leftAtr.Clone(); outAtr.changed = ' '; if (!compareNullable(leftAtr.name, rightAtr.name)) { outAtr.name = leftAtr.name + " → " + rightAtr.name; outAtr.changed = 'U'; } if (!compareNullable(leftAtr.stereoType, rightAtr.stereoType)) { outAtr.stereoType = leftAtr.stereoType + " → " + rightAtr.stereoType; outAtr.changed = 'U'; } if (!compareNullable(leftAtr.alias, rightAtr.alias)) { outAtr.alias = leftAtr.alias + " → " + rightAtr.alias; outAtr.changed = 'U'; } if (!skipAttributePosFlg) { if (leftAtr.pos != rightAtr.pos) { outAtr.pos = rightAtr.pos; outAtr.changed = 'U'; } } if (!skipAttributeNoteFlg) { if (!compareNullable(leftAtr.notes, rightAtr.notes)) { outAtr.notes = leftAtr.notes + "\r\n------ ↓ ↓ ↓ ↓ ------\r\n" + rightAtr.notes; outAtr.changed = 'U'; } } if (outAtr.changed == ' ') { return(null); } else { outputOriginalAttributeFile(leftAtr, "L"); outputOriginalAttributeFile(rightAtr, "R"); return(outAtr); } }
/// <summary> /// 片方の属性のダンプ /// </summary> /// <param name="attr"></param> internal static void getMonoAttributeDesc(AttributeVO attr, ref string text) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(attr.name + "[" + attr.alias + "]" + "\r\n"); sb.Append(attr.guid + "\r\n"); sb.Append(attr.getComparableString()); text = sb.ToString(); return; }
public AttributePropertyForm(AttributeVO attr) { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); // // TODO: Add constructor code after the InitializeComponent() call. // targetAttribute = attr; }
/// <summary> /// 比較して差異があった属性に対して左右それぞれのオリジナル情報を出力し、ピンポイントの比較ができるようにする /// </summary> /// <param name="attr">該当属性</param> /// <param name="leftRight"> "L" もしくは "R" を指定する(出力ファイル名のサフィックスになる)</param> private void outputOriginalAttributeFile(AttributeVO attr, string leftRight) { //BOM無しのUTF8でテキストファイルを作成する StreamWriter attrsw = new StreamWriter(outputDir + "\\detail\\#attribute_" + attr.guid.Substring(1, 36) + "_" + leftRight + ".xml"); attrsw.WriteLine(@"<?xml version=""1.0"" encoding=""utf-8""?> "); attrsw.WriteLine(""); outputAttribute(attr, 0, attrsw); attrsw.Close(); }
/// <summary> /// 引数の属性リストから属性IDでヒットする属性を探し、そのtaggedValuesに取得した属性タグ付き値のリストをセットする /// </summary> /// <param name="attributes">属性リスト</param> /// <param name="targetAttrId">属性ID(t_attributetagから取得)</param> /// <param name="startIdx">開始インデックス</param> /// <param name="atags">属性のタグ付き値リスト</param> /// <returns></returns> private int searchAttributeAndSetTags(List <AttributeVO> attributes, int targetAttrId, int startIdx, List <TaggedValueVO> atags) { for (int i = startIdx; i < attributes.Count; i++) { AttributeVO attr = attributes[i]; if (attr.attributeId == targetAttrId) { attr.taggedValues = atags; return(i); } } return(startIdx); }
private static void outputAttribute(AttributeVO att, int depth, StreamWriter sw) { sw.Write(indent(depth) + "<attribute "); if (att.changed != ' ') { sw.Write("changed=\"" + att.changed + "\" "); } sw.Write("guid=\"" + escapeXML(att.guid) + "\" "); sw.Write("pos=\"" + att.pos + "\" "); sw.Write("type=\"" + escapeXML(att.eaType) + "\" "); sw.Write("name=\"" + escapeXML(att.name) + "\" "); sw.Write("alias=\"" + escapeXML(att.alias) + "\" "); sw.Write("attributeId=\"" + att.attributeId + "\" "); // sw.Write( "position=\"" + att.pos + "\" " ); if (att.stereoType != null) { sw.Write("stereotype=\"" + att.stereoType + "\" "); } sw.Write("length=\"" + att.length + "\" "); sw.Write("allowDuplicates=\"" + att.allowDuplicates + "\" "); sw.Write("classifierID=\"" + escapeXML(att.classifierID) + "\" "); sw.Write("container=\"" + att.container + "\" "); sw.Write("containment=\"" + att.containment + "\" "); sw.Write("isDerived=\"" + att.isDerived + "\" "); sw.Write("isID=\"" + att.isID + "\" "); sw.Write("lowerBound=\"" + att.lowerBound + "\" "); sw.Write("upperBound=\"" + att.upperBound + "\" "); sw.Write("precision=\"" + att.precision + "\" "); sw.Write("scale=\"" + att.scale + "\""); sw.WriteLine(">"); sw.WriteLine(indent(depth) + " <visibility>" + att.visibility + "</visibility>"); if (att.notes != null) { sw.WriteLine(indent(depth) + " <notes>" + escapeXML(att.notes) + "</notes>"); } if (att.defaultValue != null) { sw.WriteLine(indent(depth) + " <default>" + escapeXML(att.defaultValue) + "</default>"); } // 属性のタグ付き値の出力 outputAttributeTags(att, depth + 1, sw); sw.WriteLine(indent(depth) + "</attribute>"); }
void AttributeTextClick(object sender, EventArgs e) { TextBox touchedText = (TextBox)sender; if (selectedTextBox != null && selectedTextBox != touchedText) { selectedTextBox.BackColor = Color.LightYellow; } touchedText.BackColor = Color.LightPink; selectedTextBox = touchedText; selectedAttribute = (AttributeVO)touchedText.Tag; selectedMethod = null; }
/// <summary> /// 片方の属性のダンプ /// </summary> /// <param name="attr"></param> private void getMonoAttributeDesc(AttributeVO attr, ref string text) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(attr.name + "[" + attr.alias + "]" + "\r\n"); sb.Append("stereoType=" + attr.stereoType + "\r\n"); // sb.Append("pos=" + attr.pos + "\n"); if (attr.notes == null || "".Equals(attr.notes)) { sb.Append("[notes]\r\n" + attr.notes + "\r\n"); } text = sb.ToString(); return; }
/// <summary> /// 全属性・操作CSVに属性行を追加 /// </summary> /// <param name="atf">成果物VO</param> /// <param name="elem">要素VO</param> /// <param name="attr">属性VO</param> /// <param name="csvsw">出力ストリーム</param> private void writeCsvFileAttr(PackageVO pak, ElementVO elem, AttributeVO attr, StreamWriter csvsw) { csvsw.Write("" + addQuote(pak.guid)); csvsw.Write("," + addQuote(pak.stereoType)); csvsw.Write("," + addQuote(pak.pathName)); csvsw.Write("," + addQuote(elem.guid)); csvsw.Write("," + addQuote(elem.eaType)); csvsw.Write("," + addQuote(elem.name)); csvsw.Write("," + addQuote(elem.stereoType)); // csvsw.Write("," + elem.tag); csvsw.Write("," + addQuote("a")); csvsw.Write("," + addQuote(attr.guid)); csvsw.Write("," + addQuote(attr.name)); csvsw.Write("," + addQuote(attr.alias)); csvsw.Write("," + addQuote("")); csvsw.Write("\r\n"); }
void MethodTextClick(object sender, EventArgs e) { TextBox touchedText = (TextBox)sender; if (selectedTextBox != null && selectedTextBox != touchedText) { selectedTextBox.BackColor = Color.LightYellow; } touchedText.BackColor = Color.LightPink; selectedTextBox = touchedText; selectedMethod = (MethodVO)touchedText.Tag; // if( selectedMethod != null ) { // MessageBox.Show("操作が選択されました: " + selectedMethod.guid); // } selectedAttribute = null; }
/// <summary> /// 差異が検出された2つの属性の不一致な項目=値をつなげた文字列を作成 /// </summary> /// <param name="leftAttr">(in)左の属性VO</param> /// <param name="rightAttr">(in)右の属性VO</param> /// <param name="leftText">(out)左用の出力テキスト</param> /// <param name="rightText">(out)右用の出力テキスト</param> /// <returns></returns> internal static void getDisagreedAttributeDesc(AttributeVO leftAttr, AttributeVO rightAttr, ref string leftText, ref string rightText) { System.Text.StringBuilder lsb = new System.Text.StringBuilder(); System.Text.StringBuilder rsb = new System.Text.StringBuilder(); lsb.Append(leftAttr.name + "[" + leftAttr.alias + "]" + "\r\n"); rsb.Append(rightAttr.name + "[" + rightAttr.alias + "]" + "\r\n"); lsb.Append(leftAttr.guid + "\r\n"); rsb.Append(rightAttr.guid + "\r\n"); lsb.Append(leftAttr.getComparedString(rightAttr)); rsb.Append(rightAttr.getComparedString(leftAttr)); leftText = lsb.ToString(); rightText = rsb.ToString(); return; }
/// <summary> /// 属性をEAに向けて更新実行する /// </summary> /// <param name="repo"></param> /// <param name="selectedAttribute"></param> void execUpdateAttribute(EA.Repository repo, AttributeVO selectedAttribute) { EA.Attribute attr = (EA.Attribute)repo.GetAttributeByGuid(selectedAttribute.guid); if (attr == null) { EA.Element elem = (EA.Element)repo.GetElementByGuid(myElement.guid); if (elem == null) { return; } attr = (EA.Attribute)elem.Attributes.AddNew(selectedAttribute.name, "String"); } attr.AttributeGUID = selectedAttribute.guid; attr.Alias = selectedAttribute.alias; attr.StereotypeEx = selectedAttribute.stereoType; attr.Notes = selectedAttribute.notes; attr.Update(); }
/// <summary> /// 選択された属性に対する更新処理 /// </summary> /// <param name="repo"></param> /// <param name="selectedAttribute"></param> private void confirmUpdateAttribute(EA.Repository repo, AttributeVO selectedAttribute) { if (selectedAttribute != null) { // メッセージボックスを表示する DialogResult result = MessageBox.Show("EAのリポジトリの属性を上書き、もしくは追加します。よろしいですか?", "質問", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); // 確認ダイアログでYesが選択された場合 if (result == DialogResult.Yes) { execUpdateAttribute(repo, selectedAttribute); } else { return; } } }
public static AttributeVO getAttributeFromEAObject(EA.Attribute eaAttributeObj) { AttributeVO attvo = new AttributeVO(); attvo.name = excludeSpecialChar(eaAttributeObj.Name); attvo.alias = excludeSpecialChar(eaAttributeObj.Alias); if (eaAttributeObj.StereotypeEx != null && !"".Equals(eaAttributeObj.StereotypeEx)) { attvo.stereoType = excludeSpecialChar(eaAttributeObj.StereotypeEx); } else { attvo.stereoType = null; } attvo.eaType = eaAttributeObj.Type; attvo.notes = eaAttributeObj.Notes; attvo.guid = eaAttributeObj.AttributeGUID; attvo.pos = eaAttributeObj.Pos; attvo.allowDuplicates = eaAttributeObj.AllowDuplicates; attvo.length = convStringToInt(eaAttributeObj.Length); attvo.classifierID = eaAttributeObj.ClassifierID.ToString(); attvo.container = eaAttributeObj.Container; attvo.containment = eaAttributeObj.Containment; attvo.isDerived = eaAttributeObj.IsDerived; attvo.isID = eaAttributeObj.IsID; attvo.lowerBound = convStringToInt(eaAttributeObj.LowerBound); attvo.upperBound = convStringToInt(eaAttributeObj.UpperBound); attvo.precision = convStringToInt(eaAttributeObj.Precision); attvo.scale = convStringToInt(eaAttributeObj.Scale); attvo.visibility = excludeSpecialChar(eaAttributeObj.Visibility); List <TaggedValueVO> outTagList = new List <TaggedValueVO>(); foreach (EA.AttributeTag atag in eaAttributeObj.TaggedValuesEx) { outTagList.Add(getAttributeTagFromEAObject(atag)); } attvo.taggedValues = outTagList; return(attvo); }
/// <summary> /// コンテキストメニュー:EAで選択のクリックイベント /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void EASelectObjectToolStripMenuItemClick(object sender, EventArgs e) { EA.Repository repo = ProjectSetting.getVO().eaRepo; if (repo != null) { // メニューを開くために右クリックされたコントロールを取得 Control source = contextMenuStrip1.SourceControl; if (source != null) { if (source.Tag is AttributeVO) { AttributeVO att = (AttributeVO)source.Tag; // EAでGUIDをキーとして対象属性の取得を試み、取れたらプロジェクトブラウザーで選択する EA.Attribute attrObj = (EA.Attribute)repo.GetAttributeByGuid(att.guid); if (attrObj != null) { repo.ShowInProjectView(attrObj); } } else if (source.Tag is MethodVO) { MethodVO mth = (MethodVO)source.Tag; // EAでGUIDをキーとして対象操作の取得を試み、取れたらプロジェクトブラウザーで選択する EA.Method mthObj = (EA.Method)repo.GetMethodByGuid(mth.guid); if (mthObj != null) { repo.ShowInProjectView(mthObj); } } } } else { MessageBox.Show("EAにアタッチしていないため、選択できません"); } }
/// <summary> /// 比較して差異があった属性に対して左右それぞれのオリジナル情報を出力し、ピンポイントの比較ができるようにする /// </summary> /// <param name="attr">該当属性</param> /// <param name="leftRight"> "L" もしくは "R" を指定する(出力ファイル名のサフィックスになる)</param> private void outputOriginalAttributeFile(AttributeVO attr, string leftRight) { XmlDocument xmlDocument = new XmlDocument(); // ' XML宣言部分生成 // Set head = xmlDocument.createProcessingInstruction("xml", "version='1.0'") XmlProcessingInstruction head = xmlDocument.CreateProcessingInstruction("xml", "version='1.0'"); //' XML宣言部分設定 xmlDocument.AppendChild(head); string xmlDir = null; if ("L".Equals(leftRight)) { xmlDir = this.fromArtifactDir; } else { xmlDir = this.toArtifactDir; } ArtifactXmlReader atfReader = new ArtifactXmlReader(xmlDir); // 現在処理中の成果物のGUID、および属性のGUIDから(左もしくは右の)XMLノードを取得 XmlNode attrNode = atfReader.readAttributeNode(procArtifact.guid, attr.guid); // 成果物のGUID,属性のGUIDから取得した属性NodeがNullなら出力をスキップする if (attrNode != null) { // 新しいrootノードを、成果物XMLからインポートする形で作成 XmlNode root = xmlDocument.ImportNode(attrNode, true); // ルート配下に引数のドキュメントを追加 xmlDocument.AppendChild(root); // この内容で操作の詳細に記録する xmlDocument.Save(outputDir + "\\detail\\#attribute_" + attr.guid.Substring(1, 36) + "_" + leftRight + ".xml"); } }
/// <summary> /// t_attr_meth テーブルに属性行の追加 /// </summary> /// <param name="atf"></param> /// <param name="elem"></param> private void insertAttrTable(ArtifactVO atf, ElementVO elem, AttributeVO attr) { // AttrbuteId が既に出力済みMapに存在しているかをチェックし、存在していたらINSERTせずリターン if (outputAttributeMap.ContainsKey(attr.attributeId)) { return; } string sql = @"insert into t_attr_mth ( attrMthId, elemId, elemGuid, attrMthFlg, attrMthType, attrMthGuid, attrMthName, attrMthAlias, attrMthNotes ) values ( @attrMthId, @elemId, @elemGuid, @attrMthFlg, @attrMthType, @attrMthGuid, @attrMthName, @attrMthAlias, @attrMthNotes ) " ; using (SQLiteCommand command2 = conn.CreateCommand()) { SQLiteParameter[] parameters = new SQLiteParameter[] { new SQLiteParameter("@attrMthId", (attr.attributeId) * -1) , new SQLiteParameter("@elemId", elem.elementId) , new SQLiteParameter("@elemGuid", elem.guid) , new SQLiteParameter("@attrMthFlg", "a") , new SQLiteParameter("@attrMthType", attr.eaType) , new SQLiteParameter("@attrMthGuid", attr.guid) , new SQLiteParameter("@attrMthName", attr.name) , new SQLiteParameter("@attrMthAlias", attr.alias) , new SQLiteParameter("@attrMthNotes", attr.notes) }; command2.CommandText = sql; command2.Parameters.AddRange(parameters); command2.ExecuteNonQuery(); } outputAttributeMap.Add(attr.attributeId, attr); }
/// <summary> /// マージ時に使用:GUIDによる属性の比較 /// </summary> /// <param name="leftAtr">左の属性</param> /// <param name="rightAtr">右の属性</param> /// <returns>string#CompareTo()の戻り値と同じ(L=Rなら0, L>Rなら1, L<Rなら-1)</returns> private static int compareAttributeGuid(AttributeVO leftAtr, AttributeVO rightAtr) { return(leftAtr.guid.CompareTo(rightAtr.guid)); }
/// <summary> /// (deprecated) /// </summary> /// <param name="elemvo"></param> /// <param name="parentNode"></param> private void readElementContents__(ElementVO elemvo, XmlNode parentNode) { List <AttributeVO> retAttrList = new List <AttributeVO>(); List <MethodVO> retMethList = new List <MethodVO>(); IList <ConnectorVO> retConnList = new List <ConnectorVO>(); foreach (XmlNode elemNode in parentNode.ChildNodes) { if ("attribute".Equals(elemNode.Name)) { AttributeVO attvo = new AttributeVO(); foreach (XmlAttribute attr in elemNode.Attributes) { switch (attr.Name) { case "name": attvo.name = attr.Value; break; case "alias": attvo.alias = attr.Value; break; // case "stereotype" : attvo.stereoType = attr.Value; break; case "guid": attvo.guid = attr.Value; break; // case "pos" : attvo.pos = attr.Value; break; } } retAttrList.Add(attvo); } if ("method".Equals(elemNode.Name)) { MethodVO mthvo = new MethodVO(); foreach (XmlAttribute attr in elemNode.Attributes) { switch (attr.Name) { case "name": mthvo.name = attr.Value; break; case "alias": mthvo.alias = attr.Value; break; // case "stereotype" : mthvo.stereoType = attr.Value; break; case "guid": mthvo.guid = attr.Value; break; // case "pos" : mthvo.pos = attr.Value; break; } } if (elemNode.SelectSingleNode("behavior") != null) { mthvo.behavior = elemNode.SelectSingleNode("behavior").InnerText; } if (elemNode.SelectSingleNode("notes") != null) { mthvo.notes = elemNode.SelectSingleNode("notes").InnerText; } // mthvo.returnType = elemNode.elemNode.SelectSingleNode("returnType").InnerText; // mthvo.visibility = elemNode.elemNode.SelectSingleNode("visibility").InnerText; retMethList.Add(mthvo); } } elemvo.attributes = retAttrList; elemvo.sortAttributes(); elemvo.methods = retMethList; elemvo.sortMethods(); // elemvo.connectors = connSearcher.findByObjectGuid(elemvo.guid); }