Read Eclipse uml file in a standalone app [message #1837517] |
Mon, 01 February 2021 08:57  |
Eclipse User |
|
|
|
I would like to programmatically open a .uml file (created by Papyrus) and extract information from the file (such as the presence of certain UML elements, their parent relationships, ...).
I also would like to do this in a standalone project, i.e. without the additional complexities of an Eclipse plug-in, if possible. Preferably with Maven, but if not possible (as suggested here), manually downloading some jar files and adding them to my classpath would be fine.
I only found old (4+ years old) tutorials on the web, which seem to suggest that one has to manually open Eclipse internals and hand pick a few jars from there (example here), hoping that the right ones will be included. Is there some easier or at least more officially supported way of proceeding?
|
|
|
|
|
|
Re: Read Eclipse uml file in a standalone app [message #1838420 is a reply to message #1837630] |
Wed, 24 February 2021 10:36   |
Eclipse User |
|
|
|
Thank you for your warning about easiness of parsing a UML file. I am not sure I understand, however. As I understand, UML models and diagrams are supposedly defined in XML files. I realize that UML models compatibility is only a dream, with vendors implementations having subtle incompatible variations; but I thought that Eclipse would nevertheless store every UML related data in XML files. Indeed, opening a .uml file created with Papyrus reveals the following header.
<?xml version="1.0" encoding="UTF-8"?><uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" ...
It is my understanding that stereotypes are also saved in .uml files. Is this mistaken?
In any case, yes, I only have to deal (currently) with UML models with no extra stereotypes. But indeed, it would be nice to benefit from the power of a specific library to parse such models.
About your second point, I think, perhaps erroneously, that transforming my program into an Eclipse plugin will require to have a specific startup and distribution procedures (instead of distributing my program, as I am used to, with a starter script and .jar files for the dependencies). In other words, it will require Eclipse to "own" the startup process. In this case, the problem is not mainly that I have to spend "an hour or two" to learn the process! Is this mistaken?
|
|
|
|
Re: Read Eclipse uml file in a standalone app [message #1838758 is a reply to message #1838424] |
Thu, 04 March 2021 10:42   |
Eclipse User |
|
|
|
Ed Willink wrote on Wed, 24 February 2021 12:46
I wrote that UML does not use standard XML, not that it does not use XML.
What difference do you see between standard XML and XML? As I understand words, XML is a standard.
Ed Willink wrote on Wed, 24 February 2021 12:46
You are mistaken. You will not need any special start up or distribution procedures. Formulating your code as a plugin facilttes its use within Eclipse, but at worst gives you a couple of small files of bloat for other purposes.
I am sorry for one more possibly naïve question, but I couldn't find doc about how to use an Eclipse plug-in in a standalone application, as I would like to do. I only find resources about how to write plug-ins (that possibly use other plug-ins) aiming at distributing them as Eclipse plug-ins, thus, using Eclipse start-up and distribution procedure (implying, among others, distributing the app as an RCP product). Such as this Vogella tutorial or the corresponding entry in Eclipse Help (which seems quite outdated).
Do you have some documentation suggestion for my use case?
|
|
|
|
Re: Read Eclipse uml file in a standalone app [message #1842245 is a reply to message #1842220] |
Mon, 14 June 2021 06:18   |
Eclipse User |
|
|
|
Thank you for providing help!
As I understand it, this requires to collect and maintain dependencies (ids and versions) "manually" from Eclipse files, in order to define the right dependencies in the pom.xml file. With the drawback, as warned here, that this may be quite tedious and is not automated.
It seems, from the discussion here, that it is possible to do otherwise, while keeping the application as a "normal" standalone application (as opposed to an Eclipse plug-in that requires Eclipse to own the launch process) but I absolutely ignore how, and in fact, doubt it is really possible. Any supplementary information about this would be most welcome.
|
|
|
|
|
Re: Read Eclipse uml file in a standalone app [message #1843896 is a reply to message #1842406] |
Mon, 23 August 2021 10:20   |
Eclipse User |
|
|
|
Thanks again for the help.
It appears that managing dependencies automatically in a non Eclipse application is a difficult task. (I realize it can be eased by making first an Eclipse plugin project, for the sake of collecting dependencies, and running it again when they change and then reflect that manually in whatever dependency management system one uses, but that is not easy, compared to just adding a bunch of coordinates of a library you want to depend on in some configuration file, as Maven users expect.)
That task would be much alleviated if this Eclipse sub-project would comply with a de facto standard that by now probably more than 90% of Java developers use, namely, the Maven way; rather than trying to impose its own plugin mechanism that only the Eclipse developers use. The funny thing is that even the Eclipse ecosystem itself recognized (years ago) Maven as a de-facto standard and started releasing its artifacts as Maven plugins; and published guides to help other Eclipse projects proceed similarly.
Imagine if every enterprise developing Java libraries would invent its own management system, incompatible with others? This is precisely what standards try to avoid. And, IMHO, open-source developers (even more than other ones) should encompass standards.
I hope some serious considerations can be devoted again to publishing the artifacts related to Papyrus as Maven dependencies.
|
|
|
|
Re: Read Eclipse uml file in a standalone app [message #1844099 is a reply to message #1843903] |
Wed, 01 September 2021 06:07   |
Eclipse User |
|
|
|
Thanks again for your attention. I thought the OCL project was not interested at all in Maven publication, not that it had tried but had faced difficulties.
When suggesting in my previous post that Eclipse embraces Maven, I meant it in the sense that at least some (I think, many) of its projects do release on Maven Central in an apparently automated and systematic way, e.g., SWT.
I have quickly skimmed over some discussions starting from the bug that you just mentioned. I may be missing something, but it seems to me that you are trying to publish to a Maven repository specific to Eclipse, whereas perhaps it would be simpler (and certainly more convenient for Maven users) to publish to Maven Central directly. Perhaps then the relevant documentation is Platform-releng/Publish To Maven Central?
I have unfortunately no time to really help you in that endeavor: not knowing the Eclipse publication ecosystem at all, it would require some important time investment that I do not currently have. But I can answer some specific questions related to the way Maven works, or provide pointers, if you are (or anyone is) interested. Perhaps these resources can be of help, in particular, the document about releasing to Maven Central.
[Updated on: Wed, 01 September 2021 06:07] by Moderator
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06856 seconds