Subversion Repositories DevTools

Rev

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

Rev 2088 Rev 2094
Line 23... Line 23...
23
      public virtual void processPackage( EA.Package thePackage )
23
      public virtual void processPackage( EA.Package thePackage )
24
      {
24
      {
25
      }
25
      }
26
   }
26
   }
27
 
27
 
-
 
28
   
-
 
29
 
28
	/// <summary>
30
	/// <summary>
29
	/// Class containing functions that implement the EA_DocGen menu items.
31
	/// Class containing functions that implement the EA_DocGen menu items.
30
	/// </summary>
32
	/// </summary>
31
	public class EA_Utilities
33
	public class EA_Utilities
32
	{
34
	{
Line 48... Line 50...
48
         guid_clipboard = new GUID_Clipboard(this);
50
         guid_clipboard = new GUID_Clipboard(this);
49
 
51
 
50
         options = new EA_DocGenOptions(this);
52
         options = new EA_DocGenOptions(this);
51
 
53
 
52
         EA_Finder = new EA_Finders();
54
         EA_Finder = new EA_Finders();
53
   
55
 
54
         EA_RelMatrix = new EA_RelationshipMatrix(this);
56
         EA_RelMatrix = new EA_RelationshipMatrix(this);
55
		}
57
		}
-
 
58
 
56
     
59
 
57
      public void accept_EA_RepositoryRef(EA.Repository EA_RepositoryRef)
60
      public void accept_EA_RepositoryRef(EA.Repository EA_RepositoryRef)
58
      {
61
      {
59
         EA_Repository = EA_RepositoryRef;
62
         EA_Repository = EA_RepositoryRef;
60
         EA_Finder.accept_EA_RepositoryRef(EA_RepositoryRef);
63
         EA_Finder.accept_EA_RepositoryRef(EA_RepositoryRef);
61
      }
64
      }
62
 
65
 
-
 
66
      public void modifyOptions()
-
 
67
      {
-
 
68
         EA.ObjectType objType;
-
 
69
         object obj;
63
 
70
 
-
 
71
         objType = EA_Repository.GetTreeSelectedItem( out obj );
-
 
72
         if (objType == EA.ObjectType.otElement)
-
 
73
         {
-
 
74
            EA.Element ele = (EA.Element)obj;
-
 
75
 
-
 
76
            if (0 == ele.Name.CompareTo(EA_Constants.EA_DocGenBaseName))
-
 
77
            {
-
 
78
               if (true == options.lookForAndProcess_EA_DocGen_Element( ele ))
-
 
79
               {
-
 
80
                  EA_DocGenOptionsForm dlg = new EA_DocGenOptionsForm();
-
 
81
                  dlg.populate(EA_Repository, options);
-
 
82
                  DialogResult dlgRes = dlg.ShowDialog();
-
 
83
                  if (dlgRes == DialogResult.OK)
-
 
84
                  {
-
 
85
                     dlg.read(EA_Repository, options);
64
 
86
 
-
 
87
                     options.updateEA_DocGen(ele);
-
 
88
                  }
-
 
89
               }
-
 
90
            }
-
 
91
         }
-
 
92
      }
65
 
93
 
66
      /// <summary>
94
      /// <summary>
67
      /// Begins the document generation process, opening the dialog to capture input/output
95
      /// Begins the document generation process, opening the dialog to capture input/output
68
      /// files. the createWordDoc dialog class does most of the work ofcoarse.
96
      /// files. the createWordDoc dialog class does most of the work ofcoarse.
69
      /// </summary>
97
      /// </summary>
Line 76... Line 104...
76
         if (objType == EA.ObjectType.otPackage)
104
         if (objType == EA.ObjectType.otPackage)
77
         {
105
         {
78
            // Make sure this package has an EA_DocGen element
106
            // Make sure this package has an EA_DocGen element
79
            if (true == options.lookForAndProcess_EA_DocGen_Element( ((EA.Package)obj) ))
107
            if (true == options.lookForAndProcess_EA_DocGen_Element( ((EA.Package)obj) ))
80
            {
108
            {
81
               // bring up the dialog for doc generation              
109
               // bring up the dialog for doc generation
82
               createWordDoc dialog = new createWordDoc(EA_Repository, ((EA.Package)obj), this);
110
               createWordDoc dialog = new createWordDoc(EA_Repository, ((EA.Package)obj), this);
83
               dialog.Text = "Generate Document From Model Layout";
111
               dialog.Text = "Generate Document From Model Layout";
84
               dialog.ShowDialog();                  }
112
               dialog.ShowDialog();
-
 
113
            }
85
            else
114
            else
86
            {
115
            {
87
               MessageBox.Show("EA_DocGen document model packages must contain an EA_DocGen element");
116
               MessageBox.Show("EA_DocGen document model packages must contain an EA_DocGen element");
88
            }
117
            }
89
         }
118
         }
