| Author |
Message |
|
2007/02/28 21:43
|
|
|
Jacenty
Joined: 2006/11/09
Messages: 73
Offline
|
|
|
|
Hello,
There is a possibility to iterate over all model items, but I affraid it can be quite inefficient for larger projects.
It would be nice to be able to choose element type to iterate, e.g.:
IProject project = ApplicationManager.instance().getProjectManager().getProject();
Iterator it = .modelElementIterator(IModelElementFactory.MODEL_TYPE_CLASS);
while(it.hasNext()) {
IClass cl = (IClass)it.next();
// do something
}
|
Best regards,
Jacek
|
|
|
|
 |
| |
|
2007/03/08 20:05
|
|
|
Jacenty
Joined: 2006/11/09
Messages: 73
Offline
|
|
|
|
Wow,
You've added it in SP1!
Great job, thank You!
Jacek
|
|
|
|
 |
| |
|
2007/03/10 16:44
|
|
|
Jick
Joined: 2005/04/29
Messages: 2881
Offline
|
|
|
|
Hello Jacek,
Oh, you are faster than me! I just wanted to show you the added methods and provide you with a sample. Anyway, I still post the information about this change in case you may have missed part of it.
Here are the added method calls:
IProject.
modelElementIterator(String modelType)
modelElementIterator(String[] modelTypes)
toModelElementArray(String modelType)
toModelElementArray(String[] modelTypes)
|
Attached is a sample for you. To use it, follow the usual procedure for installing a plugin. From the application, select Edit > Show Models from the main menu. Then, enter the model type, the search result of model with the specified type will be printed in the message pane.
Note:
This method only work for root models. For models like attribute, operations, parameters, database columns, you cannot retrieve them by iterator.
Enjoy.
Best regards,
Jick
| Description |
|
Download
|
| Filesize |
7 kb
|
| Downloaded: |
163 time(s) |
|
Visual Paradigm International Ltd.
http://www.visual-paradigm.com
Build Quality Applications Faster, Better and Cheaper |
|
|
|
 |
| |
|
2008/01/25 19:32
|
|
|
Herbie van Tetering
Joined: 2008/01/08
Messages: 4
Location: Herbie van Tetering
Offline
|
|
|
|
Dear Sir,
Your previous post mentions that for models like attribute, operations, parameters, database columns, you cannot retrieve them by iterator. I was wondering if there is any other way to sequentially retrieve attributes, operations and other united modeling language elements.
How can I, for example, identify the model element types associated to any model and then retrieve information, like attributes and operations only from those types in the model? Is there, for example, a null value associated to element types not present in the model?
I may be asking the same question therefore I list the details on what I would like to know below.
* can the api retrieve attributes and operations from diagrams?
* does the api retrieve elements across all uml diagrams?
* does the api support integration of the visual modeler?
Thank you in advance,
ing. E.H.A. van Tetering
|
|
|
|
 |
| |
|
2008/01/27 18:51
|
|
|
Rain
Joined: 2005/04/29
Messages: 736
Offline
|
|
|
|
Hello Herbie,
Some of the items are not supported to get by iterator directly from the top level. Since attributes and operations are child of class, and parameters are child of operation, and database columns are child of entity, they only can be retrieved from the get iterator methods from parent.
So for your questions:
- can the api retrieve attributes and operations from diagrams?
Yes, you have to get all classes from the diagram then retrieve the attributes/operations one by one
- does the api retrieve elements across all uml diagrams?
We support retrieve elements in diagram based or directly from model repository (not consider they are in which diagram)
- does the api support integration of the visual modeler?
No, our Opan API only support accessing the project models. But since it is in Java, you can play around with it and see what you can do.
Hope this helps.
Best regards,
Rain Wong
|
|
|
|
 |
| |
|
2008/07/19 00:02
|
|
|
|
|
|
 |
| |