View previous topic :: View next topic |
Author |
Message |
gagant
Joined: 10 Oct 2003
Posts: 3
|
Posted: Mon Jan 19, 2004 12:18 am Post subject: drawing class diagram programmatically
|
|
|
Hi all,
I have 4 questions:
1) How can I draw classes and associations between them programmatically on EclipseUML Class diagram editor. OpenAPI sample does not provide any leads on this. A sample code will be very helpful.
2) I am running into a problem while trying to get EReferenceImpl object from class diagram editor (using OpenAPI code)
IModelObject editModel = (IModelObject) objects[i]; // objects[i] is the currently selected object on the editor## assume only one object is selected
EModelElementImpl eobject = (EModelElementImpl) editModel.getModelObject();
The above code runs fine when I select a Class on the Class diagram editor.
But when I do something like this :
IModelAssociation editModel = (IModelAssociation) objects[i];
EReferenceImpl eref = (EReferenceImpl) editModel.getModelObject();
It throws a class cast exception. editModel.getModelObject() type is not EreferenceImpl type. It is of some com.omondo.uml.editors.edit.c.bn type which I dont know what it is. Please tell me how can I get handle on the EMF associations and generalizations objects. A sample code will be helpful
3) Is there a way in which the class diagram editor bares all the objects on its class diagram as a collection of model objects? A sample code will be helpful
4) Is there any way I could have access to EclipseUML API and a descriptive documentation?
Thankyou
Gagan Tandon
|
|
Back to top |
|
|
julien
Site Admin
Joined: 16 Mar 2003
Posts: 165
|
Posted: Mon Jan 19, 2004 2:56 pm Post subject: Re: drawing class diagram programmatically
|
|
|
gagant wrote: |
Hi all,
I have 4 questions:
1) How can I draw classes and associations between them programmatically on EclipseUML Class diagram editor. OpenAPI sample does not provide any leads on this. A sample code will be very helpful.
2) I am running into a problem while trying to get EReferenceImpl object from class diagram editor (using OpenAPI code)
IModelObject editModel = (IModelObject) objects[i]; // objects[i] is the currently selected object on the editor## assume only one object is selected
EModelElementImpl eobject = (EModelElementImpl) editModel.getModelObject();
The above code runs fine when I select a Class on the Class diagram editor.
But when I do something like this :
IModelAssociation editModel = (IModelAssociation) objects[i];
EReferenceImpl eref = (EReferenceImpl) editModel.getModelObject();
It throws a class cast exception. editModel.getModelObject() type is not EreferenceImpl type. It is of some com.omondo.uml.editors.edit.c.bn type which I dont know what it is. Please tell me how can I get handle on the EMF associations and generalizations objects. A sample code will be helpful
3) Is there a way in which the class diagram editor bares all the objects on its class diagram as a collection of model objects? A sample code will be helpful
4) Is there any way I could have access to EclipseUML API and a descriptive documentation?
Thankyou
Gagan Tandon |
>1).
Right now, it is not possible. We have an action to publish as many as possible our APIS. But the schedule isn't fixed.
>2).
This could be a bug. We'll check it out.
>3).
Once you get a EMF model object you can call EMF API to navigate in EMF model such "eContainer" getContentes(). Typically, you select the diagram extension, you will get a EMF Package and then you call getContents() to retrieve its children.
julien
omondo
|
|
Back to top |
|
|
|