Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » import resolution during editing
import resolution during editing [message #986976] Thu, 22 November 2012 16:22 Go to next message
Defert Philippe is currently offline Defert PhilippeFriend
Messages: 62
Registered: July 2009
Member
Hello,

I developed an object-oriented language that uses the "import":
file1:
"package com.foo.a ;
class clsa {
var foo = "hello"
} "

file2:
"package com.foo.b ;
import com.foo.clsa ;
class clsb {
clsa sample;
var foo2 = sample.foo + "world"
} "

I managed to handle imports during the Build. Resolutions are made ​​
correctly.
public class myOolDslScopeProvider extends
AbstractDeclarativeScopeProvider {
....
}
and i have delagateScoper:
public class SkoolDslScopeProviderDelegate extends
ImportedNamespaceAwareLocalScopeProvider {
@Override
protected List<ImportNormalizer>
internalGetImportedNamespaceResolvers(EObject context, boolean ignoreCase) {
List<ImportNormalizer> importedNamespaceResolvers =
super.internalGetImportedNamespaceResolvers(context, ignoreCase);
if (context instanceof PackageElt) {
System.err.println("internalGetImportedNamespaceResolvers -- " +
context + " " + importedNamespaceResolvers);
PackageElt pkg = EcoreUtil2.getContainerOfType(context,
PackageElt.class);
if (pkg != null) {
String ownNamespace = pkg.getName() + ".*";
System.err.println("internalGetImportedNamespaceResolvers -- " +
ownNamespace);

importedNamespaceResolvers.add(createImportedNamespaceResolver(ownNamespace,
ignoreCase));
} else {
System.out.println("package not found");
}
}
return importedNamespaceResolvers;
}
}

But I have a trouble when I'm in the editor.
When I change the contents of CLSB, as a space for example,providerscope
is unable to resolve CLSA, he can not find the declaration of import
and package
So mark it "CLSA sample," with an error.

if I save the file, the build Solve correctly, but the marker remains on
the file.

To remove the marker I have to do a clean and rebuild the workspace

Have you ever seen this problem?

Regards,

Philippe
Re: import resolution during editing [message #987000 is a reply to message #986976] Thu, 22 November 2012 18:15 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 6485
Registered: July 2009
Senior Member
Hi,

can you share your grammar. it may be not optimal for error recovery

~Christian
Previous Topic:Add Environment Library
Next Topic:Xtext generated Java Main
Goto Forum:
  


Current Time: Sun Nov 23 21:36:43 GMT 2014

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

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