facebook

generate UML class diagrams from java source

  1. MyEclipse Archived
  2.  > 
  3. UML Development
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #239834 Reply

    john
    Member

    I followed the documented procedure for generating class diagrams from existing java source.
    But there is a problem.

    * Here’s what worked:
    I got the UML perspective to perform its generation of class diagrams (checked the “class diagrams” option).
    It reported generating 157 class diagrams from my source files. (sounds good.)

    * Here’s what happened:
    No class symbols (nothing) appears in the UMR area. Its blank.
    I cannot find anywhere to bring up the generated class diagrams.

    * Here’s what the documentation SEEMS TO IMPLY about generating UML diagrams at that point (I hope I’m wrong; please tell me).

    Restriction 1. After generating class diagrams from source, it is necessary to manually drag and drop each class (from the java source icon) to the UMR area, and manually draw all the associations, their multiplicity, inheritance arrows, and so forth. I verified that this functionality works, and that no such structures were automatically generated when I dropped related classes in the UMR panel.

    Restriction 2. It is necessary to manually create each package symbol corresponding to your java hierarchy, and there is no particular relationship between it and your folders and their contents.

    Restriction 3. There is no way for eclipse to automatically generate a proper UML class diagram WITH ALL OF THE CLASSES in a given package, and with all the associations and inheritance arrows. You have to do this manually as in Restriction 1, as far as I can see from the documentation.

    Restriction 4. If you draw associations and inheritance arrows manually, they are “just pictures” with no particular relationship to the properties and “extends/implements” in the class. No java properties are created or affected for you when you create or rename an association.

    * Here’s what I was expecting:
    I expected Eclipse to generate a separate class diagram corresponding to each of my four packages, and generate class symbols for all classes in each package along with all association (etc.) lines corresponding to properties. This is what I get from Borland Together, leaving only the manual prettying up of the class symbols for aesthetics.

    I have 157 classes. It would be cost-prohibitive for me to manually pick and place each one and so forth, and then I wouldn’t even have a diagram that I can be sure has all of its associations right.

    Please let me know if any of the 4 Restriction statements I made are wrong and if so where to find the documentation. Sorry this message was long.

    My environment:
    Operating System and version: XP/sp2
    Eclipse version: 3.1.0
    Eclipse build id: I20050627-1435
    Fresh Eclipse install (y/n): Y
    Other installed external plugins: just those added for Add Hibernate Capabilities
    Number of plugins in the <eclipse/plugins directory that begin with org.eclipse.pde.*: 4
    MyEclipse version: 4.0.0 according to Configuration Details.
    JDK version: 1.5.0_04 (j2sdk5.0)
    Application Server JDK version: n/a I am not using an Application Server with eclipse on this platform

    #239857 Reply

    Riyad Kalla
    Member

    * Here’s what happened:
    No class symbols (nothing) appears in the UMR area. Its blank.
    I cannot find anywhere to bring up the generated class diagrams.

    John, if you look in the right hand outline view, can you double click the class diagram to open it up? Try closing all the editors and then opening it up, additionally try usign the autolayout incase it positioned them far out of your view.

    #239897 Reply

    support-michael
    Keymaster

    Hi John,

    From your conclusions it sounds like you may have a problem with a rev-eng session. MyUml rev-eng features are much more comprehensive than what you have stated. Here’s what you should expect using the MyUML rev-eng process (UML>Rev-eng UML From Java) to produce based for your project of 157 classes in 4 packages (note I just tested these features on a project of similar size):

    1) 4 class diagrams should have been created with the name of you each package and ‘_’ replacing the ‘.’ in the package name. Did you open the Outline View (Windows>Show View>Outline or Windows>Show View>Basic>Outline) and verify that these diagrams were not created. If these diagrams were not created then check your Eclipse error log for a possible problem. Note that MyUML rev-eng of Java5 language features will not be available until ME 4.1 (this Dec).

    2) If the rev-eng preference to create association is checked (page-2 of rev-eng wizard) then associations are automatically created during the process.

    3) In the outline view, select the package filter and you should see nested packages and classes that parallel your Java source.

    4) All model elements have UML semantics. That is, they are much more than graphical figures.

    I hope this helps.

    Regards,

    #239900 Reply

    john
    Member

    @support-rkalla wrote:

    …look in the right hand outline view …

    rkalla,

    Thank you, this is progress. But there is still a problem.
    Only 12 of the 47 classes in my main subpackage appear as class symbols on the generated class diagram with a name corresponding to that package (e.g. myPkg_classes). Some of the necessary association and inheritance lines are present.
    Only 11 of 18 classes in my top-level package apparea in the generated class diagram for that package. AND! the outline view only has 9 of the 11 classes.
    These classes are not remarkable: some simple classes, some interfaces, some inhereit from other things, etc. None of the class symbols have association or inheritance lines. But a spot-check indicates that the methods, constructors, and properties are all shown in the class symbols that are present.

    I have verified that all the classes compile and execute. I zoomed out, as you suggested, to make sure the diagram is fully visible (a phenomenon I’m familiar with from various other IDEs).

    Footnote about steps leading up to this progress:
    Before doing the generation again, I verified that nothing was actually generated the first time.
    Then, I tried to generate again. At first, the UML menu was grayed out, so there was no way to do it again. But it suddenly activated for no apparent reason. I guess my 1.8Mhz machine is too slow.

    Anyway, now that I’ve established that SOMETIMES incorrect (incomplete) class diagrams can be generated, with no indication that they are incomplete except by careful manual verification, I will be very cautous about using this capability for work. Thanks for your help.

    #239901 Reply

    john
    Member

    By the way, the Outline View was not initially present in my UML Perspective, so I went to the “outline”-structured Package Explorer panel that was present. Thanks to your suggestion, I found the explicit activation of the Outline View panel in the Window menu.

    #239965 Reply

    support-michael
    Keymaster

    I’m interested in more information to isolate and resolve the behavior you are experience:

    Q: do any of the missing classes use Java5 language features?
    You mentioned nothing special about the missing classes but you didn’t clarify if Java5 features are employed.

    Q: are inner classes involved?

    Q: can you share this project with me to see if I can replicate the problem? Note: our support team keep all such coorespondence confidential and destroys it once we have isolated the problem.

    Re: outline view:

    By the way, the Outline View was not initially present in my UML Perspective, so I went to the “outline”-structured Package Explorer panel that was present. Thanks to your suggestion, I found the explicit activation of the Outline View panel in the Window menu.

    The outline view is displayed as part of the default MyEclipse UML Perspective layout. You can open this perspective as follows: Windows>Open Perspective>Other>MyEclipse UML Perspective. As an alternative to manually opening the Outline view select the “Windows>Reset Perspective” action.

    Regards,

    #241995 Reply

    matthewlai
    Member

    I was trying to reverse enginer UML from java using myEclipse 4.1M plugin, but unsuccessful.

    it complains that \”a string is out of range\”. Is that because this is only a milestone versino, but not the final ersion?

    For your information, I was trying to convert code to sequence/class diagrams for a project that contains over 20000 classes. Is that a problem?

    myeclipse would be a fantastic tool to have if I can use it to reverse engineer the entire project to sequence diagram.

    THanks.

    #242004 Reply

    Kapil Kapre
    Member

    matthew,
    Do you get the “string out of range” error on any particular java file? If so can you try reverse engineering just that one file and see if it works? Also is your code using any java 5 syntax?

    #242731 Reply

    bhiles
    Member

    I’m having a situation where it I’m using Java5 syntax and the calsses are not showing up. I’m using the automatic casting feature of primitaves in the classes.

    #242732 Reply

    Riyad Kalla
    Member

    bhiles, Java5 is not supported yet, it is comming soon.

    #243675 Reply

    HI
    Its Rajesh,here i have a problem in Reverse Engg,i have been trying to generate Class Diagram from Java Source Packages.For this I’m using Eclipse3.1 and I installed the UML Plugin,I need to know the steps to

    
     
    Can you please post all the information we request in the [URL=http://www.myeclipseide.com/PNphpBB2+file-viewtopic-t-393.html]Posting Guidelines[/URL] thread at the top of this forum? That will give us some context so that we can determine if this is an installation issue, a configuration problem, or a bug.  Thanks.
     generate it.
    #243676 Reply

    Brian Fernandes
    Moderator

    Rajesh,

    Have you installed MyEclipse? If so, which version are you using?

    To reverse engineer a set of classes, simply select them in the Package Explorer and drag them into your UML Class diagram.
    If you want to reverse engineer a larger collection of clases, we recommend using the UML > Reverse Engineer UML from Java… option which you see when you have our UML editor active.

    Detailed instructions here (in your MyEclipse installtion): Help > Help Contents > MyEclipse Application Developer User Guide > Getting Started > UML.

    Best,
    Brian.

Viewing 12 posts - 1 through 12 (of 12 total)
Reply To: generate UML class diagrams from java source

You must be logged in to post in the forum log in