90
         else
119
         else
91
         {
120
         {
92
            MessageBox.Show("You must select a package whose content is to be formed into a document");
121
            MessageBox.Show("You must select a package whose content is to be formed into a document");
93
         }      
122
         }
94
      }
123
      }
95
 
124
 
96
 
125
 
97
   
-
 
98
 
-
 
99
 
-
 
100
 
-
 
101
 
-
 
102
      /// <summary>
126
      /// <summary>
103
      /// Creates a package under the specified parent package. the package is given a tree position
127
      /// Creates a package under the specified parent package. the package is given a tree position
104
      /// as specified in order for it to be ordered in the model as the caller requires.
128
      /// as specified in order for it to be ordered in the model as the caller requires.
105
      /// </summary>
129
      /// </summary>
106
      /// <param name="parentPackage"></param>
130
      /// <param name="parentPackage"></param>
Line 112... Line 136...
112
         EA.Package newobj = (EA.Package)parentPackage.Packages.AddNew(name, "Package");
136
         EA.Package newobj = (EA.Package)parentPackage.Packages.AddNew(name, "Package");
113
         newobj.TreePos = treePos;
137
         newobj.TreePos = treePos;
114
         newobj.Update();
138
         newobj.Update();
115
         return newobj;
139
         return newobj;
116
      }
140
      }
117
  
141
 
118
 
142
 
119
      /// <summary>
143
      /// <summary>
120
      /// Generate a package hierarchy that reflects the document layout of BMS-00289, the
144
      /// Generate a package hierarchy that reflects the document layout of BMS-00289, the
121
      /// ERG Product Software Design Document.
145
      /// ERG Product Software Design Document.
122
      /// </summary>
146
      /// </summary>
Line 126... Line 150...
126
         object obj;
150
         object obj;
127
 
151
 
128
         objType = EA_Repository.GetTreeSelectedItem( out obj );
152
         objType = EA_Repository.GetTreeSelectedItem( out obj );
129
         if (objType == EA.ObjectType.otPackage)
153
         if (objType == EA.ObjectType.otPackage)
130
         {
154
         {
131
            if (  ((EA.Package)obj).Packages.Count == 0 
155
            if (  ((EA.Package)obj).Packages.Count == 0
132
               && ((EA.Package)obj).Elements.Count == 0
156
               && ((EA.Package)obj).Elements.Count == 0
133
               && ((EA.Package)obj).Diagrams.Count == 0 )
157
               && ((EA.Package)obj).Diagrams.Count == 0 )
134
            {
158
            {
135
               EA.Package parentPackage = ((EA.Package)obj);
159
               EA.Package parentPackage = ((EA.Package)obj);
136
 
160
 
Line 175... Line 199...
175
 
199
 
176
               newobj = createPackage(parentPackage, "Requirements Traceability", 7);
200
               newobj = createPackage(parentPackage, "Requirements Traceability", 7);
177
 
201
 
178
               // create an EA_DocGen element
202
               // create an EA_DocGen element
179
               EA.Element newElement = (EA.Element)parentPackage.Elements.AddNew( "EA_DocGen", "InformationItem" );
203
               EA.Element newElement = (EA.Element)parentPackage.Elements.AddNew( "EA_DocGen", "InformationItem" );
-
 
204
               newElement.Notes = "[ElementTypes]\r\nRequirement\r\nClass\r\nComponent\r\n";
-
 
205
               newElement.Update();
-
 
206
 
-
 
207
               parentPackage.Packages.Refresh();
-
 
208
 
-
 
209
               // refresh project browser view
-
 
210
               EA_Repository.RefreshModelView(parentPackage.PackageID);
-
 
211
            }
-
 
212
            else
-
 
213
            {
-
 
214
               MessageBox.Show("Can only insert layout into an empty package");
-
 
215
            }
-
 
216
         }
-
 
217
         else
-
 
218
         {
-
 
219
            MessageBox.Show("You must select a package into which the layout will be inserted");
-
 
220
         }
-
 
221
      }
-
 
222
 
-
 
223
 
-
 
224
      /// <summary>
-
 
225
      /// Generate a package hierarchy that reflects a basic document layout.
-
 
226
      /// </summary>
-
 
227
      public void create_basic_Layout()
-
 
228
      {
-
 
229
         EA.ObjectType objType;
-
 
230
         object obj;
-
 
231
 
-
 
232
         objType = EA_Repository.GetTreeSelectedItem( out obj );
-
 
233
         if (objType == EA.ObjectType.otPackage)
-
 
234
         {
-
 
235
            if (  ((EA.Package)obj).Packages.Count == 0
-
 
236
               && ((EA.Package)obj).Elements.Count == 0
-
 
237
               && ((EA.Package)obj).Diagrams.Count == 0 )
-
 
238
            {
-
 
239
               EA.Package parentPackage = ((EA.Package)obj);
-
 
240
 
-
 
241
               EA.Package newobj = null;
-
 
242
               EA.Package newobj2 = null;
-
 
243
               //EA.Package newobj3 = null;
-
 
244
               //EA.Package newobj4 = null;
-
 
245
               //EA.Package newobj5 = null;
-
 
246
 
-
 
247
               newobj  = createPackage(parentPackage, "Introduction", 1);
-
 
248
               newobj2 = createPackage(newobj, "Purpose", 1);
-
 
249
               newobj2 = createPackage(newobj, "Scope", 2);
-
 
250
               newobj2 = createPackage(newobj, "Terminology", 3);
-
 
251
               newobj2 = createPackage(newobj, "References", 4);
-
 
252
 
-
 
253
               newobj  = createPackage(parentPackage, "Section 2 (rename me as required)", 2);
-
 
254
 
-
 
255
               newobj  = createPackage(parentPackage, "Section 3 (rename me as required)", 3);
-
 
256
 
-
 
257
               // create an EA_DocGen element
-
 
258
               EA.Element newElement = (EA.Element)parentPackage.Elements.AddNew( EA_Constants.EA_DocGenBaseName,
-
 
259
                                                                                  EA_Constants.EA_DocGenElementType );
-
 
260
               newElement.Notes = "[ElementTypes]\r\nRequirement\r\nClass\r\nComponent\r\n";
180
               newElement.Update();
261
               newElement.Update();
181
 
262
 
182
               parentPackage.Packages.Refresh();
263
               parentPackage.Packages.Refresh();
183
 
264
 
184
               // refresh project browser view
265
               // refresh project browser view
Line 194... Line 275...
194
            MessageBox.Show("You must select a package into which the layout will be inserted");
275
            MessageBox.Show("You must select a package into which the layout will be inserted");
195
         }
276
         }
196
      }
277
      }
