Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Generating updated feature description
Generating updated feature description [message #1850728] Tue, 15 March 2022 14:40 Go to next message
Alain Picard is currently offline Alain PicardFriend
Messages: 266
Registered: July 2009
Senior Member
Hi,

We've noticed that our effort to complete and improve our feature description is failing, since it appears that the generator will not update any value in the edit plugin.properties.

I searched and realized that PropertyMerger only ever appends new keys and never updates anything.

I guess it makes sense generally since for many of those keys we wouldn't want to loose any manual edits. But in a case like description for example, it is not very convenient to get staff to edit manually instead of using the nice GenModel editor.

I'm willing to submit a PR but wanted to confirm my understanding first and align approach.

My idea is to provide the ability to define an update predicate that could be used in a custom generator and to have an implementation of the predicate that checks a Generator.Options to provide a property merger update expression that would allow specifying a regular expression to match property keys that should be updated instead of skipped.

Maybe at the same time it would be nice to provide similar functionality to define a delete predicate/option. We often end up with stale entries and since we rarely if eve add anything manually, we could clean up easily.


Cheers,
Alain

[Updated on: Tue, 15 March 2022 14:42]

Report message to a moderator

Re: Generating updated feature description [message #1850729 is a reply to message #1850728] Tue, 15 March 2022 15:41 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Yes, it's a known issue, and especially has you say when editing a feature's description and then not having the properties updated unless you delete them first. Of course garbage collection is another issue. Regular expressions for what should be force merged and what should be garbage collected also sounds rather complicated...

Perhaps some simpler approach would work too. E.g., having a marker in the file where all the things after the marker are preserved while all things before the marker are deleted and then replaced with new generated contents, or vice versa. Then one could move things after (before) the marker when you don't want it to ever be touched...

But I have very minimal time to develop such new things... :-(


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Generating updated feature description [message #1850758 is a reply to message #1850729] Wed, 16 March 2022 08:55 Go to previous messageGo to next message
Alain Picard is currently offline Alain PicardFriend
Messages: 266
Registered: July 2009
Senior Member
Ed,

I find your idea easier to implement but for updates, it requires to first segregate properties, which might not be obvious, but feasible. Also it would mean that any new description for example would have to be moved again manually after to allow for further edits.
As for garbage collection, it doesn't help at all as we just don't know what those are.

So I went ahead and implemented the code, but facing a small issue when generating from the genModel, since I don't have the same format settings as you've used. I try to look for those files in the repo and for instructions at https://projects.eclipse.org/projects/modeling.emf.emf/developer, but I can't find any such settings. Would you happen to have those around?

Thanks
Alain
Re: Generating updated feature description [message #1850763 is a reply to message #1850758] Wed, 16 March 2022 11:07 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Alain,

Generally I use this to do the setup and that sets the formatting preference:

https://ci.eclipse.org/emf/

Unfortunately the GWT stuff is not working well anymore and requires an older IDE (2020-12) for it to work, in fact I had to choose the Platform product because the Committers product requires things that are incompatible with the Guava needed by the newer Xtext release. I should really change the setup for that. And, one day soon I will stop supporting GWT unless some steps up with funding for it...

Here is a rough idea. Suppose one generated the file like this:
# Everything below the line with @generated will be deleted and regenerated each time
# @generated
x=y
Then if you want to edit something manually you move it above those lines. New stuff will get added at the bottom so by default everything will always be regenerated until you move it above the marker line. No new properties would be needed in the GenModel because one can opt out by removing the marker line and existing generated models would not have the marker line...


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Generating updated feature description [message #1850765 is a reply to message #1850763] Wed, 16 March 2022 12:50 Go to previous messageGo to next message
Alain Picard is currently offline Alain PicardFriend
Messages: 266
Registered: July 2009
Senior Member
Thanks Ed, I will set myself up. Are you suggesting that I stick to 2020-12?

As for the marker line, the problem IMHO is that you can't know what you want to delete. In order to know it, you need to rename the file, regenerated, sort all entries and then do a diff, and at that point, well the job is done.

As for updates, you again have to manually find everything that you want updated and move them manually first. And if you go on adding new descriptions for example, then you have to remember to go and manually move them for the next time around.

My approach does need a new property in the GenModel (inspired from EditPluginVariables), not setting it is an implicit opt-out, doesn't affect anyone unless it is set.

Cheers,
Alain
Re: Generating updated feature description [message #1850766 is a reply to message #1850765] Wed, 16 March 2022 13:09 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
You can also use the latest and ignore the GWT projects...

I think you should open a Bugzilla and we discuss details there. Either I've not clearly described what I mean or I've not understood what you mean.... I am imagining that all things are below the marker line by default initially from now on and the only think you have to do/remember is that if you edit a property manually you must move it above the marker line. If you have an existing model, you will have a one-time manual task to sort out what you want to edit manually in the *.properties...


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Generating updated feature description [message #1850769 is a reply to message #1850766] Wed, 16 March 2022 14:28 Go to previous message
Alain Picard is currently offline Alain PicardFriend
Messages: 266
Registered: July 2009
Senior Member
Ed,

I just opened this issue: https://bugs.eclipse.org/bugs/show_bug.cgi?id=579278

We can continue the discussion there.

Alain
Previous Topic:Set-accessor Body?
Next Topic:Binary compatibility of EMF models
Goto Forum:
  


Current Time: Fri Apr 26 20:51:07 GMT 2024

Powered by FUDForum. Page generated in 0.03341 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top