Subversion Repositories DevTools

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2088 ghuddy 1
using System;
2
using System.Windows.Forms;
3
using System.IO;
4
 
5
 
6
namespace EA_DocGen
7
{
8
	/// <summary>
9
	/// Summary description for GUID_Clipboard.
10
	/// </summary>
11
	public class GUID_Clipboard
12
	{
13
      // Data for the GUID copying/pasting menu items
14
      public string guid;
15
      public EA.ObjectType objType;
16
      public string name;
17
 
18
      private EA_Utilities EA_Utils = null;
19
 
20
		public GUID_Clipboard(EA_Utilities EA_UtilsRef)
21
		{
22
         EA_Utils = EA_UtilsRef;
23
         guid = "";
24
         objType = EA.ObjectType.otNone;
25
         name = "";
26
		}
27
 
28
      /// <summary>
29
      /// Copies the GUID,name and type of the object to the clipboard data members.
30
      /// </summary>
31
      /// <param name="obj"></param>
32
      /// <param name="objType"></param>
33
      /// <param name="confirm"></param>
34
      public void copy(object obj, EA.ObjectType objtype, bool confirm)
35
      {
36
         if (objtype == EA.ObjectType.otPackage)
37
         {
38
            guid = ((EA.Package)obj).PackageGUID.ToString();
39
            name = ((EA.Package)obj).Name;
40
            name = EA_Utils.GetPackagePath(((EA.Package)obj).ParentID, name);
41
            objType = objtype;
42
            Clipboard.SetDataObject(guid);
43
            if (confirm)
44
               MessageBox.Show( "EA PackageGUID\n\n" + guid );
45
         }
46
         else if (objtype == EA.ObjectType.otDiagram)
47
         {
48
            guid = ((EA.Diagram)obj).DiagramGUID.ToString();
49
            name = ((EA.Diagram)obj).Name;
50
            name = EA_Utils.GetPackagePath(((EA.Diagram)obj).PackageID, name);
51
            objType = objtype;
52
            Clipboard.SetDataObject(guid);
53
            if (confirm)
54
               MessageBox.Show( "EA DiagramGUID\n\n" + guid );
55
         }
56
         else if (objtype == EA.ObjectType.otElement)
57
         {
58
            guid = ((EA.Element)obj).ElementGUID.ToString();
59
            name = ((EA.Element)obj).Name;
60
            name = EA_Utils.GetPackagePath(((EA.Element)obj).PackageID, name);
61
            objType = objtype;
62
            Clipboard.SetDataObject(guid);
63
            if (confirm)
64
               MessageBox.Show( "EA ElementGUID\n\n" + guid );
65
         }
66
         else if (objtype == EA.ObjectType.otAttribute)
67
         {
68
            guid = ((EA.Attribute)obj).AttributeGUID.ToString();
69
            name = ((EA.Attribute)obj).Name;
70
            objType = objtype;
71
            Clipboard.SetDataObject(guid);
72
            if (confirm)
73
               MessageBox.Show( "EA AttributeGUID\n\n" + guid );
74
         }
75
         else if (objtype == EA.ObjectType.otMethod)
76
         {
77
            guid = ((EA.Method)obj).MethodGUID.ToString();
78
            name = ((EA.Method)obj).Name;
79
            objType = objtype;
80
            Clipboard.SetDataObject(guid);
81
            if (confirm)
82
               MessageBox.Show( "EA MethodGUID\n\n" + guid );
83
         }
84
         else
85
         {
86
            MessageBox.Show( "Copying this object type is not supported" );
87
         }
88
      }
89
	}
90
}