Book a Demo

Author Topic: Trying to Import Java into Class Diagrams  (Read 6941 times)

tomkalafut

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Trying to Import Java into Class Diagrams
« on: April 04, 2007, 09:53:52 am »
The import process seems to go well, but nothing shows up in my class diagram.  What gives?  I'm following the instructions to the letter... right-click on diagram background, select Import Source and the correct source type (Java), then choose your files and go. This is all under the Design Model.

What am I screwing up?

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Trying to Import Java into Class Diagrams
« Reply #1 on: April 05, 2007, 01:35:34 am »
There is an option someplace to create the objects, or create both the objects and the diagrams. Packages figure someplace in there as well. I don't have a Java model handy to refer to.

In the meantime, does the import populate the Project Browser view?
No, you can't have it!

tomkalafut

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Trying to Import Java into Class Diagrams
« Reply #2 on: April 05, 2007, 06:40:40 am »
Quote
There is an option someplace to create the objects, or create both the objects and the diagrams. Packages figure someplace in there as well. I don't have a Java model handy to refer to.


Thanks. I will try to find it. No luck at first glance.


Quote
In the meantime, does the import populate the Project Browser view?


1 of the 10 times I tried, the classes showed up in the Project Browser.  Not sure why.  I thought I had done it slightly different that one time.  Or maybe they've been overwritten every time since.

tomkalafut

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Trying to Import Java into Class Diagrams
« Reply #3 on: April 05, 2007, 08:16:15 am »
Hmmmmm.  For some reason, now it works.  The only thing I did was delete the classes that were imported into a subfolder and then retry from the diagram background.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Trying to Import Java into Class Diagrams
« Reply #4 on: April 05, 2007, 09:44:59 am »
Yeah, sounds right. In another thread I just advised making absolutely sure that the target package is highlighted in the Project Browser before trying the import. For some reason EA sometimes makes some other location current when you start the import process. Doing this from a diagram should force the owning package to be the current location for the import.
No, you can't have it!

tomkalafut

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Trying to Import Java into Class Diagrams
« Reply #5 on: April 05, 2007, 11:42:31 am »
Arrrrgh. It only worked that 1 time for me. No matter what I do, I can't import into different packages.

tomkalafut

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Trying to Import Java into Class Diagrams
« Reply #6 on: April 05, 2007, 12:49:42 pm »
Ok. WTF?

With my Class Diagram highlighted in the Project Browser, in the Class Diagram background I right-clicked and did a Create Element or Connector --> Class, just to try to get an empty class there (and then try Import).  And EA creates a Class1 with all the atts and rels from one of my classes in a different package.  What the heck is going on?

tomkalafut

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Trying to Import Java into Class Diagrams
« Reply #7 on: April 06, 2007, 07:40:11 am »
I'm getting a lot farther now.  Some useful info:

It really helped when I deleted the original (empty) class diagram from the package and then re-added it with its default name (e.g. com.mycompany.myproduct.mypackage). Then when I did a Project-->Source Code Eng-->Import Source Files from the menu, EA added the classes into the Project Browser and their diagram info into the new diagram.

Import Source Directory works differently.  EA added my source files into a new folder structure underneath my package folder (e.g. com/mycompany/myproduct/mypackage/mysubpackage).  EA also created a diagram called mypackage in the mypackage folder that included just the classes in that package/directory.  EA also created a diagram called mysubpackage in the mysubpackage folder with just that subpackage/subdirectory's classes.  If this is what you want, then beware that after creating each class diagram (1 for each package), EA closed them.  Don't worry, they're still there.  Just find them in the Project Browser.

So finally, if I wanted both a package and its subpackage in a single class diagram with relationships between classes across the packages (e.g. com/mycompany/myproduct/service/impl), here's what I did: I imported all the service files into the new com.mycompany.myproduct.service diagram.  Then I imported all the impl files into the same diagram.  EA resolved the inter-package relationships just fine.

tomkalafut

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Trying to Import Java into Class Diagrams
« Reply #8 on: April 06, 2007, 10:20:12 am »
Alas, one more kludge to note: Simply Importing Source Files would work not for a new class diagram in a new folder.  I first had to Import a Source Directory, then afterwards, delete its root folder ('com'), in essence undoing the entire Import :-/

I'm not sure why this works.  Maybe the net effect is that EA now thinks it's OK to import the classes I just deleted :P

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Trying to Import Java into Class Diagrams
« Reply #9 on: April 07, 2007, 04:36:12 am »
Perhaps (really really perhaps) this is sensitive to namespace root settings in EA.
No, you can't have it!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Trying to Import Java into Class Diagrams
« Reply #10 on: April 09, 2007, 01:09:14 pm »
I'm not exactly sure what's going on for you.  It could be that the classes already exist somewhere in the model and EA is synchronizing with them instead of adding them a second time.  Actually, this would explain all of the behaviour that you have described.

The Import Source Directory (package per namespace) moves classes into the package created if they were already in another package in the model.  As a result, deleting the package that creates deletes the classes that were somewhere else in the model before the import.

Importing onto a diagram synchronizes the class in its existing location and doesn't add the class to the other diagram.

Mette

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: Trying to Import Java into Class Diagrams
« Reply #11 on: April 12, 2007, 08:25:44 am »
I am having a similar problem. I want to import a source directory with java files and produce uml form this. But the option to import source directory this is always grayed out.

If I open a source file, it sometimes shows up as uneditable code. That is, I can edit. But the changes as not really saved. But files still doesn't populate the Project Browser view. Does anyone have any idea what I am doing wrong?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Trying to Import Java into Class Diagrams
« Reply #12 on: April 12, 2007, 12:55:12 pm »
Make sure that the package currently selected in the tree is not a root node, and that you have either the Professional or Corporate edition (Help | About).

Edit: Also, make sure that if security is enabled on the model (Corporate edition) you have the relevant permissions.  Similar for options requiring lock to edit and version control.
« Last Edit: April 12, 2007, 12:56:46 pm by simonm »