Author Topic: multiple find & replace in EA  (Read 1742 times)

Damir

  • EA User
  • **
  • Posts: 77
  • Karma: +0/-0
    • View Profile
multiple find & replace in EA
« on: April 15, 2008, 06:58:38 pm »
Problem: large project, stereotypes used extensively; now we've figured some of those stereotypes should be named differently.
Question: what would be the easiest way to do it in EA?

- I couldn't find anything like multiple find & replace
- changing name of the stereotype in UML types dialog box (Settings/UML... menu) doesn't do the trick (we use version control, and yes, packages were checked out)
- manually going through the whole model ain't my cup of coffie, I hope
- I could try find & replace directly in XML files of the versioned packages, but EA says it is not recommended to change these files outside EA (it could leave the model in an unconsistent state)
- haven't found any scripting/macro capability that would enable to run a script which would do that

any suggestions?
thanks

Oliver F.

  • EA User
  • **
  • Posts: 573
  • Karma: +2/-1
  • Arenīt we all in the model business ?
    • View Profile
    • Karl Storz homepage
Re: multiple find & replace in EA
« Reply #1 on: April 15, 2008, 09:44:11 pm »
Quote
- haven't found any scripting/macro capability that would enable to run a script which would do that

TimeArchitect (http://www.timearchitect.net) has the capabilities of modifying multiple items at once (beside being an interesting concept for prject management).

Otherwise you will have to write an addin on your own.

EA seems to reference stereotypes and other attributes by value, not by reference so just changing the name of a stereotype is not reflected in the model.

Oliver
« Last Edit: April 16, 2008, 12:37:07 am by ofels »

Damir

  • EA User
  • **
  • Posts: 77
  • Karma: +0/-0
    • View Profile
Re: multiple find & replace in EA
« Reply #2 on: April 15, 2008, 10:47:36 pm »
Nope,
 I've installed it, you have to have a diagram active and manually select element(s) on which you want to perform the replacement. So NO, it's not a solution. Plus, it doesn't have the support for multiple stereotypes.

Oliver F.

  • EA User
  • **
  • Posts: 573
  • Karma: +2/-1
  • Arenīt we all in the model business ?
    • View Profile
    • Karl Storz homepage
Re: multiple find & replace in EA
« Reply #3 on: April 16, 2008, 12:51:33 am »
Quote
Nope,
 I've installed it, you have to have a diagram active and manually select element(s) on which you want to perform the replacement. So NO, it's not a solution. Plus, it doesn't have the support for multiple stereotypes.

Besides that it does not support multiple stereotypes (which could be a matter of writing an email to Matt Ellis):

- Select your package/root model -> Addins->TimeArchitect->Draw Gatt Chart
- Check "Include child packages"
- Click on "Get Gantt Chart - Element View" and let TA run
- Switch from Gantt to Grid view
- Sort by StereoTypes
- Select all elements of the desired stereotype t once
- Context-Menu->Properties
- Select the new stereotype, click OK

So basically it is working except the multiple stereotypes issue. But as I said, Matt is rather responsive to feature requests.

Oliver

Damir

  • EA User
  • **
  • Posts: 77
  • Karma: +0/-0
    • View Profile
Re: multiple find & replace in EA
« Reply #4 on: April 16, 2008, 03:34:38 pm »
thank you Oliver.
unfortunatelly, I realised another problem with TA: it doesn't seem to have possibility to work with attributes and operations of a given class or classes. My main problem is with stereotypes of attributes and operations, not with the stereotypes of the classes.

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: multiple find & replace in EA
« Reply #5 on: April 16, 2008, 04:54:21 pm »
Damir,

what I would probably do is this:

1. Delete the controlled package containing the wrongly named stereotypes from the model.
2. Rename the stereotypes in the Settings-UML dialog.
3. Replace the stereotype names in the xmi file (via Editor, XSL or whatever). Could be tricky of course if the stereotypes have names occuring in some other context (hopefully your stereotypes don't have names like "content" or "ownedElement").
4. Commit the changes to version control.
5. Reimport the xmi file via GetPackage. If it goes wrong, delete it again, revert to previous version an repeat step 3 and 4.

Of course they discourage fiddling with the xmi files cause they don't want all those support requests saying "I've messed up my xmi, what shall I do?", but it's no problem if you know what you're doing.

Another way would be a RenameStereotypes function in an AddIn. Or a feature request...

Some would rather fiddle with the database. I've never done that, but in your case it may well be the easiest way, probably just a handful of update commands.

Frank

Damir

  • EA User
  • **
  • Posts: 77
  • Karma: +0/-0
    • View Profile
Re: multiple find & replace in EA
« Reply #6 on: April 16, 2008, 06:05:28 pm »
I created a test environment for that, made changes in the xml files, commited the xml files to subversion, made get latest inside EA and I've noticed in Project statistics that Total Elements and Total Connections increased by 1. I have no idea how this could happen.
I think we'll go the old fashioned way  :'(