Custom class reference in inferrer [message #1758625] |
Thu, 30 March 2017 17:04  |
Rodrigo Ruiz Messages: 28 Registered: March 2017 |
Junior Member |
|
|
Hi again 
When building my inferrer i need to put a custom class as return type for my method like this:
members += com.toMethod(com.name, typeRef(CommandResponse))[ ...
That CommandResponse is a class meant to be in the target environment and my own as well, so it will be in the classpath.
I created a namespace scope provider by:
ImportedNamespaceScopeProvider extends ImportedNamespaceAwareLocalScopeProvider
and then when scoping i put all the packages i will be needing on the generated class, like this:
@Override
protected List<ImportNormalizer> internalGetImportedNamespaceResolvers(EObject context, boolean ignoreCase) {
List<ImportNormalizer> importedNamespaceResolvers = super.internalGetImportedNamespaceResolvers(context, ignoreCase);
String ownNamespace = EcoreUtil2.getContainerOfType(context, Model.class).getName()+ ".*";
importedNamespaceResolvers.add(createImportedNamespaceResolver(ownNamespace, ignoreCase));
importedNamespaceResolvers.add(createImportedNamespaceResolver("core.services.*", true));
importedNamespaceResolvers.add(createImportedNamespaceResolver("java.lang.*", true));
importedNamespaceResolvers.add(createImportedNamespaceResolver("request.*", true));
return importedNamespaceResolvers;
}
which should cover CommandResponse (is in request.CommandResponse) .
But when i run the code, the editor freezes, i can't type or do anything useful with it.
so, i'm convinced there must be another way of doing this.
Can you suggest me a better way, one that works?
Thanks again, your help is much appreciated.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01530 seconds