Subversion Repositories DevTools

Rev

Rev 2122 | Rev 2132 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2122 Rev 2124
Line 22... Line 22...
22
         public ArrayList elementTypes;
22
         public ArrayList elementTypes;
23
 
23
 
24
         public bool packageRecursion;
24
         public bool packageRecursion;
25
         public bool packageTrimming;
25
         public bool packageTrimming;
26
         public bool elementNotes;
26
         public bool elementNotes;
-
 
27
         public bool reqTagSort;
27
      };
28
      };
28
 
29
 
29
      public struct RM_TableType
30
      public struct RM_TableType
30
      {
31
      {
31
         public string introText;
32
         public string introText;
Line 79... Line 80...
79
         RM_Matrix.from.elementTypes.Clear();
80
         RM_Matrix.from.elementTypes.Clear();
80
         RM_Matrix.from.packageRecursion = true;
81
         RM_Matrix.from.packageRecursion = true;
81
         RM_Matrix.from.packageTrimming = false;
82
         RM_Matrix.from.packageTrimming = false;
82
         RM_Matrix.from.elementNotes = false;
83
         RM_Matrix.from.elementNotes = false;
83
         RM_Matrix.from.packageName = null;
84
         RM_Matrix.from.packageName = null;
-
 
85
         RM_Matrix.from.reqTagSort = true;
84
 
86
 
85
         fromPackage = null;
87
         fromPackage = null;
86
        
88
        
87
         RM_Matrix.toFromTable.introText = null;
89
         RM_Matrix.toFromTable.introText = null;
88
         RM_Matrix.toFromTable.title = null;
90
         RM_Matrix.toFromTable.title = null;
Line 92... Line 94...
92
         RM_Matrix.to.elementTypes.Clear();
94
         RM_Matrix.to.elementTypes.Clear();
93
         RM_Matrix.to.packageRecursion = true;
95
         RM_Matrix.to.packageRecursion = true;
94
         RM_Matrix.to.packageTrimming = false;
96
         RM_Matrix.to.packageTrimming = false;
95
         RM_Matrix.to.elementNotes = false;
97
         RM_Matrix.to.elementNotes = false;
96
         RM_Matrix.to.packageName = null;
98
         RM_Matrix.to.packageName = null;
-
 
99
         RM_Matrix.to.reqTagSort = true;
97
 
100
 
98
         toPackage = null;
101
         toPackage = null;
99
      }
102
      }
100
 
103
 
101
 
104
 
Line 165... Line 168...
165
                  if (et != null) 
168
                  if (et != null) 
166
                  {
169
                  {
167
                     RM_Matrix.from.elementTypes.Add( et );
170
                     RM_Matrix.from.elementTypes.Add( et );
168
                  }
171
                  }
169
               }
172
               }
-
 
173
               else if (s.StartsWith("fromUsesTagSort="))
-
 
174
               {
-
 
175
                  RM_Matrix.from.reqTagSort = EA_DocGenOptions.getOptionValue(s, RM_Matrix.from.reqTagSort);
-
 
176
               }
170
 
177
 
171
                  // TO items
178
                  // TO items
172
               else if (s.StartsWith("toIntroText="))
179
               else if (s.StartsWith("toIntroText="))
173
               {
180
               {
174
                  RM_Matrix.toFromTable.introText = EA_DocGenOptions.getOptionValue(s, null);
181
                  RM_Matrix.toFromTable.introText = EA_DocGenOptions.getOptionValue(s, null);
Line 207... Line 214...
207
                  if (et != null) 
214
                  if (et != null) 
208
                  {
215
                  {
209
                     RM_Matrix.to.elementTypes.Add( et );
216
                     RM_Matrix.to.elementTypes.Add( et );
210
                  }
217
                  }
211
               }
218
               }
-
 
219
               else if (s.StartsWith("toUsesTagSort="))
-
 
220
               {
-
 
221
                  RM_Matrix.to.reqTagSort = EA_DocGenOptions.getOptionValue(s, RM_Matrix.to.reqTagSort);
-
 
222
               }
