Book a Demo

Author Topic: Code generation with "import" clause in Java sourc  (Read 2896 times)

Pimenta

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Code generation with "import" clause in Java sourc
« on: September 17, 2008, 10:24:06 pm »
Hi.

I have imported a jar (rt.jar) file into my Java project, with success.
Then, I started creating a Java class with the FileFilter atribute. In java we have 2 FileFilter classes: from java.io and from java.swing.filechooser. When the Enterprise Architect displays the list of attribute's data type, I can see the two FileFilter. So, I suppose one is from java.io and the other is from java.swing.filechooser.

How can I configure the Enterprise Architect for showing me the types with its package definitions (with java.io or java.swing.filechooser, etc)?

And most important: How can I generate Java source code containing the "import java.io" clause, for example? My generated code never contains the imports.

Any hint will be very helpful!

Thanks.

Rodrigo
Brazil.

Nizam Mohamed

  • EA User
  • **
  • Posts: 193
  • Karma: +1/-0
    • View Profile
Re: Code generation with "import" clause in Java s
« Reply #1 on: September 23, 2008, 02:35:38 pm »
1. Attributes' data type: Please set Diagram's properties -> Features -> Show Attribute Detail to be "Name and Type".

2. Java Imports: EA generates import statements only for those classes that are associated with the concerned Class. So Unfortunately any other imports would be ignored.

Note: you can force import statements to be generated using the Import(s) / Header(s) text boxes available in the "Generate Code" dialog

Hope this helps