197
 
278
 
198
 
279
 
199
  
-
 
200
      /// <summary>
280
      /// <summary>
201
      /// This function works its way up the parental hierarchy to the root model, collecting the
281
      /// This function works its way up the parental hierarchy to the root model, collecting the
202
      /// strings names of each package and prepending them to a string accumulator with a view to 
282
      /// strings names of each package and prepending them to a string accumulator with a view to
203
      /// obtaing the full path of an element,diagram, or package.
283
      /// obtaing the full path of an element,diagram, or package.
204
      /// </summary>
284
      /// </summary>
205
      /// <param name="parentId"></param>
285
      /// <param name="parentId"></param>
206
      /// <param name="instr"></param>
286
      /// <param name="instr"></param>
207
      /// <returns></returns>
287
      /// <returns></returns>
Line 213... Line 293...
213
            pkg = EA_Repository.GetPackageByID( parentId );
293
            pkg = EA_Repository.GetPackageByID( parentId );
214
            if (pkg != null)
294
            if (pkg != null)
215
            {
295
            {
216
               instr = pkg.Name + "/" + instr;
296
               instr = pkg.Name + "/" + instr;
217
               instr = GetPackagePath(pkg.ParentID, instr);
297
               instr = GetPackagePath(pkg.ParentID, instr);
218
            }        
298
            }
219
         }
299
         }
220
         return instr;
300
         return instr;
221
      }
301
      }
222
 
302
 
223
 
303
 
224
 
-
 
225
      private void copy_GUID_to_clipboard(object obj, EA.ObjectType objType, bool confirm)
304
      private void copy_GUID_to_clipboard(object obj, EA.ObjectType objType, bool confirm)
226
      {
305
      {
227
         guid_clipboard.copy(obj, objType, confirm);
306
         guid_clipboard.copy(obj, objType, confirm);
228
      }
307
      }
229
 
308
 
-
 
309
 
230
      /// <summary>
310
      /// <summary>
231
      /// For the selected item, copy its GUID to the internal add-in GUID clipboard and the 
311
      /// For the selected item, copy its GUID to the internal add-in GUID clipboard and the
232
      /// global external clipboard. Also copy to the internal add-in GUID clipboard, the name of
312
      /// global external clipboard. Also copy to the internal add-in GUID clipboard, the name of
233
      /// the element and its type. This will support the AddLinkElement() method.
313
      /// the element and its type. This will support the AddLinkElement() method.
234
      /// </summary>
314
      /// </summary>
