Home » Modeling » TMF (Xtext) » Xtext runtime tries to access internet at application startup(Xtext runtime tries to access internet at application startup)
| | | |
Re: Xtext runtime tries to access internet at application startup [message #1064503 is a reply to message #1064431] |
Wed, 19 June 2013 10:16   |
Eclipse User |
|
|
|
That's the registration of the ResourceFactory, but I mean the
registration of the EcorePackage. It should happen automatically as soon
as you access the EcorePackage.eINSTANCE, but you can of course do it
explicitly:
org.eclipse.emf.ecore.impl.EcorePackageImpl.init()
Am 19.06.13 10:52, schrieb FJ Stöver:
> Good morning Jan,
>
> Thank you for your prompt reply.
>
>> That should not be the case, when the EcorePackage is correctly
> registered.
>
> For registration we use the generated code in
> BaseStandaloneSetupGenerated.java:
>
> ...
> if
> (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
>
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
> "ecore", new org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl());
> ...
>
>
> That seemed to be ok, and we tried to replace in the grammar
>
> import "http://www.eclipse.org/emf/2002/Ecore" as ecore
>
> by
>
> import "platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore"
>
> which gave the warning "Fix the bogus package import; import
> 'http://www.eclipse.org/emf/2002/Ecore'".
>
> When compiling the grammar however it gave the error "Couldn't resolve
> reference to EPackage
> 'platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore' ..."
>
> Any idea how to go the 'import from platform' approach ?
>
> Whatever: If the 'import from platform' approach is not successful, or
> the problem persists, then the next well probably be to produce a repro.
>
> kind regards Franz-Josef
>
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
|
|
| |
Re: Xtext runtime tries to access internet at application startup [message #1064584 is a reply to message #1064503] |
Thu, 20 June 2013 02:30   |
Eclipse User |
|
|
|
Jan,
A better idiom for forcing package initialization is
XyzPackage.eINSTANCE.eClass(); it's better to write code that assumes
the generated Impls are private.
On 19/06/2013 4:16 PM, Jan Koehnlein wrote:
> That's the registration of the ResourceFactory, but I mean the
> registration of the EcorePackage. It should happen automatically as
> soon as you access the EcorePackage.eINSTANCE, but you can of course
> do it explicitly:
>
> org.eclipse.emf.ecore.impl.EcorePackageImpl.init()
>
> Am 19.06.13 10:52, schrieb FJ Stöver:
>> Good morning Jan,
>>
>> Thank you for your prompt reply.
>>
>>> That should not be the case, when the EcorePackage is correctly
>> registered.
>>
>> For registration we use the generated code in
>> BaseStandaloneSetupGenerated.java:
>>
>> ...
>> if
>> (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
>>
>>
>> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
>> "ecore", new org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl());
>> ...
>>
>>
>> That seemed to be ok, and we tried to replace in the grammar
>>
>> import "http://www.eclipse.org/emf/2002/Ecore" as ecore
>>
>> by
>>
>> import "platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore"
>>
>> which gave the warning "Fix the bogus package import; import
>> 'http://www.eclipse.org/emf/2002/Ecore'".
>>
>> When compiling the grammar however it gave the error "Couldn't resolve
>> reference to EPackage
>> 'platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore' ..."
>>
>> Any idea how to go the 'import from platform' approach ?
>>
>> Whatever: If the 'import from platform' approach is not successful, or
>> the problem persists, then the next well probably be to produce a repro.
>>
>> kind regards Franz-Josef
>>
>
>
|
|
|
Re: Xtext runtime tries to access internet at application startup [message #1064619 is a reply to message #1064584] |
Thu, 20 June 2013 05:14   |
Eclipse User |
|
|
|
In terms of readability, my solution feels a bit more explicit. Yours
would definitively need a comment that you are just doing it for a
magical side-effect in order not to be removed in the next refactoring.
I'd prefer an even more explicit statement (involving the
EPackage.Registry), but then we are likely introducing some obsolete
action.
Am 20.06.13 08:30, schrieb Ed Merks:
> Jan,
>
> A better idiom for forcing package initialization is
> XyzPackage.eINSTANCE.eClass(); it's better to write code that assumes
> the generated Impls are private.
>
> On 19/06/2013 4:16 PM, Jan Koehnlein wrote:
>> That's the registration of the ResourceFactory, but I mean the
>> registration of the EcorePackage. It should happen automatically as
>> soon as you access the EcorePackage.eINSTANCE, but you can of course
>> do it explicitly:
>>
>> org.eclipse.emf.ecore.impl.EcorePackageImpl.init()
>>
>> Am 19.06.13 10:52, schrieb FJ Stöver:
>>> Good morning Jan,
>>>
>>> Thank you for your prompt reply.
>>>
>>>> That should not be the case, when the EcorePackage is correctly
>>> registered.
>>>
>>> For registration we use the generated code in
>>> BaseStandaloneSetupGenerated.java:
>>>
>>> ...
>>> if
>>> (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
>>>
>>>
>>> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
>>> "ecore", new org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl());
>>> ...
>>>
>>>
>>> That seemed to be ok, and we tried to replace in the grammar
>>>
>>> import "http://www.eclipse.org/emf/2002/Ecore" as ecore
>>>
>>> by
>>>
>>> import "platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore"
>>>
>>> which gave the warning "Fix the bogus package import; import
>>> 'http://www.eclipse.org/emf/2002/Ecore'".
>>>
>>> When compiling the grammar however it gave the error "Couldn't resolve
>>> reference to EPackage
>>> 'platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore' ..."
>>>
>>> Any idea how to go the 'import from platform' approach ?
>>>
>>> Whatever: If the 'import from platform' approach is not successful, or
>>> the problem persists, then the next well probably be to produce a repro.
>>>
>>> kind regards Franz-Josef
>>>
>>
>>
>
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
|
|
| |
Re: Xtext runtime tries to access internet at application startup [message #1064633 is a reply to message #1064619] |
Thu, 20 June 2013 06:41   |
Eclipse User |
|
|
|
Jan,
EPackage.Registry.INSTANCE.getEPackage(XyzPackage.eNS_URI) works too.
Accessing model implementation classes shouldn't be encouraged...
On 20/06/2013 11:14 AM, Jan Koehnlein wrote:
> In terms of readability, my solution feels a bit more explicit. Yours
> would definitively need a comment that you are just doing it for a
> magical side-effect in order not to be removed in the next
> refactoring. I'd prefer an even more explicit statement (involving the
> EPackage.Registry), but then we are likely introducing some obsolete
> action.
>
> Am 20.06.13 08:30, schrieb Ed Merks:
>> Jan,
>>
>> A better idiom for forcing package initialization is
>> XyzPackage.eINSTANCE.eClass(); it's better to write code that assumes
>> the generated Impls are private.
>>
>> On 19/06/2013 4:16 PM, Jan Koehnlein wrote:
>>> That's the registration of the ResourceFactory, but I mean the
>>> registration of the EcorePackage. It should happen automatically as
>>> soon as you access the EcorePackage.eINSTANCE, but you can of course
>>> do it explicitly:
>>>
>>> org.eclipse.emf.ecore.impl.EcorePackageImpl.init()
>>>
>>> Am 19.06.13 10:52, schrieb FJ Stöver:
>>>> Good morning Jan,
>>>>
>>>> Thank you for your prompt reply.
>>>>
>>>>> That should not be the case, when the EcorePackage is correctly
>>>> registered.
>>>>
>>>> For registration we use the generated code in
>>>> BaseStandaloneSetupGenerated.java:
>>>>
>>>> ...
>>>> if
>>>> (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
>>>>
>>>>
>>>>
>>>> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
>>>> "ecore", new
>>>> org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl());
>>>> ...
>>>>
>>>>
>>>> That seemed to be ok, and we tried to replace in the grammar
>>>>
>>>> import "http://www.eclipse.org/emf/2002/Ecore" as ecore
>>>>
>>>> by
>>>>
>>>> import "platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore"
>>>>
>>>> which gave the warning "Fix the bogus package import; import
>>>> 'http://www.eclipse.org/emf/2002/Ecore'".
>>>>
>>>> When compiling the grammar however it gave the error "Couldn't resolve
>>>> reference to EPackage
>>>> 'platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore' ..."
>>>>
>>>> Any idea how to go the 'import from platform' approach ?
>>>>
>>>> Whatever: If the 'import from platform' approach is not successful, or
>>>> the problem persists, then the next well probably be to produce a
>>>> repro.
>>>>
>>>> kind regards Franz-Josef
>>>>
>>>
>>>
>>
>
>
|
|
|
Re: Xtext runtime tries to access internet at application startup [message #1064635 is a reply to message #1064632] |
Thu, 20 June 2013 06:56  |
Eclipse User |
|
|
|
Maybe a breakpoint in
org.eclipse.emf.ecore.resource.impl.URIHandlerImpl.createInputStream(URI, Map<?,
?>) would help track it down.
On 20/06/2013 12:43 PM, FJ Stöver wrote:
> Dear colleagues !
>
> Thank you for the valuable comments; I'll do my best to integrate it
> into our software.
>
> Meanwhile we have found out more:
>
> * If we have one Xtext parser instance everything works fine, and we
> observe no internet traffic. So I assume that package registration
> seems to be ok - though I'll look into your suggestions to improve the
> software.
>
> * If we have two Xtext parser instances then we observe Internet
> traffic ! Seems like they influence each other. We looked for static
> fields in our source, and in the Xtext generated sources, but didn't
> find anything.
>
> Any ideas ?
>
> kind regards
>
> Franz-Josef
>
|
|
|
Goto Forum:
Current Time: Wed Jul 23 13:25:19 EDT 2025
Powered by FUDForum. Page generated in 0.54016 seconds
|