Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Custom Activator in UI plug-in?
Custom Activator in UI plug-in? [message #881453] Mon, 04 June 2012 15:32 Go to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1828
Registered: July 2009
Senior Member
I thought this should be simple but I'm stuck:

I want to add custom initialization to the activator of a UI plug-in.

So, how do I tell Xtext not to generate a new activator but use my version?

Things I tried:
- move activator from target/generated-sources/xtext to src/main/java

=> activator is re-generated and now I have two identical activators, compilation fails

- disable generating basic UI stuff (since I already have it),
Is this driven by the ImplicitUiFragment? I tried to disable this fragment by unsetting pathToUiProject and projectNameUi, (as suggested in the help) but then all UI stuff was generated into the DSL plug-in

=> compilation utterly broken.

- Sub-class the activator, but then it will not be used by the DSLExecutableExtensionFatory (and probably the entry in MANIFEST.MF will be overwritten, too, right?)

=> not the intended effect

I must be missing s.t. really obvious?
thanks,
Stephan
Re: Custom Activator in UI plug-in? [message #881483 is a reply to message #881453] Mon, 04 June 2012 16:28 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
I just extended the generated activator.
You can check out what I did in cloudsmith/geppetto @ github.
The ui bundle is /org.cloudsmith.geppetto.pp.dsl.ui

Note that the manifest is not overwritten - you have to always manually
merge (and pick what you want) from the generated. So, it is perfectly
fine to just point to your activator.

The executable extension stuff will continue to work since the
references to the generated activator uses static information which is
present / setup since the custom activator inherits the generated...

Hope that helps.

- henrik

On 2012-04-06 17:32, Stephan Herrmann wrote:
> I thought this should be simple but I'm stuck:
>
> I want to add custom initialization to the activator of a UI plug-in.
>
> So, how do I tell Xtext not to generate a new activator but use my version?
>
> Things I tried:
> - move activator from target/generated-sources/xtext to src/main/java
>
> => activator is re-generated and now I have two identical activators,
> compilation fails
>
> - disable generating basic UI stuff (since I already have it),
> Is this driven by the ImplicitUiFragment? I tried to disable this
> fragment by unsetting pathToUiProject and projectNameUi, (as suggested
> in the help) but then all UI stuff was generated into the DSL plug-in
>
> => compilation utterly broken.
>
> - Sub-class the activator, but then it will not be used by the
> DSLExecutableExtensionFatory (and probably the entry in MANIFEST.MF will
> be overwritten, too, right?)
>
> => not the intended effect
>
> I must be missing s.t. really obvious?
> thanks,
> Stephan
>
Re: Custom Activator in UI plug-in? [message #881499 is a reply to message #881483] Mon, 04 June 2012 17:33 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1828
Registered: July 2009
Senior Member
Henrik Lindberg wrote on Mon, 04 June 2012 18:28
I just extended the generated activator.
You can check out what I did in cloudsmith/geppetto @ github.
The ui bundle is /org.cloudsmith.geppetto.pp.dsl.ui


Thanks a lot. Now I know which path should work.

Henrik Lindberg wrote
Note that the manifest is not overwritten - you have to always manually
merge (and pick what you want) from the generated. So, it is perfectly
fine to just point to your activator.


So that's the bug here: my GenerateMyDsl.mwe2 indeed overwrites the UI plug-ins MANIFEST.MF every time invoked. I see what you say regarding plugin.xml and plugin.xml_gen but not for the manifest!

So, how can I find out who's doing this?
I have the following fragments enabled in my mwe2:
- grammarAccess.GrammarAccessFragment
- serializer.SerializerFragment
- resourceFactory.ResourceFactoryFragment
- parser.antlr.XtextAntlrGeneratorFragment
- validation.JavaValidatorFragment
- scoping.ImportNamespacesScopingFragment
- exporting.QualifiedNamesFragment
- builder.BuilderIntegrationFragment
- formatting.FormatterFragment
- labeling.LabelProviderFragment
- outline.OutlineTreeProviderFragment
- outline.QuickOutlineFragment
- quickfix.QuickfixProviderFragment
- contentAssist.JavaBasedContentAssistFragment
- parser.antlr.XtextAntlrUiGeneratorFragment
- junit.Junit4Fragment
- types.TypesGeneratorFragment
- xbase.XbaseGeneratorFragment
- templates.CodetemplatesGeneratorFragment
- refactoring.RefactorElementNameFragment
- compare.CompareFragment

Which of these would be suspected to overwrite the manifest? Anything I need to configure? Or is that a bug in Xtext 2.2.1 that has been fixed in 2.3?


Henrik Lindberg wrote
The executable extension stuff will continue to work since the
references to the generated activator uses static information which is
present / setup since the custom activator inherits the generated...


Tricky, indeed. So the only reference that should be updated is in the manifest?

thanks,
Stephan
Re: Custom Activator in UI plug-in? [message #881758 is a reply to message #881499] Tue, 05 June 2012 07:59 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3108
Registered: July 2009
Senior Member
Stephan,

use mergeManifest=false on the generator.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 04.06.12 19:33, schrieb Stephan Herrmann:
> Henrik Lindberg wrote on Mon, 04 June 2012 18:28
>> I just extended the generated activator.
>> You can check out what I did in cloudsmith/geppetto @ github.
>> The ui bundle is /org.cloudsmith.geppetto.pp.dsl.ui
>
>
> Thanks a lot. Now I know which path should work.
>
> Henrik Lindberg wrote
>> Note that the manifest is not overwritten - you have to always
>> manually merge (and pick what you want) from the generated. So, it is
>> perfectly fine to just point to your activator.
>
>
> So that's the bug here: my GenerateMyDsl.mwe2 indeed overwrites the UI
> plug-ins MANIFEST.MF every time invoked. I see what you say regarding
> plugin.xml and plugin.xml_gen but not for the manifest!
>
> So, how can I find out who's doing this?
> I have the following fragments enabled in my mwe2:
> - grammarAccess.GrammarAccessFragment
> - serializer.SerializerFragment
> - resourceFactory.ResourceFactoryFragment
> - parser.antlr.XtextAntlrGeneratorFragment
> - validation.JavaValidatorFragment
> - scoping.ImportNamespacesScopingFragment
> - exporting.QualifiedNamesFragment
> - builder.BuilderIntegrationFragment
> - formatting.FormatterFragment
> - labeling.LabelProviderFragment
> - outline.OutlineTreeProviderFragment
> - outline.QuickOutlineFragment
> - quickfix.QuickfixProviderFragment
> - contentAssist.JavaBasedContentAssistFragment
> - parser.antlr.XtextAntlrUiGeneratorFragment
> - junit.Junit4Fragment
> - types.TypesGeneratorFragment
> - xbase.XbaseGeneratorFragment
> - templates.CodetemplatesGeneratorFragment
> - refactoring.RefactorElementNameFragment
> - compare.CompareFragment
> Which of these would be suspected to overwrite the manifest? Anything I
> need to configure? Or is that a bug in Xtext 2.2.1 that has been fixed
> in 2.3?
>
>
> Henrik Lindberg wrote
>> The executable extension stuff will continue to work since the
>> references to the generated activator uses static information which is
>> present / setup since the custom activator inherits the generated...
>
>
> Tricky, indeed. So the only reference that should be updated is in the
> manifest?
>
> thanks,
> Stephan
>
Re: Custom Activator in UI plug-in? [message #882414 is a reply to message #881758] Wed, 06 June 2012 12:32 Go to previous message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1828
Registered: July 2009
Senior Member
Quote:
use mergeManifest=false on the generator.


That does the trick.
And it also avoids the need to refresh MANIFEST.MF after each run of the Xtext generator Smile

thanks!
Stephan
Previous Topic:quotation marks
Next Topic:Guice setup in multi-plug-in setups
Goto Forum:
  


Current Time: Fri Oct 23 12:04:12 GMT 2020

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

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

Back to the top