235
      public void copy_GUID_to_clipboard()
315
      public void copy_GUID_to_clipboard()
236
      {
316
      {
Line 239... Line 319...
239
         objType = EA_Repository.GetTreeSelectedItem( out obj );
319
         objType = EA_Repository.GetTreeSelectedItem( out obj );
240
         guid_clipboard.copy(obj, objType, true);
320
         guid_clipboard.copy(obj, objType, true);
241
      }
321
      }
242
 
322
 
243
 
323
 
-
 
324
      public void AddTestTraceabilityElement()
-
 
325
      {
-
 
326
         EA.ObjectType objType;
-
 
327
         object obj;
-
 
328
         objType = EA_Repository.GetTreeSelectedItem( out obj );
-
 
329
         AddTestTraceabilityElement(obj, objType);
-
 
330
      }
-
 
331
      public void AddTestTraceabilityElement(object obj, EA.ObjectType objType)
-
 
332
      {
-
 
333
         if (objType == EA.ObjectType.otPackage)
-
 
334
         {
-
 
335
            object newobj = null;
-
 
336
 
-
 
337
            newobj = ((EA.Package)obj).Elements.AddNew(EA_Constants.EA_DocGenTestTraceability, EA_Constants.EA_DocGenElementType);
-
 
338
            if (newobj != null)
-
 
339
            {
-
 
340
               ((EA.Element)newobj).Update();
-
 
341
            }         
-
 
342
         }
-
 
343
         else
-
 
344
         {
-
 
345
            MessageBox.Show("You must select a package into which the element will be inserted");
-
 
346
         }
-
 
347
      }
-
 
348
 
-
 
349
      /// <summary>
-
 
350
      /// Using the internal add-in GUID clipboard, paste a test link element into the selected
-
 
351
      /// package.
-
 
352
      /// </summary>
-
 
353
      public void AddTestLinkElement()
-
 
354
      {
-
 
355
         EA.ObjectType objType;
-
 
356
         object obj;
-
 
357
         objType = EA_Repository.GetTreeSelectedItem( out obj );
-
 
358
         AddTestLinkElement(obj, objType);
-
 
359
      }
-
 
360
 
-
 
361
      private void AddTestLinkElement(object obj, EA.ObjectType objType)
-
 
362
      {
-
 
363
         if (objType == EA.ObjectType.otPackage)
-
 
364
         {
-
 
365
            object newobj = null;
-
 
366
 
-
 
367
            if (   guid_clipboard.objType == EA.ObjectType.otElement
-
 
368
                || guid_clipboard.objType == EA.ObjectType.otPackage)
-
 
369
            {
-
 
370
               newobj = ((EA.Package)obj).Elements.AddNew(EA_Constants.EA_DocGenTestLink + " - " + guid_clipboard.name, EA_Constants.EA_DocGenElementType);
-
 
371
 
-
 
372
               if (newobj != null)
-
 
373
               {
-
 
374
                  ((EA.Element)newobj).Notes = guid_clipboard.name + "\r\n" + guid_clipboard.guid;
-
 
375
                  ((EA.Element)newobj).Update();
-
 
376
               }
-
 
377
            }
-
 
378
            else
-
 
379
            {
-
 
380
               MessageBox.Show("The GUID clipboard must first contain the GUID of an element (normally, a class), or a package");
-
 
381
            }
-
 
382
         }
-
 
383
         else
-
 
384
         {
-
 
385
            MessageBox.Show("You must select a package into which the test link will be inserted");
-
 
386
         }
-
 
387
      }
-
 
388
 
-
 
389
 
-
 
390
      /// <summary>
-
 
391
      /// Using the internal add-in GUID clipboard, paste a link element into the selected
-
 
392
      /// package.
-
 
393
      /// </summary>
-
 
394
      public void AddLinkElement()
-
 
395
      {
-
 
396
         EA.ObjectType objType;
-
 
397
         object obj;
-
 
398
         objType = EA_Repository.GetTreeSelectedItem( out obj );
-
 
399
         AddLinkElement(obj, objType);
-
 
400
      }
244
 
401
 
245
      private void AddLinkElement(object obj, EA.ObjectType objType)
402
      private void AddLinkElement(object obj, EA.ObjectType objType)
