Convert Imports

Back Home Up Next

 

 

Convert Imports by Martha Andrews

In Rose 98, it was possible to set the Module Specification property AdditionalImports to generate import statements in a .java file. In Rose 98i, the AdditionalImports property is no longer used.  So, the imports are not added when the .java file is generated. 

This script cycles through all modules in the model and gets the import statements listed in the AdditionalImports property for each. It then creates dependency relations which will resolve to import statements when code is generated. 

Limitations

  • Each class must have a module assigned to it to get the additional imports
  • This script works only for import statements that reference an entire package (i.e. end in '*') 
  • a good enhancement would be to make it work for import statements that reference only 1 class

Instructions

  1. Make a backup copy of  the model that you want to update
  2. Start Rose
  3. Load the model you want to update
  4. Choose Tools|Open Script from the main menu
  5. Choose the  .ebs file from the Open File dialog
  6. Click on the green arrow or select Debugger|Go to run the script

Download (6KB) (May-99)

www.rationalrose.com/scripts/convertImports.ebs


All products mentioned are registered trademarks or trademarks of their respective companies.
Send mail to webmaster@rationalrose.com with questions or comments about this web site. 
Copyright © 1999 Michael Moors
Last modified: December 23, 1999