Subversion Repositories DevTools

Rev

Blame | Last modification | View Log | RSS feed

using System;
using System.Collections;

namespace EA_ReqPro
{
        /// <summary>
        /// Summary description for EA_ProjectBrowser.
        /// </summary>
        public class EA_ProjectBrowser
        {
                public EA_ProjectBrowser()
                {
                }

      public static EA.Element get_selected_element(ArrayList allowedElementTypes)
      {
         object o;
         EA.ObjectType type;

         type = Main.EA_Repository.GetTreeSelectedItem(out o);
         if (type == EA.ObjectType.otElement)
         {
            if (allowedElementTypes == null)
               return (EA.Element)o;

            if (allowedElementTypes.Contains( ((EA.Element)o).Type ))
               return (EA.Element)o;
         }
         return null;
      }

      public static EA.Package get_selected_package()
      {
         object o;
         EA.ObjectType type;

         type = Main.EA_Repository.GetTreeSelectedItem(out o);
         if (type == EA.ObjectType.otElement)
         {
            return Main.EA_Repository.GetPackageByID(((EA.Element)o).PackageID);
         }
         else if (type == EA.ObjectType.otDiagram)
         {
            return Main.EA_Repository.GetPackageByID(((EA.Diagram)o).PackageID);
         }
         else if (type == EA.ObjectType.otPackage)
         {
            return (EA.Package)o;
         }
         return null;
      }
        }
}