Subversion Repositories DevTools

Rev

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

Rev 2155 Rev 2159
Line 34... Line 34...
34
      public void EA_OnPostInitialized(EA.Repository repository)
34
      public void EA_OnPostInitialized(EA.Repository repository)
35
      {
35
      {
36
         repository.CreateOutputTab(GUI_OUTPUT_TAB_NAME);
36
         repository.CreateOutputTab(GUI_OUTPUT_TAB_NAME);
37
         repository.EnsureOutputVisible(GUI_OUTPUT_TAB_NAME);
37
         repository.EnsureOutputVisible(GUI_OUTPUT_TAB_NAME);
38
      }
38
      }
39
      
39
 
40
      
40
 
41
      public void EA_Disconnect()
41
      public void EA_Disconnect()
42
      {
42
      {
43
         GC.Collect();
43
         GC.Collect();
44
         GC.WaitForPendingFinalizers();
44
         GC.WaitForPendingFinalizers();
45
      }
45
      }
Line 61... Line 61...
61
      {
61
      {
62
         if ((outputTabName == GUI_OUTPUT_TAB_NAME) && (identifier > 0))
62
         if ((outputTabName == GUI_OUTPUT_TAB_NAME) && (identifier > 0))
63
         {
63
         {
64
            try
64
            try
65
            {
65
            {
66
               EA.Element element = repository.GetElementByID(identifier);
66
               EA.Package package = repository.GetPackageByID(identifier);
67
               repository.ShowInProjectView(element);
67
               repository.ShowInProjectView(package);
68
            }
68
            }
69
            catch
69
            catch
70
            {
70
            {
71
               try
71
               try
72
               {
72
               {
-
 
73
                  EA.Element element = repository.GetElementByID(identifier);
-
 
74
                  if (element.MetaType == "Package")
-
 
75
                  {
73
                  EA.Package package = repository.GetPackageByID(identifier);
76
                     EA.Package package = repository.GetPackageByID(element.PackageID);
74
                  repository.ShowInProjectView(package);
77
                     repository.ShowInProjectView(package);
-
 
78
                  }
-
 
79
                  else
-
 
80
                  {
-
 
81
                     repository.ShowInProjectView(element);
-
 
82
                  }
75
               }
83
               }
76
               catch
84
               catch
77
               {
85
               {
-
 
86
                  try
-
 
87
                  {
-
 
88
                     EA.Diagram diagram = repository.GetDiagramByID(identifier);
-
 
89
                     repository.ShowInProjectView(diagram);
-
 
90
                  }
-
 
91
                  catch
-
 
92
                  {
-
 
93
                  }
78
               }
94
               }
79
            }
95
            }
80
         }
96
         }
81
      }
97
      }
82
 
98
 
Line 292... Line 308...
292
            newDiagramObject.ElementID = element.ElementID;
308
            newDiagramObject.ElementID = element.ElementID;
293
            newDiagramObject.Update();
309
            newDiagramObject.Update();
294
         }
310
         }
295
         newDiagram.DiagramObjects.Refresh();
311
         newDiagram.DiagramObjects.Refresh();
296
         containerPackage.Update();
312
         containerPackage.Update();
297
         EA_Repository.GetProjectInterface().LayoutDiagramEx( newDiagram.DiagramGUID, 
313
         EA_Repository.GetProjectInterface().LayoutDiagramEx( newDiagram.DiagramGUID,
298
            EA.ConstLayoutStyles.lsDiagramDefault, 4, 20, 20, false);
314
            EA.ConstLayoutStyles.lsDiagramDefault, 4, 20, 20, false);
299
      }
315
      }
300
 
316
 
301
      private void createRequirementDiagram(EA.Package containerPackage, ArrayList elements)
317
      private void createRequirementDiagram(EA.Package containerPackage, ArrayList elements)
302
      {
318
      {
Line 310... Line 326...
310
            newDiagramObject.ElementID = element.ElementID;
326
            newDiagramObject.ElementID = element.ElementID;
311
            newDiagramObject.Update();
327
            newDiagramObject.Update();
312
         }
328
         }
313
         newDiagram.DiagramObjects.Refresh();
329
         newDiagram.DiagramObjects.Refresh();
314
         containerPackage.Update();
330
         containerPackage.Update();
315
         EA_Repository.GetProjectInterface().LayoutDiagramEx( newDiagram.DiagramGUID, 
331
         EA_Repository.GetProjectInterface().LayoutDiagramEx( newDiagram.DiagramGUID,
316
            EA.ConstLayoutStyles.lsDiagramDefault, 4, 20, 20, false);
332
            EA.ConstLayoutStyles.lsDiagramDefault, 4, 20, 20, false);
317
      }
333
      }
318
 
334
 
319
 
335
 
320
      /// <summary>
336
      /// <summary>
321
      /// Thread function for import for traceability use operation
337
      /// Thread function for import for traceability use operation
322
      /// </summary>
338
      /// </summary>
323
      private static void ImportReqProDatabase_Thread()
339
      private static void ImportReqProDatabase_Thread()
