Click here to Skip to main content
15,912,897 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I need to create a Simple Class Diagram Editor in java. The input to this editor is a java file. I have already seen many UML class diagram generators. How can I create such an editor? I don't know where to start?
Posted
Comments
[no name] 12-Mar-13 12:44pm    
Learn to write programs in Java would be a good place to start.
Member 9904978 12-Mar-13 14:05pm    
Sorry! I thought, there would be something related to java graphics or something else to create a graphical class diagram editor. I wonder, when I'm using a UML class diagram generator, what component actually a class diagram is? When we are clicking a New -> Class, automatically a rectangle appears with a class name. And if we are adding a method to this class, he code will also be appeared there. If I'm extending the properties of any other class, this is diagrammatically represented as an arrow. All these objects, that is a class diagram, this implementation relation, or anything else that is present in the editor is dynamic (we can move this objects into any part of the editor window where we want). How all these can be done? That was the question I'm trying to ask.
Richard MacCutchan 12-Mar-13 14:02pm    
This is hardly a trivial task. The first thing you need to do is write the code that can parse the Java file and break it down into its components.
Member 9904978 12-Mar-13 14:04pm    
I have heard about parsing. How can I parse a java code? Any examples?
Richard MacCutchan 12-Mar-13 14:07pm    
Try doing a bit of research for yourself; there are plenty of samples to be found by Google.

1 solution

Steps :
1. Use Reflection to read the properties & behaviour of the class.
2. Store the data in some tempstorage(like, map or list)
3. Create a class which can able to create different types UML diagram.
4. Create an Editor class which is responsible to draw the diagram.
5. Iterate the list and pick the data and pass it to Editor class.

These are overall steps , but there are lots of thing you have to do.Before start draw a framework to use.
 
Share this answer
 
Comments
Rai Pawan 13-Mar-13 3:38am    
5 for clearly identifying a process - Pawan
Member 9904978 14-Mar-13 11:15am    
Thanks!!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900