212
            }
223
            }
213
         }
224
         }
214
 
225
 
215
         // Verify that we have all the necessary compulsory options
226
         // Verify that we have all the necessary compulsory options
216
         if (RM_Matrix.fromToTable.title == null && RM_Matrix.toFromTable.title == null)
227
         if (RM_Matrix.fromToTable.title == null && RM_Matrix.toFromTable.title == null)
Line 294... Line 305...
294
               + "fromPackage=\r\n"
305
               + "fromPackage=\r\n"
295
               + "fromElementType=\r\n"
306
               + "fromElementType=\r\n"
296
               + "fromElementType=\r\n"
307
               + "fromElementType=\r\n"
297
               + "fromPackageRecursion=true\r\n"
308
               + "fromPackageRecursion=true\r\n"
298
               + "fromPackageTrimming=false\r\n"
309
               + "fromPackageTrimming=false\r\n"
299
               + "fromElementNotes=false\r\n"   
310
               + "fromElementNotes=false\r\n"
-
 
311
               + "fromUsesTagSort=true\r\n"
300
 
312
 
301
               + "toFromTableTitle=\r\n"
313
               + "toFromTableTitle=\r\n"
302
               + "toIntroText=\r\n"
314
               + "toIntroText=\r\n"
303
               + "toColumnTitle=\r\n"
315
               + "toColumnTitle=\r\n"
304
               + "toPackage=\r\n"
316
               + "toPackage=\r\n"
305
               + "toElementType=\r\n"
317
               + "toElementType=\r\n"
306
               + "toPackageRecursion=true\r\n"
318
               + "toPackageRecursion=true\r\n"
307
               + "toPackageTrimming=false\r\n"
319
               + "toPackageTrimming=false\r\n"
308
               + "toElementNotes=false\r\n";
320
               + "toElementNotes=false\r\n"
-
 
321
               + "toUsesTagSort=true\r\n";
309
            case 2:
322
            case 2:
310
               return
323
               return
311
               "style=2\r\n"
324
               "style=2\r\n"
312
               + "fromToTableTitle=Requirement Dependencies\r\n"
325
               + "fromToTableTitle=Requirement Dependencies\r\n"
313
               + "fromIntroText=The following table identifies the source requirements (if any) for each requirement stated in this document.\r\n"
326
               + "fromIntroText=The following table identifies the source requirements (if any) for each requirement stated in this document.\r\n"
Line 315... Line 328...
315
               + "fromPackage=\r\n"
328
               + "fromPackage=\r\n"
316
               + "fromElementType=Requirement\r\n"
329
               + "fromElementType=Requirement\r\n"
317
               + "fromPackageRecursion=true\r\n"
330
               + "fromPackageRecursion=true\r\n"
318
               + "fromPackageTrimming=false\r\n"
331
               + "fromPackageTrimming=false\r\n"
319
               + "fromElementNotes=false\r\n"
332
               + "fromElementNotes=false\r\n"
-
 
333
               + "fromUsesTagSort=true\r\n"
320
 
334
 
321
               + "toPackageRecursion=true\r\n"
335
               + "toPackageRecursion=true\r\n"
322
               + "toPackage=\r\n"
336
               + "toPackage=\r\n"
323
               + "toColumnTitle=Source Requirements\r\n"
337
               + "toColumnTitle=Source Requirements\r\n"
324
               + "toElementType=Requirement\r\n";
338
               + "toElementType=Requirement\r\n";
