Prevent generating the extension_parser extension point [message #1237298] |
Wed, 29 January 2014 05:29  |
Eclipse User |
|
|
|
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 #1240987 is a reply to message #1240928] |
Fri, 07 February 2014 04:59   |
Eclipse User |
|
|
|
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
|
|
|
|
Re: Prevent generating the extension_parser extension point [message #1326174 is a reply to message #1326055] |
Thu, 01 May 2014 12:00   |
Eclipse User |
|
|
|
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
|
|
|
Re: Prevent generating the extension_parser extension point [message #1326237 is a reply to message #1240928] |
Thu, 01 May 2014 12:43  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.07504 seconds