Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Prevent generating the extension_parser extension point
Prevent generating the extension_parser extension point [message #1237298] Wed, 29 January 2014 10:29 Go to next message
Maarten Bezemer is currently offline Maarten BezemerFriend
Messages: 117
Registered: February 2012
Senior Member
Hello,

When generating model code from my genmodel file, the org.eclipse.emf.ecore.extension_parser extension point is added to plugin.xml to register the file type of the model. So far, all good.

Now, I have a model that is only used as a template/common base for other models. So I do not want to register any file type to this model (as there are no files that directly make use of this model). So I left the "Model->File Extensions field empty in the genmodel editor, but the extension point is still generated (with an empty value for the 'type' attribute).

Is there any way to prevent generating the extension point completely? (As I suppose that registering an empty file type to a model is not correct?)

Thanks,
Maarten
Re: Prevent generating the extension_parser extension point [message #1240909 is a reply to message #1237298] Fri, 07 February 2014 08:14 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31825
Registered: July 2009
Senior Member
Maarten,

You can set the GenPackage's Resource Type to None.

On 29/01/2014 11:29 AM, Maarten Bezemer wrote:
> Hello,
>
> When generating model code from my genmodel file, the
> org.eclipse.emf.ecore.extension_parser extension point is added to
> plugin.xml to register the file type of the model. So far, all good.
>
> Now, I have a model that is only used as a template/common base for
> other models. So I do not want to register any file type to this model
> (as there are no files that directly make use of this model). So I
> left the "Model->File Extensions field empty in the genmodel editor,
> but the extension point is still generated (with an empty value for
> the 'type' attribute).
>
> Is there any way to prevent generating the extension point completely?
> (As I suppose that registering an empty file type to a model is not
> correct?)
>
> Thanks,
> Maarten


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Prevent generating the extension_parser extension point [message #1240928 is a reply to message #1240909] Fri, 07 February 2014 08:40 Go to previous messageGo to next message
Maarten Bezemer is currently offline Maarten BezemerFriend
Messages: 117
Registered: February 2012
Senior Member
Hi Ed,

Thanks for your suggestion. It indeed prevents adding the extension point.

But now as a side effect, the MyModelResourceImpl class is not generated (which is kind of expected as there is no resource type anymore). This is kind of unfortunate as I used this class to provide some additional methods/functionality for the other 'inheriting' models. I guess I have to move this functionality to another location.

I suppose there is no field (besides the Resource Type) to provide the 'extending class' that needs to be used by the inheriting ResourceImpl classes? So I can leave the class set to '@generated'.

On the other hand, is it acceptable to prevent generating the extension point when 'File Extensions' is left empty? As this results in registering an empty extension to the package, which does not seem to make much sense...

Thanks again for your help.
Cheers,
Maarten
Re: Prevent generating the extension_parser extension point [message #1240987 is a reply to message #1240928] Fri, 07 February 2014 09:59 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31825
Registered: July 2009
Senior Member
Maarten,

Comments below.

On 07/02/2014 9:40 AM, Maarten Bezemer wrote:
> Hi Ed,
>
> Thanks for your suggestion. It indeed prevents adding the extension
> point.
>
> But now as a side effect, the MyModelResourceImpl class is not
> generated (which is kind of expected as there is no resource type
> anymore).
Yes, I would expect that.
> This is kind of unfortunate as I used this class to provide some
> additional methods/functionality for the other 'inheriting' models. I
> guess I have to move this functionality to another location.
Or just remove all the @generated annotations and keep it...
>
> I suppose there is no field (besides the Resource Type) to provide the
> 'extending class' that needs to be used by the inheriting ResourceImpl
> classes?
No.
> So I can leave the class set to '@generated'.
>
> On the other hand, is it acceptable to prevent generating the
> extension point when 'File Extensions' is left empty?
We don't do much of anything in the way of validation in the GenModel,
so you might specify the extension as " but that won't work either. :-P
> As this results in registering an empty extension to the package,
> which does not seem to make much sense...
Another trick I use when I want to suppress something that's generated
now the plugin.xml support merging is to comment out the body of the
generated thing in the plugin.xml and change the @generated tag to add
"not"... E.g., something like this works I think:

<!--
<extension point="org.eclipse.emf.ecore.extension_parser">
@generated foo not
<parser
type="test"
class="test.util.TestResourceFactoryImpl"/>
</extension>
-->
>
> Thanks again for your help.
> Cheers,
> Maarten


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Prevent generating the extension_parser extension point [message #1326055 is a reply to message #1240987] Thu, 01 May 2014 14:41 Go to previous messageGo to next message
Maarten Bezemer is currently offline Maarten BezemerFriend
Messages: 117
Registered: February 2012
Senior Member
Hi,

I found the 'Plugin Key' property, under 'Templates & Merge', its description says: "The key used for merging generated plugin.xml files contents; an empty string disables merging"

This seems to be exactly what I require, as it stops merging plugin.xml if the property value is empty. and thus leaves the current version without adding the extension points.

Regards,
Maarten
Re: Prevent generating the extension_parser extension point [message #1326174 is a reply to message #1326055] Thu, 01 May 2014 16:00 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31825
Registered: July 2009
Senior Member
Maarten,

Yes, but that disables everything very unselectively so if you do make
changes that require updating what's in the plugin.xml, that won't
happen anymore. That's your choice...

On 01/05/2014 4:41 PM, Maarten Bezemer wrote:
> Hi,
>
> I found the 'Plugin Key' property, under 'Templates & Merge', its
> description says: "The key used for merging generated plugin.xml files
> contents; an empty string disables merging"
>
> This seems to be exactly what I require, as it stops merging
> plugin.xml if the property value is empty. and thus leaves the current
> version without adding the extension points.
>
> Regards,
> Maarten


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Prevent generating the extension_parser extension point [message #1326237 is a reply to message #1240928] Thu, 01 May 2014 16:43 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7090
Registered: July 2009
Senior Member
Hi

XXXResourceImpl and XXXResourceFactoryImpl have trivial content.

I generally set Resource type to XMI to generate them.

Then Remove all the @generated annotations.

Then set the Resource to None and thereafter develop them manually.

Regards

Ed Willink

On 07/02/2014 08:40, Maarten Bezemer wrote:
> Hi Ed,
>
> Thanks for your suggestion. It indeed prevents adding the extension
> point.
>
> But now as a side effect, the MyModelResourceImpl class is not
> generated (which is kind of expected as there is no resource type
> anymore). This is kind of unfortunate as I used this class to provide
> some additional methods/functionality for the other 'inheriting'
> models. I guess I have to move this functionality to another location.
>
> I suppose there is no field (besides the Resource Type) to provide the
> 'extending class' that needs to be used by the inheriting ResourceImpl
> classes? So I can leave the class set to '@generated'.
>
> On the other hand, is it acceptable to prevent generating the
> extension point when 'File Extensions' is left empty? As this results
> in registering an empty extension to the package, which does not seem
> to make much sense...
>
> Thanks again for your help.
> Cheers,
> Maarten
Previous Topic:[EEF] Extended Editing Framework programmin best practices
Next Topic:Is org.eclipse.ocl.ecore for equinox only?
Goto Forum:
  


Current Time: Sat Apr 10 13:02:53 GMT 2021

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

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

Back to the top