324
      {
340
      {
325
         bool cancelled = false;
341
         bool cancelled = false;
326
         mustAbort = false;
342
         mustAbort = false;
327
         abortRequests = 0;
343
         abortRequests = 0;
328
         EA_Repository.EnsureOutputVisible(GUI_OUTPUT_TAB_NAME);
344
         EA_Repository.EnsureOutputVisible(GUI_OUTPUT_TAB_NAME);
329
         EA_Repository.WriteOutput(GUI_OUTPUT_TAB_NAME,"",-1);
345
         EA_Repository.WriteOutput(GUI_OUTPUT_TAB_NAME,"",-1);
330
         ImportReqProDatabase import_parser = new ImportReqProDatabase();
346
         ImportReqProDatabase import_parser = new ImportReqProDatabase();
331
         import_parser.prompt_and_parse(ReqProDB_Artifact.MODE.TRACEABILITY, out cancelled); 
347
         import_parser.prompt_and_parse(ReqProDB_Artifact.MODE.TRACEABILITY, out cancelled);
332
         if (mustAbort)
348
         if (mustAbort)
333
         {
349
         {
334
            EA_Repository.WriteOutput(GUI_OUTPUT_TAB_NAME, "Import Aborted", -1);
350
            EA_Repository.WriteOutput(GUI_OUTPUT_TAB_NAME, "Import Aborted", -1);
335
            MessageBoxEx.Show("Import Aborted", "Progress");
351
            MessageBoxEx.Show("Import Aborted", "Progress");
336
         }
352
         }
337
         else if (cancelled)
353
         else if (cancelled)
338
         {
354
         {
339
            Main.WriteOutput("Import Cancelled",-1);
355
            Main.WriteOutput("Import Cancelled",-1);
340
         }
356
         }
341
         abortRequests = 0;
357
         abortRequests = 0;
342
         ReqProDatabase.close();
358
         ReqProDatabase.close();
343
      }
359
      }
344
 
360
 
345
      /// <summary>
361
      /// <summary>
346
      /// Thread function for import for document model use operation
362
      /// Thread function for import for document model use operation
347
      /// </summary>
363
      /// </summary>
348
      private static void CopyReqProDatabase_Thread()
364
      private static void CopyReqProDatabase_Thread()
349
      {
365
      {
350
         bool cancelled = false;
366
         bool cancelled = false;
351
         mustAbort = false;
367
         mustAbort = false;
Line 357... Line 373...
357
         if (mustAbort)
373
         if (mustAbort)
358
         {
374
         {
359
            EA_Repository.WriteOutput(GUI_OUTPUT_TAB_NAME, "Import Aborted", -1);
375
            EA_Repository.WriteOutput(GUI_OUTPUT_TAB_NAME, "Import Aborted", -1);
360
            MessageBoxEx.Show("Import Aborted", "Progress");
376
            MessageBoxEx.Show("Import Aborted", "Progress");
361
         }
377
         }
362
         else if (cancelled)
378
         else if (cancelled)
363
         {
379
         {
364
            Main.WriteOutput("Import Cancelled",-1);
380
            Main.WriteOutput("Import Cancelled",-1);
365
         }
381
         }
366
         abortRequests = 0;
382
         abortRequests = 0;
367
         ReqProDatabase.close();
383
         ReqProDatabase.close();
368
      }
384
      }
369
 
385
 
370
      /// <summary>
386
      /// <summary>
371
      /// Thread function for export to reqpro database operation
387
      /// Thread function for export to reqpro database operation
372
      /// </summary>
388
      /// </summary>
373
      private static void ExportToReqPro_Thread()
389
      private static void ExportToReqPro_Thread()
374
      {
390
      {
375
         bool cancelled = false;
391
         bool cancelled = false;
376
         mustAbort = false;
392
         mustAbort = false;
Line 382... Line 398...
382
         if (mustAbort)
398
         if (mustAbort)
383
         {
399
         {
384
            EA_Repository.WriteOutput(GUI_OUTPUT_TAB_NAME, "Export Aborted", -1);
400
            EA_Repository.WriteOutput(GUI_OUTPUT_TAB_NAME, "Export Aborted", -1);
385
            MessageBoxEx.Show("Export Aborted", "Progress");
401
            MessageBoxEx.Show("Export Aborted", "Progress");
386
         }
402
         }
387
         else if (cancelled)
403
         else if (cancelled)
388
         {
404
         {
389
            Main.WriteOutput("Export Cancelled",-1);
405
            Main.WriteOutput("Export Cancelled",-1);
390
         }
406
         }
391
         abortRequests = 0;
407
         abortRequests = 0;
392
         ReqProDatabase.close();
408
         ReqProDatabase.close();
393
      }
409
      }
394
 
410
 
Line 397... Line 413...
397
         MessageBoxException(exc, "Exception");
413
         MessageBoxException(exc, "Exception");
398
      }
414
      }
399
 
415
 
400
      public static void MessageBoxException(Exception exc, string caption)
416
      public static void MessageBoxException(Exception exc, string caption)
401
      {
417
      {
402
         MessageBoxEx.Show(exc.ToString(), caption, MessageBoxIcon.Error);
418
         MessageBoxEx.Show(exc.ToString(), caption, MessageBoxIcon.Error);
403
      }
419
      }
404
 
420
 
405
      public static void WriteOutput(string s, int id)
421
      public static void WriteOutput(string s, int id)
406
      {
422
      {
407
         EA_Repository.WriteOutput( GUI_OUTPUT_TAB_NAME, s, id);
423
         EA_Repository.WriteOutput( GUI_OUTPUT_TAB_NAME, s, id);
408
      }
424
      }
409
 
425
 
410
      public static void ClearOutput()
426
      public static void ClearOutput()
411
      {
427
      {
412
         EA_Repository.ClearOutput(GUI_OUTPUT_TAB_NAME);
428
         EA_Repository.ClearOutput(GUI_OUTPUT_TAB_NAME);
413
      }
429
      }