Book a Demo

Author Topic: EA_GetCompartmentData & EA_QueryAvailableCompartme  (Read 3048 times)

PragaKhan

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
EA_GetCompartmentData & EA_QueryAvailableCompartme
« on: January 13, 2011, 12:28:35 am »
Hi,

I am trying to add a custom compartment in c# using Visual C# 2008 Express Edition and I can add the compartment but don't succeed at showing any info in it, the compartment shows up empty. What do I do wrong ?

The source code:

        public object EA_QueryAvailableCompartments(EA.Repository repository)
        {
            //Just define one additional Compartment named "Classifier Notes"
            return "EA data,first,second,third";
        }

        public object EA_GetCompartmentData(EA.Repository repository, string sCompartment, string sGUID, EA.ObjectType oType)
        {
            StringWriter data = new StringWriter();
            string compartmentName = sCompartment;

            //Handle the custom "Classifier Notes" compartment
            if (sCompartment.CompareTo("EA data") == 0) {
                //Get the current element
                EA.Element e = repository.GetElementByGuid(sGUID);
                //Construct text
                data.Write("TESTING");
            } {
                  data.Write("========");
            }
            
            //If data has been defined for this Compartment, return it to EA to be rendered.
            if (data.ToString().Length > 0)
            {
                StringWriter s = new StringWriter();
                s.Write("Name=" + compartmentName + ";");
                s.Write("CompartmentData=" + data.ToString() + ";");

                return s.ToString();
            }
          return null;
        }

PragaKhan

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: EA_GetCompartmentData & EA_QueryAvailableCompa
« Reply #1 on: January 13, 2011, 10:23:21 pm »
Never mind, I should have respected the actual text format (Data, Guid...) and not strip it away so brutally  :)