Line 394... Line 408...
394
      {
408
      {
395
         int tableNum = 0;
409
         int tableNum = 0;
396
         Word.Table table = null;
410
         Word.Table table = null;
397
 
411
 
398
         // Scan the fromPackage to find all the "from elements".
412
         // Scan the fromPackage to find all the "from elements".
-
 
413
         Main.WriteOutput("   Finding elements in fromPackage", -1);
399
         ElementAccumulator fromLister = new ElementAccumulator(RM_Matrix.from.elementTypes);
414
         ElementAccumulator fromLister = new ElementAccumulator(RM_Matrix.from.elementTypes);
400
         EA_Utilities.findAndProcessPackageElements( fromPackage, fromLister, RM_Matrix.from.packageRecursion );
415
         EA_Utilities.findAndProcessPackageElements( fromPackage, fromLister, RM_Matrix.from.packageRecursion );
401
 
416
 
402
         if (createWordDoc.abortCreationThread)
417
         if (createWordDoc.abortCreationThread)
403
            return;
418
            return;
404
 
419
 
405
         // Scan the toPackage to find all the "to elements".
420
         // Scan the toPackage to find all the "to elements".
-
 
421
         Main.WriteOutput("   Finding elements in toPackage", -1);
406
         ElementAccumulator toLister = new ElementAccumulator(RM_Matrix.to.elementTypes);
422
         ElementAccumulator toLister = new ElementAccumulator(RM_Matrix.to.elementTypes);
407
         EA_Utilities.findAndProcessPackageElements( toPackage, toLister, RM_Matrix.to.packageRecursion );
423
         EA_Utilities.findAndProcessPackageElements( toPackage, toLister, RM_Matrix.to.packageRecursion );
408
 
424
 
409
         if (createWordDoc.abortCreationThread)
425
         if (createWordDoc.abortCreationThread)
410
            return;
426
            return;
411
 
427
 
412
         // Sort the "from elements"
428
         // Sort the "from elements"
-
 
429
         Main.WriteOutput("   Sorting elements in fromPackage", -1);
-
 
430
         if (RM_Matrix.from.reqTagSort)
-
 
431
         {
-
 
432
            elementSortByTAG sorter = new elementSortByTAG();
-
 
433
            fromLister.Elements.Sort( sorter );
-
 
434
         }
-
 
435
         else
-
 
436
         {
413
         elementSortByName sorter = new elementSortByName();
437
            elementSortByName sorter = new elementSortByName();
414
         fromLister.Elements.Sort( sorter );
438
            fromLister.Elements.Sort( sorter );
-
 
439
         }
415
 
440
 
416
         // Sort the "to" elements
441
         // Sort the "to" elements
-
 
442
         Main.WriteOutput("   Sorting elements in toPackage", -1);
-
 
443
         if (RM_Matrix.to.reqTagSort)
-
 
444
         {
-
 
445
            elementSortByTAG sorter = new elementSortByTAG();
417
         toLister.Elements.Sort( sorter );
446
            toLister.Elements.Sort( sorter );
-
 
447
         }
-
 
448
         else
-
 
449
         {
-
 
450
            elementSortByName sorter = new elementSortByName();
-
 
451
            toLister.Elements.Sort( sorter );
-
 
452
         }
418
 
453
 
419
         if (createWordDoc.abortCreationThread)
454
         if (createWordDoc.abortCreationThread)
420
            return;
455
            return;
421
 
456
 
422
         // dictionary to support from-to table construction.
457
         // dictionary to support from-to table construction.
Line 434... Line 469...
434
            needToFromTable = true;
469
            needToFromTable = true;
435
 
470
 
436
         // NOTE: this code has to execute even if no from-to table is needed, in order to support the
471
         // NOTE: this code has to execute even if no from-to table is needed, in order to support the
437
         // generation of a to-from table, assuming the user has requested one.
472
         // generation of a to-from table, assuming the user has requested one.
438
         int numberOfFromToRows = 0;
473
         int numberOfFromToRows = 0;
-
 
474
 
-
 
475
         Main.WriteOutput("   Creating from-to Dictionary", -1);
439
         
476
         
440
         foreach(EA.Element fromElement in fromLister.Elements)
477
         foreach(EA.Element fromElement in fromLister.Elements)
441
         {
478
         {
442
            if (createWordDoc.abortCreationThread)
479
            if (createWordDoc.abortCreationThread)
443
               return;
480
               return;
Line 507... Line 544...
507
 
544
 
508
         if (needFromToTable)
545
         if (needFromToTable)
509
         {
546
         {
510
            // Now we can actually serialise the table
547
            // Now we can actually serialise the table
511
 
548
 
-
 
549
            Main.WriteOutput("   Creating from-to table", -1);
-
 
550
 
512
            if (RM_Matrix.fromToTable.introText != null && RM_Matrix.fromToTable.introText.Length > 0)
551
            if (RM_Matrix.fromToTable.introText != null && RM_Matrix.fromToTable.introText.Length > 0)
513
            {
552
            {
514
               Word.Range wr = TextualContent.appendAndSelectText( RM_Matrix.fromToTable.introText, EA_Constants.styleName_Body1 );
553
               Word.Range wr = TextualContent.appendAndSelectText( RM_Matrix.fromToTable.introText, EA_Constants.styleName_Body1 );
515
               object obj = string.Format("EA_DocGen Informational Comment - This table has been produced using the following options:\n\n{0}", RM_Element.Notes);
554
               object obj = string.Format("EA_DocGen Informational Comment - This table has been produced using the following options:\n\n{0}", RM_Element.Notes);
516
               createWordDoc.WordDocument.Comments.Add(wr, ref obj);
555
               createWordDoc.WordDocument.Comments.Add(wr, ref obj);
Line 530... Line 569...
530
            return;
569
            return;
531
 
570
 
532
         // Does user want a to-from table ?
571
         // Does user want a to-from table ?
533
         if (needToFromTable)
572
         if (needToFromTable)
534
         {
573
         {
-
 
574
            Main.WriteOutput("   Creating to-from Dictionary", -1);
-
 
575
 
535
            // update fromElementNotes with toElementNotes setting
576
            // update fromElementNotes with toElementNotes setting
536
            RM_Matrix.from.elementNotes = RM_Matrix.to.elementNotes;
577
            RM_Matrix.from.elementNotes = RM_Matrix.to.elementNotes;
537
 
578
 
538
            // re-use the fromToDictionary to prepare the to-from table content 
579
            // re-use the fromToDictionary to prepare the to-from table content 
539
            fromToDictionary.Clear();
580
            fromToDictionary.Clear();
Line 589... Line 630...
589
 
630
 
590
            if (createWordDoc.abortCreationThread)
631
            if (createWordDoc.abortCreationThread)
591
               return;
632
               return;
592
 
633
 
593
            // Now begin to add the to-from table to the word document
634
            // Now begin to add the to-from table to the word document
-
 
635
            Main.WriteOutput("   Creating to-from table", -1);
-
 
636
 
594
            if (RM_Matrix.toFromTable.introText != null && RM_Matrix.toFromTable.introText.Length > 0)
637
            if (RM_Matrix.toFromTable.introText != null && RM_Matrix.toFromTable.introText.Length > 0)
595
            {
638
            {
596
               Word.Range wr = TextualContent.appendAndSelectText( RM_Matrix.toFromTable.introText, EA_Constants.styleName_Body1 );
639
               Word.Range wr = TextualContent.appendAndSelectText( RM_Matrix.toFromTable.introText, EA_Constants.styleName_Body1 );
597
 
640
 
598
               // add options comment only if user did not generate a from-to table, since there is no point in repeating
641
               // add options comment only if user did not generate a from-to table, since there is no point in repeating
Line 701... Line 744...
701
         int i;
744
         int i;
702
         int tableNum = 0;
745
         int tableNum = 0;
703
         Word.Table table = null;
746
         Word.Table table = null;
704
 
747
 
705
         // Scan the fromPackage to find all the "from elements".
748
         // Scan the fromPackage to find all the "from elements".
-
 
749
         Main.WriteOutput("   Finding elements in fromPackage", -1);
-
 
750
 
706
         ElementAccumulator fromLister = new ElementAccumulator(RM_Matrix.from.elementTypes);
751
         ElementAccumulator fromLister = new ElementAccumulator(RM_Matrix.from.elementTypes);
707
         EA_Utilities.findAndProcessPackageElements( fromPackage, fromLister, RM_Matrix.from.packageRecursion );
752
         EA_Utilities.findAndProcessPackageElements( fromPackage, fromLister, RM_Matrix.from.packageRecursion );
708
 
753
 
709
         if (createWordDoc.abortCreationThread)
754
         if (createWordDoc.abortCreationThread)
710
            return;
755
            return;
Line 726... Line 771...
726
 
771
 
727
         if (createWordDoc.abortCreationThread)
772
         if (createWordDoc.abortCreationThread)
728
            return;
773
            return;
729
 
774
 
730
         // Sort the remaining "from elements"
775
         // Sort the remaining "from elements"
-
 
776
         Main.WriteOutput("   Sorting elements in fromPackage", -1);
-
 
777
 
-
 
778
         if (RM_Matrix.from.reqTagSort)
-
 
779
         {
-
 
780
            elementSortByTAG sorter = new elementSortByTAG();
-
 
781
            fromLister.Elements.Sort( sorter );
-
 
782
         }
-
 
783
         else
-
 
784
         {
731
         elementSortByName sorter = new elementSortByName();
785
            elementSortByName sorter = new elementSortByName();
732
         fromLister.Elements.Sort( sorter );
786
            fromLister.Elements.Sort( sorter );
-
 
787
         }
733
 
788
 
734
         if (createWordDoc.abortCreationThread)
789
         if (createWordDoc.abortCreationThread)
735
            return;
790
            return;
736
 
791
 
737
         // Scan the toPackage to find all the "to elements".
792
         // Scan the toPackage to find all the "to elements".
738
         // Extract their element IDs into a new list.
793
         // Extract their element IDs into a new list.
-
 
794
         Main.WriteOutput("   Finding elements in toPackage", -1);
-
 
795
 
739
         ElementAccumulator toLister = new ElementAccumulator(RM_Matrix.to.elementTypes);
796
         ElementAccumulator toLister = new ElementAccumulator(RM_Matrix.to.elementTypes);
740
         EA_Utilities.findAndProcessPackageElements( toPackage, toLister, RM_Matrix.to.packageRecursion );
797
         EA_Utilities.findAndProcessPackageElements( toPackage, toLister, RM_Matrix.to.packageRecursion );
741
         ArrayList acceptableParents = new ArrayList();
798
         ArrayList acceptableParents = new ArrayList();
742
         foreach(EA.Element ele in toLister.Elements)
799
         foreach(EA.Element ele in toLister.Elements)
743
         {
800
         {
Line 751... Line 808...
751
            return;
808
            return;
752
 
809
 
753
         // The list of from elements dictates the number of rows in our table.
810
         // The list of from elements dictates the number of rows in our table.
754
         int numberOfFromToRows = fromLister.Elements.Count;
811
         int numberOfFromToRows = fromLister.Elements.Count;
755
         
812
         
-
 
813
         Main.WriteOutput("   Creating from-to table", -1);
-
 
814
 
756
         if (RM_Matrix.fromToTable.introText != null && RM_Matrix.fromToTable.introText.Length > 0)
815
         if (RM_Matrix.fromToTable.introText != null && RM_Matrix.fromToTable.introText.Length > 0)
757
         {
816
         {
758
            Word.Range wr = TextualContent.appendAndSelectText( RM_Matrix.fromToTable.introText, EA_Constants.styleName_Body1 );
817
            Word.Range wr = TextualContent.appendAndSelectText( RM_Matrix.fromToTable.introText, EA_Constants.styleName_Body1 );
759
            object obj = string.Format("EA_DocGen Informational Comment - This table has been produced using the following options:\n\n{0}", RM_Element.Notes);
818
            object obj = string.Format("EA_DocGen Informational Comment - This table has been produced using the following options:\n\n{0}", RM_Element.Notes);
760
            createWordDoc.WordDocument.Comments.Add(wr, ref obj);
819
            createWordDoc.WordDocument.Comments.Add(wr, ref obj);