246
      {
403
      {
247
         if (objType == EA.ObjectType.otPackage)
404
         if (objType == EA.ObjectType.otPackage)
248
         {
405
         {
249
            object newobj = null;
406
            object newobj = null;
250
 
407
 
251
            if (guid_clipboard.objType == EA.ObjectType.otPackage)
408
            if (guid_clipboard.objType == EA.ObjectType.otPackage)
252
            {
409
            {
253
               newobj = ((EA.Package)obj).Elements.AddNew("EA_DocGenPackageLink - " + guid_clipboard.name, "InformationItem");
410
               newobj = ((EA.Package)obj).Elements.AddNew(EA_Constants.EA_DocGenPackageLink + " - " + guid_clipboard.name, EA_Constants.EA_DocGenElementType);
254
            }
411
            }
255
            else if (guid_clipboard.objType == EA.ObjectType.otDiagram)
412
            else if (guid_clipboard.objType == EA.ObjectType.otDiagram)
256
            {
413
            {
257
               newobj = ((EA.Package)obj).Elements.AddNew("EA_DocGenDiagramLink - " + guid_clipboard.name, "InformationItem");
414
               newobj = ((EA.Package)obj).Elements.AddNew(EA_Constants.EA_DocGenDiagramLink + " - " + guid_clipboard.name, EA_Constants.EA_DocGenElementType);
258
            }
415
            }
259
            else if (guid_clipboard.objType == EA.ObjectType.otElement)
416
            else if (guid_clipboard.objType == EA.ObjectType.otElement)
260
            {
417
            {
261
               newobj = ((EA.Package)obj).Elements.AddNew("EA_DocGenElementLink - " + guid_clipboard.name, "InformationItem");
418
               newobj = ((EA.Package)obj).Elements.AddNew(EA_Constants.EA_DocGenElementLink + " - " + guid_clipboard.name, EA_Constants.EA_DocGenElementType);
262
            }
419
            }
263
            else if (guid_clipboard.objType == EA.ObjectType.otAttribute)
420
            else if (guid_clipboard.objType == EA.ObjectType.otAttribute)
264
            {
421
            {
265
               MessageBox.Show("Attribute links are not currently supported");
422
               MessageBox.Show("Attribute links are not currently supported");
266
            }
423
            }
Line 276... Line 433...
276
            }
433
            }
277
         }
434
         }
278
         else
435
         else
279
         {
436
         {
280
            MessageBox.Show("You must select a package into which the link will be inserted");
437
            MessageBox.Show("You must select a package into which the link will be inserted");
281
         }      
438
         }
282
      }
439
      }
283
 
440
 
284
      /// <summary>
-
 
285
      /// Using the internal add-in GUID clipboard, paste a link element into the selected
-
 
286
      /// package.
-
 
287
      /// </summary>
-
 
-
 
441
 
288
      public void AddLinkElement()
442
      public void AddTableElement()
289
      {
443
      {
290
         EA.ObjectType objType;
444
         EA.ObjectType objType;
291
         object obj;
445
         object obj;
292
 
446
 
293
         objType = EA_Repository.GetTreeSelectedItem( out obj );
447
         objType = EA_Repository.GetTreeSelectedItem( out obj );
-
 
448
         if (objType == EA.ObjectType.otPackage)
-
 
449
         {
-
 
450
            object newobj = null;
294
 
451
 
-
 
452
            newobj = ((EA.Package)obj).Elements.AddNew(EA_Constants.EA_DocGenTable, EA_Constants.EA_DocGenElementType);
-
 
453
            if (newobj != null)
-
 
454
            {
-
 
455
               ((EA.Element)newobj).Notes = "title=insertYourTitleHere\r\n"
-
 
456
                                          + "columns=2\r\n"
-
 
457
                                          + "seperator=,\r\n"
-
 
458
                                          + "column1Title,column2Title\r\n"
-
 
459
                                          + "cellcontent,cellcontent\r\n"
-
 
460
                                          + "etc,etc";
-
 
461
               ((EA.Element)newobj).Update();
-
 
462
            }
-
 
463
         }
-
 
464
         else
-
 
465
         {
-
 
466
            MessageBox.Show("You must select a package into which the Table Element will be inserted");
-
 
467
         }
-
 
468
      }
-
 
469
 
-
 
470
 
-
 
471
      public void AddTextElement()
-
 
472
      {
-
 
473
         EA.ObjectType objType;
-
 
474
         object obj;
-
 
475
 
-
 
476
         objType = EA_Repository.GetTreeSelectedItem( out obj );
-
 
477
         if (objType == EA.ObjectType.otPackage)
-
 
478
         {
-
 
479
            object newobj = null;
-
 
480
 
-
 
481
            newobj = ((EA.Package)obj).Elements.AddNew(EA_Constants.EA_DocGenText, EA_Constants.EA_DocGenElementType);
-
 
482
            if (newobj != null)
-
 
483
            {
-
 
484
               ((EA.Element)newobj).Notes = "Add your text here.";
-
 
485
               ((EA.Element)newobj).Update();
-
 
486
            }
-
 
487
         }
-
 
488
         else
-
 
489
         {
-
 
490
            MessageBox.Show("You must select a package into which the Text Element will be inserted");
-
 
491
         }
-
 
492
      }
-
 
493
 
-
 
494
 
-
 
495
      public void AddRelationshipMatrixElement()
-
 
496
      {
295
         AddLinkElement(obj, objType);
497
         EA.ObjectType objType;
-
 
498
         object obj;
-
 
499
 
-
 
500
         objType = EA_Repository.GetTreeSelectedItem( out obj );
-
 
501
         if (objType == EA.ObjectType.otPackage)
-
 
502
         {
-
 
503
            object newobj = null;
-
 
504
 
-
 
505
            newobj = ((EA.Package)obj).Elements.AddNew(EA_Constants.EA_DocGenRelationshipMatrix, EA_Constants.EA_DocGenElementType);
-
 
506
            if (newobj != null)
-
 
507
            {
-
 
508
               ((EA.Element)newobj).Notes  = EA_RelMatrix.optionTemplateForRelationshipMatrix();
-
 
509
               ((EA.Element)newobj).Update();
-
 
510
            }
-
 
511
         }
-
 
512
         else
-
 
513
         {
-
 
514
            MessageBox.Show("You must select a package into which the RelationshipMatrix Element will be inserted");
-
 
515
         }
296
      }
516
      }
