
Use a Message shape (a solid line) to represent a request or the transmitting of information. The connections points disappear when you are done dragging.Īttach the beginning endpoint to the lifeline sending the message, then drag the head endpoint to the lifeline receiving the message.ĭouble-click the message shape to create a text box, and type a name for the message. A green circle appears at the endpoint when it glues to a connection point. Visio helps you glue the message endpoints to each lifeline. Use an Actor lifeline shape for each participant, and an Object lifeline shape for each system component in your process. To rename text labels, double-click the labels. Now, drag shapes you want to include in your diagram from the Shapes window to the page. This option makes connection points appear when you start connecting shapes. On the View tab, make sure the check box next to Connection Points is selected. If you still don’t see it, click the Expand the Shapes window button on the left. If you don’t see it, go to View > Task Panes and make sure that Shapes is selected. You should see the Shapes window next to the diagram. (A description of each one is shown on the right when you select it.) Then select either Metric Units or US Units. In the dialog box, select the blank template or one of the three starter diagrams. Or if you have a file open already, click File > New. Drag shapes from the stencil onto the drawing canvas to build the diagram. You might want to look at ASM if you don't like BCEL.To build a sequence diagram, use a UML Sequence template or starter diagram, which includes the UML Sequence stencil. If you don't want to read source, suck in a jar or class file and go to town. I also use it at work for email templates. StringTemplate is pretty nice for generating source code.

Starting with a good parser/grammar to read source is nice. I suggest you do some reading if you want to generate diagrams from source without resulting in a jumbled mess. Much has been written on laying out diagrams. This might not be applicable since you seem to want to do the diagramming portion yourself. It's much easier to import/export the underlying information for UML diagrams than to lay them out yourself. The UML XMI stuff from OMG has been helpful to me.

I use UML diagrams, but I use an xml serialized form. This will also help with variable names for unlabelled relationships between classes (pluralization gives you List foos and stuff like that). I suggest googling for Inflector.java and choosing an appropriate implementation.
#ONLINE SEQUENCE DIAGRAM GENERATOR JAVA CODE#
I have some experience with code generation, significantly less with diagramming.

I don't know enough about most (any?) of them to comment further on them though (I did use GraphViz once, but so long ago that I don't remember much, and what little I might remember is probably obsolete anyway). There are, as you'd expect, lots of alternatives to that as well. If you have some funds available, I've heard good things about yFiles for Java (I should also mention that the same company's yWorks UML Doclet is supposed to do nearly what you're talking about, but from JavaDac comments rather than the source itself). Once you've collected the information, it becomes mostly a matter of drawing a nicely formatted result. So, the basic idea would be to create your tree visitor, walk the tree, and collect information about the ClassTree objects you find. At least from the looks of things, the part you'll care the most about will be the ClassTree interface. I believe you should be able to collect most (all?) the information you need by walking the AST with the compiler tree API. Second point: the fact that the Java environment makes the Java compiler directly available will help a lot in implementing this.
