Home » Modeling » TMF (Xtext) » EObjectDescription could be found in Scope during serialization in an osgi environnement(EObjectDescription could be found in Scope during serialization in an osgi environnement)
| |
Re: EObjectDescription could be found in Scope during serialization in an osgi environnement [message #880481 is a reply to message #880329] |
Sat, 02 June 2012 05:05 |
CRASNIER Stéphane Messages: 13 Registered: May 2012 |
Junior Member |
|
|
Thanks for your reply Moritz !
I think you're right and I come to the same conclusion but I don't understand why.
Moreover, I've forgotten 2 things :
1 - In a standalone environnement, all is all right and well serialized, initializing the environnement trough the MyLanguageStandaloneSetup().createInjectorAndDoEMFRegistration(). That's why I think there is certainly something wrong with my "OSGI initialization"
2 - Debugging, I realize that in the ImportScope class, the importScope attribute is null so that an empty scope is created in the getImportFrom() method, having no element inside. It seems that in the IScope getLocalElementsScope(IScope parent, final EObject context, final EReference reference) method of the ImportedNamespaceAwareLocalScopeProvider, the bold marked instruction is called to create this import scope (line 180) with the null importscope parameter :
protected IScope getLocalElementsScope(IScope parent, final EObject context,
final EReference reference) {
IScope result = parent;
ISelectable allDescriptions = getAllDescriptions(context.eResource());
QualifiedName name = getQualifiedNameOfLocalElement(context);
boolean ignoreCase = isIgnoreCase(reference);
final List<ImportNormalizer> namespaceResolvers = getImportedNamespaceResolvers(context, ignoreCase);
if (!namespaceResolvers.isEmpty()) {
if (isRelativeImport() && name!=null) {
ImportNormalizer localNormalizer = new ImportNormalizer(name, true, ignoreCase);
result = createImportScope(result, singletonList(localNormalizer), allDescriptions, reference.getEReferenceType(), isIgnoreCase(reference));
}
[b] result = createImportScope(result, namespaceResolvers, null, reference.getEReferenceType(), isIgnoreCase(reference));
[/b] }
if (name!=null) {
ImportNormalizer localNormalizer = new ImportNormalizer(name, true, ignoreCase);
result = createImportScope(result, singletonList(localNormalizer), allDescriptions, reference.getEReferenceType(), isIgnoreCase(reference));
}
return result;
}
Here, I'm beginning to get lost:) It means that the name is null as I provide my own namespaceResolvers with my scope provider. The name is retrieved through getQualifiedNameOfLocalElement(context). I'm digging in this direction and in my custom scope provider direction (which just overrides getImportedNamespaceResolvers to add the needed namespaceresolvers) but I feel that it's the wrong way...
So I hope to be more precise with these elements. If you have any other clue, it would be great !
Thanks again Moritz !
Stéphane
|
|
|
Re: EObjectDescription could be found in Scope during serialization in an osgi environnement [message #1065555 is a reply to message #880481] |
Wed, 26 June 2013 13:31 |
junior developer Messages: 354 Registered: January 2013 |
Senior Member |
|
|
Hi all,
I try below code but not defined singletonList.I added jaxen jar file.Do I create method ? I do not understand:(
CRASNIER Stéphane wrote on Sat, 02 June 2012 01:05Thanks for your reply Moritz !
I think you're right and I come to the same conclusion but I don't understand why.
Moreover, I've forgotten 2 things :
1 - In a standalone environnement, all is all right and well serialized, initializing the environnement trough the MyLanguageStandaloneSetup().createInjectorAndDoEMFRegistration(). That's why I think there is certainly something wrong with my "OSGI initialization"
2 - Debugging, I realize that in the ImportScope class, the importScope attribute is null so that an empty scope is created in the getImportFrom() method, having no element inside. It seems that in the IScope getLocalElementsScope(IScope parent, final EObject context, final EReference reference) method of the ImportedNamespaceAwareLocalScopeProvider, the bold marked instruction is called to create this import scope (line 180) with the null importscope parameter :
protected IScope getLocalElementsScope(IScope parent, final EObject context,
final EReference reference) {
IScope result = parent;
ISelectable allDescriptions = getAllDescriptions(context.eResource());
QualifiedName name = getQualifiedNameOfLocalElement(context);
boolean ignoreCase = isIgnoreCase(reference);
final List<ImportNormalizer> namespaceResolvers = getImportedNamespaceResolvers(context, ignoreCase);
if (!namespaceResolvers.isEmpty()) {
if (isRelativeImport() && name!=null) {
ImportNormalizer localNormalizer = new ImportNormalizer(name, true, ignoreCase);
result = createImportScope(result, singletonList(localNormalizer), allDescriptions, reference.getEReferenceType(), isIgnoreCase(reference));
}
[b] result = createImportScope(result, namespaceResolvers, null, reference.getEReferenceType(), isIgnoreCase(reference));
[/b] }
if (name!=null) {
ImportNormalizer localNormalizer = new ImportNormalizer(name, true, ignoreCase);
result = createImportScope(result, singletonList(localNormalizer), allDescriptions, reference.getEReferenceType(), isIgnoreCase(reference));
}
return result;
}
Here, I'm beginning to get lost:) It means that the name is null as I provide my own namespaceResolvers with my scope provider. The name is retrieved through getQualifiedNameOfLocalElement(context). I'm digging in this direction and in my custom scope provider direction (which just overrides getImportedNamespaceResolvers to add the needed namespaceresolvers) but I feel that it's the wrong way...
So I hope to be more precise with these elements. If you have any other clue, it would be great !
Thanks again Moritz !
Stéphane
|
|
| |
Goto Forum:
Current Time: Mon Sep 23 20:47:33 GMT 2024
Powered by FUDForum. Page generated in 0.05677 seconds
|