297
 
517
 
298
 
518
 
299
      public void GeneratePackagesFromElementList()
519
      public void GeneratePackagesFromElementList()
300
      {
520
      {
Line 309... Line 529...
309
               EA.Package theFoundPackage = EA_Finder.findPackageInRepositoryByGUID(guid_clipboard.guid);
529
               EA.Package theFoundPackage = EA_Finder.findPackageInRepositoryByGUID(guid_clipboard.guid);
310
               if (theFoundPackage != null)
530
               if (theFoundPackage != null)
311
               {
531
               {
312
                  EA.Package srcPackage = theFoundPackage;
532
                  EA.Package srcPackage = theFoundPackage;
313
                  EA.Package destPackage = ((EA.Package)obj);
533
                  EA.Package destPackage = ((EA.Package)obj);
314
                     
-
 
-
 
534
 
315
                  foreach( EA.Element srcElement in srcPackage.Elements)
535
                  foreach( EA.Element srcElement in srcPackage.Elements)
316
                  {
536
                  {
317
                     if (false == EA_Finder.elementNameExistsInPackage(destPackage, srcElement.Name.ToString()))
537
                     if (false == EA_Finder.elementNameExistsInPackage(destPackage, srcElement.Name.ToString()))
318
                     {
538
                     {
319
                        createPackage(destPackage, srcElement.Name.ToString(), 1);
539
                        createPackage(destPackage, srcElement.Name.ToString(), 1);
320
                     }
540
                     }
321
                  }
541
                  }
322
               }               
542
               }
323
            }
543
            }
324
            else
544
            else
325
            {
545
            {
326
               MessageBox.Show("You must first copy a Source Package GUID to the clipboard");
546
               MessageBox.Show("You must first copy a Source Package GUID to the clipboard");
327
            }
547
            }
Line 346... Line 566...
346
               EA.Package theFoundPackage = EA_Finder.findPackageInRepositoryByGUID(guid_clipboard.guid);
566
               EA.Package theFoundPackage = EA_Finder.findPackageInRepositoryByGUID(guid_clipboard.guid);
347
               if (theFoundPackage != null)
567
               if (theFoundPackage != null)
348
               {
568
               {
349
                  EA.Package srcPackage = theFoundPackage;
569
                  EA.Package srcPackage = theFoundPackage;
350
                  EA.Package destPackage = ((EA.Package)obj);
570
                  EA.Package destPackage = ((EA.Package)obj);
351
                       
-
 
-
 
571
 
352
                  foreach( EA.Package subPackage in srcPackage.Packages)
572
                  foreach( EA.Package subPackage in srcPackage.Packages)
353
                  {
573
                  {
354
                     copy_GUID_to_clipboard( (object)subPackage, EA.ObjectType.otPackage, false);
574
                     copy_GUID_to_clipboard( (object)subPackage, EA.ObjectType.otPackage, false);
355
                     AddLinkElement( (object)destPackage, EA.ObjectType.otPackage);
575
                     AddLinkElement( (object)destPackage, EA.ObjectType.otPackage);
356
                  }
576
                  }
357
               }               
577
               }
358
            }
578
            }
359
            else
579
            else
360
            {
580
            {
361
               MessageBox.Show("You must first copy a Source Package GUID to the clipboard");
581
               MessageBox.Show("You must first copy a Source Package GUID to the clipboard");
362
            }
582
            }
