Book a Demo

Author Topic: Copying Usecase description to Structured editor  (Read 4423 times)

pH

  • EA User
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Copying Usecase description to Structured editor
« on: June 30, 2010, 11:02:55 pm »
Hi,
Is anybody having a script to copy the use case description (EA 7.5) to scenario editor (EA 8.0) ? May I request to the same to be shared?

Thanks,
pH.
<a href="http://webuml.org"><img src="http://webuml.org/images/webuml-badge.png" alt="Set UML Free!" style="border-width:0"></a>

SomersetGraham

  • EA User
  • **
  • Posts: 376
  • Karma: +1/-0
    • View Profile
Re: Copying Usecase description to Structured edit
« Reply #1 on: June 30, 2010, 11:17:48 pm »
Hi pH
Where is your scenario tect entered under V7
If you have the text under the Scenario tab it will appear in the Scenario description under V8 in which case you can select all of the text, right click and ceate the structured sceanrio

HTH

Graham
Using V12

pH

  • EA User
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Re: Copying Usecase description to Structured edit
« Reply #2 on: July 01, 2010, 05:32:30 pm »
Hi Graham,
Thanks. I knew that option. But doing that for each and every use case across the projects is time consuming and waste of time.

If a script would do that it would be great.
I just did a prototype using the below code and it seems to work. I plan to refine it so that it loops through packages and updates for all use cases. My hope was, some body would have already tried this and I can just reuse it :)


Code: [Select]
function main()
{
      // TODO: Enter script code here!
      var  theModel as EA.Package;
      theModel = Repository.Models.GetAt(0);
      var fPkg as EA.Package;
      fPkg = theModel.Packages.GetAt(1);
      
      var elem as EA.Element;
      elem = fPkg.Elements.GetAt(0);
      Session.Output(elem.Name);
      var scenario as EA.Scenario;
      scenario = elem.Scenarios.GetAt(0);
      description = scenario.Notes;
    
      word=description.split("\n");
      
      var step as EA.ScenarioStep;
      for(i=0;i<word.length;i++)
      {
      if(i<word.length-1)
            word[i] = word[i].substr(0,word[i].length-1);
      step = scenario.Steps.AddNew(word[i],"");      
      var status = step.Update();
      scenario.Update();
      elem.Update();
      }
}

Thanks,
pH
<a href="http://webuml.org"><img src="http://webuml.org/images/webuml-badge.png" alt="Set UML Free!" style="border-width:0"></a>

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Copying Usecase description to Structured edit
« Reply #3 on: February 03, 2011, 03:51:26 am »
Why isn't Sparx providing an appropriate mechanism? It looks like I have to face the same problem for the coming upgrade.

q.