• R/O
  • SSH
  • HTTPS

ea-addin-dsm: Commit


Commit MetaInfo

Revision48 (tree)
Time2010-07-15 21:39:14
Authorm-usami

Log Message

バックグラウンド処理のバグを修正
partitioning処理のバッググラウンド処理化
(作業中。プログレスダイアログ表示が未作業)

Change Summary

Incremental Difference

--- dsm/branches/version-0.5.1.0/EAAddinDSM/DSMDialog.cs (revision 47)
+++ dsm/branches/version-0.5.1.0/EAAddinDSM/DSMDialog.cs (revision 48)
@@ -68,18 +68,11 @@
6868 dsm_ = new DSMModel(repository, diagram, type);
6969 if (dsm_.attach(this))
7070 {
71- //controller_ = new DSMController(ref dsm_);
72- //if (controller_.initialize())
73- //{
74- // setDialogFormat();
75- // update();
76- // return true;
77- //}
7871 controller_ = new DSMController(ref dsm_);
7972 setDialogFormat();
80- ProgressDialog prog = new ProgressDialog(controller_, dsm_);
81- prog.Show();
73+ ProgressDialog prog = new ProgressDialog(ref controller_, ref dsm_);
8274 prog.initialize();
75+ prog.ShowDialog();
8376 update();
8477 return true;
8578 }
@@ -105,18 +98,11 @@
10598 dsm_ = new DSMModel(repository, package, type);
10699 if (dsm_.attach(this))
107100 {
108- //controller_ = new DSMController(ref dsm_);
109- //if (controller_.initialize())
110- //{
111- // setDialogFormat();
112- // update();
113- // return true;
114- //}
115101 controller_ = new DSMController(ref dsm_);
116102 setDialogFormat();
117- ProgressDialog prog = new ProgressDialog(controller_, dsm_);
118- prog.Show();
103+ ProgressDialog prog = new ProgressDialog(ref controller_, ref dsm_);
119104 prog.initialize();
105+ prog.ShowDialog();
120106 update();
121107 return true;
122108 }
@@ -229,7 +215,11 @@
229215 /// <param name="e"></param>
230216 private void menuItemPartitioning__Click(object sender, EventArgs e)
231217 {
232- controller_.partitioning();
218+ ProgressDialog prog = new ProgressDialog(ref controller_, ref dsm_);
219+ prog.partitioning();
220+ prog.ShowDialog();
221+ update();
222+ //controller_.partitioning();
233223 }
234224
235225 /// <summary>
--- dsm/branches/version-0.5.1.0/EAAddinDSM/ProgressDialog.Designer.cs (revision 47)
+++ dsm/branches/version-0.5.1.0/EAAddinDSM/ProgressDialog.Designer.cs (revision 48)
@@ -111,7 +111,8 @@
111111 //
112112 this.bgWorker_.WorkerReportsProgress = true;
113113 this.bgWorker_.WorkerSupportsCancellation = true;
114- this.bgWorker_.DoWork += new System.ComponentModel.DoWorkEventHandler(this.bgWorker__DoWork);
114+ //this.bgWorker_.DoWork += new System.ComponentModel.DoWorkEventHandler(this.bgWorker__DoWork);
115+ //this.bgWorker_.DoWork += new System.ComponentModel.DoWorkEventHandler(this.bgWorker__DoWork2);
115116 this.bgWorker_.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.bgWorker__RunWorkerCompleted);
116117 this.bgWorker_.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.bgWorker__ProgressChanged);
117118 //
--- dsm/branches/version-0.5.1.0/EAAddinDSM/DSMModel.cs (revision 47)
+++ dsm/branches/version-0.5.1.0/EAAddinDSM/DSMModel.cs (revision 48)
@@ -104,15 +104,15 @@
104104 }
105105 }
106106
107- public void initialize(BackgroundWorker bg)
107+ public void initialize(ref BackgroundWorker bg)
108108 {
109109 if (dsmType_ == DSM_TYPE_DIAGRAM)
110110 {
111- initializeDiagramDSM(bg);
111+ initializeDiagramDSM(ref bg);
112112 }
113113 else
114114 {
115- initializePackageDSM(bg);
115+ initializePackageDSM(ref bg);
116116 }
117117 }
118118
@@ -388,8 +388,7 @@
388388 return false;
389389 }
390390
391- //private bool initializeDiagramDSM()
392- private void initializeDiagramDSM(BackgroundWorker bg)
391+ private void initializeDiagramDSM(ref BackgroundWorker bg)
393392 {
394393 if (diagram_ == null)
395394 {
@@ -415,19 +414,16 @@
415414 elementList_.Add(source.ElementID);
416415 dsmHash[source.ElementID] = getDependencyList(source);
417416 }
418- bg.ReportProgress((int)((++count) / diagram_.DiagramObjects.Count * 100));
417+ bg.ReportProgress((int)(++count * 100 / diagram_.DiagramObjects.Count));
419418 }
420419 dsm_ = makeDSMArray(dsmHash);
421420 update();
422- //return true;
423421 }
424422
425- //private bool initializePackageDSM()
426- private void initializePackageDSM(BackgroundWorker bg)
423+ private void initializePackageDSM(ref BackgroundWorker bg)
427424 {
428425 if (package_ == null)
429426 {
430- //return false;
431427 return;
432428 }
433429
@@ -441,15 +437,15 @@
441437 }
442438 Hashtable dsmHash = new Hashtable();
443439 int count = 0;
444- foreach (EA.Element source in getAllPackageElements(package_))
440+ ArrayList packageList = getAllPackageElements(package_);
441+ foreach (EA.Element source in packageList)
445442 {
446443 elementList_.Add(source.ElementID);
447444 dsmHash[source.ElementID] = getDependencyList(source);
448- bg.ReportProgress((int)((++count) / diagram_.DiagramObjects.Count * 100));
445+ bg.ReportProgress((int)(++count * 100 / packageList.Count));
449446 }
450447 dsm_ = makeDSMArray(dsmHash);
451448 update();
452- //return true;
453449 }
454450 }
455451 }
--- dsm/branches/version-0.5.1.0/EAAddinDSM/ProgressDialog.cs (revision 47)
+++ dsm/branches/version-0.5.1.0/EAAddinDSM/ProgressDialog.cs (revision 48)
@@ -39,7 +39,7 @@
3939 private DSMController controller_;
4040 private DSMModel model_;
4141
42- public ProgressDialog(DSMController controller, DSMModel model)
42+ public ProgressDialog(ref DSMController controller, ref DSMModel model)
4343 {
4444 InitializeComponent();
4545
@@ -54,18 +54,31 @@
5454
5555 public void initialize()
5656 {
57+ this.bgWorker_.DoWork += new System.ComponentModel.DoWorkEventHandler(this.bgWorker__DoWork);
5758 bgWorker_.RunWorkerAsync();
5859 }
5960
61+ public void partitioning()
62+ {
63+ this.bgWorker_.DoWork += new System.ComponentModel.DoWorkEventHandler(this.bgWorker__DoWork2);
64+ bgWorker_.RunWorkerAsync();
65+ }
66+
6067 private void bgWorker__DoWork(object sender, DoWorkEventArgs e)
6168 {
6269 BackgroundWorker bg = (BackgroundWorker)sender;
6370 if (controller_.initialize())
6471 {
65- model_.initialize(bg);
72+ model_.initialize(ref bg);
6673 }
6774 }
6875
76+ private void bgWorker__DoWork2(object sender, DoWorkEventArgs e)
77+ {
78+ BackgroundWorker bg = (BackgroundWorker)sender;
79+ controller_.partitioning();
80+ }
81+
6982 private void bgWorker__ProgressChanged(object sender, ProgressChangedEventArgs e)
7083 {
7184 pBar_.Value = e.ProgressPercentage;
Show on old repository browser