Line 381... Line 601...
381
               EA.Package theFoundPackage = EA_Finder.findPackageInRepositoryByGUID(guid_clipboard.guid);
601
               EA.Package theFoundPackage = EA_Finder.findPackageInRepositoryByGUID(guid_clipboard.guid);
382
               if (theFoundPackage != null)
602
               if (theFoundPackage != null)
383
               {
603
               {
384
                  EA.Package srcPackage = theFoundPackage;
604
                  EA.Package srcPackage = theFoundPackage;
385
                  EA.Package destPackage = ((EA.Package)obj);
605
                  EA.Package destPackage = ((EA.Package)obj);
386
                       
-
 
-
 
606
 
387
                  foreach( EA.Element subElement in srcPackage.Elements)
607
                  foreach( EA.Element subElement in srcPackage.Elements)
388
                  {
608
                  {
389
                     copy_GUID_to_clipboard( (object)subElement, EA.ObjectType.otElement, false);
609
                     copy_GUID_to_clipboard( (object)subElement, EA.ObjectType.otElement, false);
390
                     AddLinkElement( (object)destPackage, EA.ObjectType.otPackage);
610
                     AddLinkElement( (object)destPackage, EA.ObjectType.otPackage);
391
                  }
611
                  }
392
               }               
612
               }
393
            }
613
            }
394
            else
614
            else
395
            {
615
            {
396
               MessageBox.Show("You must first copy a Source Package GUID to the clipboard");
616
               MessageBox.Show("You must first copy a Source Package GUID to the clipboard");
397
            }
617
            }
398
         }
618
         }
399
         else
619
         else
400
         {
620
         {
401
            MessageBox.Show("You must select a Destination Package into which the Element Links will be inserted");
621
            MessageBox.Show("You must select a Destination Package into which the Element Links will be inserted");
402
         }      
622
         }
403
      }
623
      }
404
 
624
 
-
 
625
      /// <summary>
-
 
626
      /// This function is designed to parse EA models/packages in a predefined way, whilst allowing
-
 
627
      /// a user to specify what processing is to be done upon or with each element found.
-
 
628
      /// </summary>
-
 
629
      /// <param name="thePackage"></param>
-
 
630
      /// <param name="worker"></param>
405
 
-
 
406
      public void AddTableElement()
631
      /// <param name="recurse"></param>
-
 
632
      public void findAndProcessPackageElements( EA.Package thePackage, EA_UtilitiesRecursionWorker worker, bool recurse)
407
      {
633
      {
408
         EA.ObjectType objType;
634
         worker.processPackage( thePackage );
409
         object obj;
-
 
410
 
635
 
411
         objType = EA_Repository.GetTreeSelectedItem( out obj );
-
 
412
         if (objType == EA.ObjectType.otPackage)
636
         foreach (EA.Element theElement in thePackage.Elements)
413
         {
637
         {
414
            object newobj = null;
638
            worker.processElement( theElement );
-
 
639
         }
415
 
640
 
416
            newobj = ((EA.Package)obj).Elements.AddNew("EA_DocGenTable", "InformationItem");
-
 
417
            if (newobj != null)
641
         if (recurse == true)
-
 
642
         {
-
 
643
            foreach (EA.Package subPackage in thePackage.Packages)
418
            {
644
            {
419
               ((EA.Element)newobj).Notes = "title=insertYourTitleHere\r\n"
-
 
420
                                          + "columns=2\r\n"
-
 
421
                                          + "seperator=,\r\n"
-
 
422
                                          + "column1Title,column2Title\r\n"
-
 
423
                                          + "cellcontent,cellcontent\r\n"
-
 
424
                                          + "etc,etc";
645
               // RECURSION
425
               ((EA.Element)newobj).Update();
646
               findAndProcessPackageElements( subPackage, worker, true);
426
            }
647
            }
427
         }
648
         }
428
         else
-
 
429
         {
649
 
430
            MessageBox.Show("You must select a package into which the Table Element will be inserted");
-
 
431
         }      
-
 
432
      }
650
      }
433
 
651
 
434
      
652
 
435
      public void AddTextElement()
653
      public void addDocumentReference()
