Subversion Repositories DevTools

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

using System;
using System.Windows.Forms;
using System.IO;


namespace EA_DocGen
{
        /// <summary>
        /// Summary description for GUID_Clipboard.
        /// </summary>
        public class GUID_Clipboard
        {
      // Data for the GUID copying/pasting menu items
      public string guid;
      public EA.ObjectType objType;
      public string name;

      private EA_Utilities EA_Utils = null;

                public GUID_Clipboard(EA_Utilities EA_UtilsRef)
                {
         EA_Utils = EA_UtilsRef;
         guid = "";
         objType = EA.ObjectType.otNone;
         name = "";
                }

      /// <summary>
      /// Copies the GUID,name and type of the object to the clipboard data members.
      /// </summary>
      /// <param name="obj"></param>
      /// <param name="objType"></param>
      /// <param name="confirm"></param>
      public void copy(object obj, EA.ObjectType objtype, bool confirm)
      {
         if (objtype == EA.ObjectType.otPackage)
         {
            guid = ((EA.Package)obj).PackageGUID.ToString();
            name = ((EA.Package)obj).Name;
            name = EA_Utils.GetPackagePath(((EA.Package)obj).ParentID, name);
            objType = objtype;
            Clipboard.SetDataObject(guid);
            if (confirm)
               MessageBox.Show( "EA PackageGUID\n\n" + guid );
         }
         else if (objtype == EA.ObjectType.otDiagram)
         {
            guid = ((EA.Diagram)obj).DiagramGUID.ToString();
            name = ((EA.Diagram)obj).Name;
            name = EA_Utils.GetPackagePath(((EA.Diagram)obj).PackageID, name);
            objType = objtype;
            Clipboard.SetDataObject(guid);
            if (confirm)
               MessageBox.Show( "EA DiagramGUID\n\n" + guid );
         }
         else if (objtype == EA.ObjectType.otElement)
         {
            guid = ((EA.Element)obj).ElementGUID.ToString();
            name = ((EA.Element)obj).Name;
            name = EA_Utils.GetPackagePath(((EA.Element)obj).PackageID, name);
            objType = objtype;
            Clipboard.SetDataObject(guid);
            if (confirm)
               MessageBox.Show( "EA ElementGUID\n\n" + guid );
         }
         else if (objtype == EA.ObjectType.otAttribute)
         {
            guid = ((EA.Attribute)obj).AttributeGUID.ToString();
            name = ((EA.Attribute)obj).Name;
            objType = objtype;
            Clipboard.SetDataObject(guid);
            if (confirm)
               MessageBox.Show( "EA AttributeGUID\n\n" + guid );
         }
         else if (objtype == EA.ObjectType.otMethod)
         {
            guid = ((EA.Method)obj).MethodGUID.ToString();
            name = ((EA.Method)obj).Name;
            objType = objtype;
            Clipboard.SetDataObject(guid);
            if (confirm)
               MessageBox.Show( "EA MethodGUID\n\n" + guid );
         }
         else
         {
            MessageBox.Show( "Copying this object type is not supported" );
         }
      }
        }
}