eclipse-uml2 / uml2

An EMF-based implementation of the UML 2.x metamodel for the Eclipse platform.
Eclipse Public License 2.0
5 stars 4 forks source link

Add examples of how to save a model+stereotypes #105

Open eclipse-uml2-bot opened 1 week ago

eclipse-uml2-bot commented 1 week ago

| --- | --- | | Bugzilla Link | 569035 | | Status | UNCONFIRMED | | Importance | P3 enhancement | | Reported | Nov 22, 2020 10:35 EDT | | Modified | Apr 08, 2022 08:48 EDT | | Version | 5.5.0 | | See also | 568819 | | Reporter | gary s thompson |

Description

as discussed in https://bugs.eclipse.org/bugs/show_bug.cgi?id=543231 and https://www.eclipse.org/forums/index.php/m/1834967/#msg_1834967 it is not obvious how to save a url model to a file with stereotypes applied. There are several gotchas as discussed in the forum thread thread above. I have modified IntroductionToUMLProfiles.java to include examples of hoot save a model with stereotypes applied in Java, the code is at https://www.eclipse.org/forums/index.php?t=getfile&id=39380&. To be complete and reasonable this most probably ought to have some updated url to show hoot do it in the ui (though I am not sure how that works...)

eclipse-uml2-bot commented 1 week ago

By gary s thompson on Nov 22, 2020 12:36

fumble fingers, here is a correct version:

As discussed in https://bugs.eclipse.org/bugs/show_bug.cgi?id=543231 and https://www.eclipse.org/forums/index.php/m/1834967/#msg_1834967 it is not obvious how to save a uml model to a file with stereotypes applied. There are several gotchas as discussed in the forum thread thread above. I have modified IntroductionToUMLProfiles.java to include examples of how to save a model with stereotypes applied in Java, the code is at https://www.eclipse.org/forums/index.php?t=getfile&id=39380&. To be complete and reasonable this most probably ought to have some updated html to show how to carry out the same operation in the uml2 ui (though I am not sure how that would work as its not clear how to create a resource before the file is saved or how to add the applied stereotypes when editing is complete... however, maybe this is something that is solved in the ui code already)

eclipse-uml2-bot commented 1 week ago

By Ed Willink on Nov 23, 2020 07:52

Your mail group message seems to suggest that the contribution is incomplete;

a missing ecore namespace declaration and a missing schemaDeclaration.

The schemaDeclaration is probably a trivial Resource saveOptions bug.

The missing ecore namespace may be a similar problem to https://bugs.eclipse.org/bugs/show_bug.cgi?id=568819 where a types declaration is missing.

Perhaps some loop over transitive dependencies is missing that locates the required declarations.

eclipse-uml2-bot commented 1 week ago

By gary s thompson on Nov 30, 2020 17:14

Hi Ed

the example is not incomplete it all works fine, the problem is that when I try and setup a parallel version of the code in my program I don't get the same results....

regards\ Gary

eclipse-uml2-bot commented 1 week ago

By gary s thompson on Dec 05, 2020 07:00

so in my own code when saving I needed to add

xmiResource.defaultSaveOptions.put(XMIResource.OPTION_SCHEMA_LOCATION, true)

but this isn't in the example code, not quite sure whey the two need different treatment

eclipse-uml2-bot commented 1 week ago

By Ed Willink on Dec 05, 2020 13:31

Probably because you are actually using the result whereas the example was developed as a demonstration that was 'tested' by eye.

eclipse-uml2-bot commented 1 week ago

By gary s thompson on Dec 15, 2020 08:15

(In reply to Ed Willink from comment #5)

Probably because you are actually using the result whereas the example was developed as a demonstration that was 'tested' by eye.

Unfortunately that's not the reason as its a runnable example and all works when run...

eclipse-uml2-bot commented 1 week ago

By Ed Willink on Apr 08, 2022 08:16

Created attachment 288418 Better documentation and save

Attached is rescued from my workspace. It seems that I was motivated to do better and so the attached was created on 21 November 2020, 18:38:02

It seems that it never got contributed.

It solves the problems in https://www.eclipse.org/forums/index.php/mv/msg/1110528/1851540/#msg_1851540

IntroductionToUMLProfiles.java

eclipse-uml2-bot commented 1 week ago

By Ed Willink on Apr 08, 2022 08:48

(In reply to Ed Willink from comment #7)

It seems that it never got contributed.

The code seems ok, but there is clearly at least one new half-written comment.

Inspecting my email at the time, it appears that all the builds started failing the following day as Java 11 started to impose itself via Tycho / Maven currency.

I suspect that I got interrupted while tweaking the comments and then got well distracted by fixing OCL, QVT, ... and forgot to come back to it.