436
      {
654
      {
437
         EA.ObjectType objType;
655
         EA.ObjectType objType;
438
         object obj;
656
         object obj;
439
 
657
 
440
         objType = EA_Repository.GetTreeSelectedItem( out obj );
658
         objType = EA_Repository.GetTreeSelectedItem( out obj );
441
         if (objType == EA.ObjectType.otPackage)
659
         if (objType == EA.ObjectType.otPackage)
442
         {
660
         {
443
            object newobj = null;
661
            DocReferenceForm dlg = new DocReferenceForm();
444
 
-
 
445
            newobj = ((EA.Package)obj).Elements.AddNew("EA_DocGenText", "InformationItem");
662
            DialogResult dlgRes = dlg.ShowDialog();
446
            if (newobj != null)
663
            if (dlgRes == DialogResult.OK)
447
            {
664
            {
-
 
665
               object newobj = null;
-
 
666
 
-
 
667
               newobj = ((EA.Package)obj).Elements.AddNew(dlg.textBox_DocNumber.Text, EA_Constants.EA_DocGenElementType);
-
 
668
               if (newobj != null)
-
 
669
               {
448
               ((EA.Element)newobj).Notes = "Add your text here.";
670
                  ((EA.Element)newobj).Notes = dlg.textBox_DocName.Text;
449
               ((EA.Element)newobj).Update();
671
                  ((EA.Element)newobj).Update();
-
 
672
               }
450
            }
673
            }
451
         }
674
         }
452
         else
-
 
453
         {
-
 
454
            MessageBox.Show("You must select a package into which the Text Element will be inserted");
-
 
455
         }            
-
 
456
      }
675
      }
457
 
676
 
-
 
677
 
458
      public void AddRelationshipMatrixElement()
678
      public void addTerminology()
459
      {
679
      {
460
         EA.ObjectType objType;
680
         EA.ObjectType objType;
461
         object obj;
681
         object obj;
462
 
682
 
463
         objType = EA_Repository.GetTreeSelectedItem( out obj );
683
         objType = EA_Repository.GetTreeSelectedItem( out obj );
464
         if (objType == EA.ObjectType.otPackage)
684
         if (objType == EA.ObjectType.otPackage)
465
         {
685
         {
466
            object newobj = null;
686
            TerminologyForm dlg = new TerminologyForm();
467
 
-
 
468
            newobj = ((EA.Package)obj).Elements.AddNew("EA_DocGenRelationshipMatrix", "InformationItem");
687
            DialogResult dlgRes = dlg.ShowDialog();
469
            if (newobj != null)
688
            if (dlgRes == DialogResult.OK)
470
            {
689
            {
471
               ((EA.Element)newobj).Notes  = EA_RelMatrix.optionTemplateForRelationshipMatrix();
-
 
472
               ((EA.Element)newobj).Update();
690
               object newobj = null;
473
            }
-
 
474
         }
-
 
475
         else
-
 
476
         {
-
 
477
            MessageBox.Show("You must select a package into which the RelationshipMatrix Element will be inserted");
-
 
478
         }         
-
 
479
      }
-
 
480
 
-
 
481
      /// <summary>
-
 
482
      /// This function is designed to parse EA models/packages in a predefined way, whilst allowing
-
 
483
      /// a user to specify what processing is to be done upon or with each element found.
-
 
484
      /// </summary>
-
 
485
      /// <param name="thePackage"></param>
-
 
486
      /// <param name="worker"></param>
-
 
487
      /// <param name="recurse"></param>
-
 
488
      public void findAndProcessPackageElements( EA.Package thePackage, EA_UtilitiesRecursionWorker worker, bool recurse)
-
 
489
      {
-
 
490
         worker.processPackage( thePackage );
-
 
491
 
691
 
492
         foreach (EA.Element theElement in thePackage.Elements)
692
               newobj = ((EA.Package)obj).Elements.AddNew(dlg.textBox_Term.Text, EA_Constants.EA_DocGenElementType);
493
         {
-
 
494
            worker.processElement( theElement );
693
               if (newobj != null)
495
         }
694
               {
496
 
-
 
497
         if (recurse == true)
695
                  ((EA.Element)newobj).Notes = dlg.textBox_TermExpansion.Text;
498
         {
-
 
499
            foreach (EA.Package subPackage in thePackage.Packages)
696
                  ((EA.Element)newobj).Update();
500
            {
697
               }
501
               // RECURSION
-
 
502
               findAndProcessPackageElements( subPackage, worker, true);
-
 
503
            }         
698
            }
504
         }
699
         }
505
 
-
 
506
      }
700
      }
507
 
701
 
508
 
702
 
509
 
-
 
510
 
-
 
511
      #region Temporary or experimental code
703
      #region Temporary or experimental code
512
 
704
 
513
 
705
 
514
 
706
 
515
      /// <summary>
707
      /// <summary>
Line 635... Line 827...
635
            }
827
            }
636
          }
828
          }
637
         else
829
         else
638
         {
830
         {
639
            MessageBox.Show("You must select a package");
831
            MessageBox.Show("You must select a package");
640
         }            
832
         }
641
      }
833
      }
642
 
834
 
643
 
835
 
644
      #endregion
836
      #endregion
645
	}
837
	}