Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsEPackage.Registry.INSTANCE.getEFactory
https://www.eclipse.org/forums/index.php/mv/msg/130791/405328/#msg_405328
Originally posted by: kellypu.ie.ibm.com
What I want to do is if the factory is not loaded (i.e. factory = null
above). I want to load the factory. I was wondering how I force this
load. Do I use the EPackage.Descriptor object to achieve this?
Also, The ePackageName a valid package nsURI.
It's better to fetch the EPackage and ask it for the factory. I.e.,
this will always return the factory if there is a registration for the
given nsURI.
The registry's getEFactory method is really just designed to support the
factory_override extension point. If there is no override and the
package hasn't been instantiated yet, it will return null so I don't
expect it to be used outside of the package initialization code.
Paul Kelly wrote:
> Hi all,
>
> I have the following snippet of code
>
> String ePackageName = configElement.getAttribute("nsURI");
> EFactory factory = EPackage.Registry.INSTANCE.getEFactory(ePackageName);
> if (factory instanceof IAdapterEFactory) {
> allAdapterFactories.add(factory);
> }
>
>
> What I want to do is if the factory is not loaded (i.e. factory = null
> above). I want to load the factory. I was wondering how I force this
> load. Do I use the EPackage.Descriptor object to achieve this?
> Also, The ePackageName a valid package nsURI.
>
> Cheers,
>
> Paul
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Paul,<br>
<br>
It's better to fetch the EPackage and ask it for the factory. I.e.,
this will always return the factory if there is a registration for the
given nsURI.<br>
<blockquote> EPackage.Registry.INSTANCE.getEPackage(ePackageNsURI).getEFa ctoryInstance() <br>
</blockquote>
The registry's getEFactory method is really just designed to support
the factory_override extension point. If there is no override and the
package hasn't been instantiated yet, it will return null so I don't
expect it to be used outside of the package initialization code.<br>
<br>
<br>
Paul Kelly wrote:
<blockquote cite="midejfals$mru$1@utils.eclipse.org" type="cite">Hi
all,
<br>
<br>
I have the following snippet of code
<br>
<br>
String ePackageName = configElement.getAttribute("nsURI");
<br>
EFactory factory =
EPackage.Registry.INSTANCE.getEFactory(ePackageName);
<br>
if (factory instanceof IAdapterEFactory) {
<br>
allAdapterFactories. add(factory);
<br>
}
<br>
<br>
<br>
What I want to do is if the factory is not loaded (i.e. factory = null
above). I want to load the factory. I was wondering how I force this
load. Do I use the EPackage.Descriptor object to achieve this?
<br>
Also, The ePackageName a valid package nsURI.
<br>
<br>
Cheers,
<br>
<br>
Paul
<br>
</blockquote>
<br>
</body>
</html>
--------------090405010500020603070402--]]>Ed Merks2006-11-15T15:28:51-00:00Re: EPackage.Registry.INSTANCE.getEFactory
https://www.eclipse.org/forums/index.php/mv/msg/130791/405330/#msg_405330
Originally posted by: kellypu.ie.ibm.com
That sorted it.
Thanks (again!) Ed.
Paul
Ed Merks wrote:
> Paul,
>
> It's better to fetch the EPackage and ask it for the factory. I.e.,
> this will always return the factory if there is a registration for the
> given nsURI.
>
> EPackage.Registry.INSTANCE.getEPackage(ePackageNsURI).getEFa ctoryInstance()
>
> The registry's getEFactory method is really just designed to support the
> factory_override extension point. If there is no override and the
> package hasn't been instantiated yet, it will return null so I don't
> expect it to be used outside of the package initialization code.
>
>
> Paul Kelly wrote:
>> Hi all,
>>
>> I have the following snippet of code
>>
>> String ePackageName = configElement.getAttribute("nsURI");
>> EFactory factory = EPackage.Registry.INSTANCE.getEFactory(ePackageName);
>> if (factory instanceof IAdapterEFactory) {
>> allAdapterFactories.add(factory);
>> }
>>
>>
>> What I want to do is if the factory is not loaded (i.e. factory = null
>> above). I want to load the factory. I was wondering how I force this
>> load. Do I use the EPackage.Descriptor object to achieve this?
>> Also, The ePackageName a valid package nsURI.
>>
>> Cheers,
>>
>> Paul
>]]>2006-11-15T16:01:34-00:00