Hi,
in order to set a specific encoding for files generated by my language, I created my own EclipseResourceFileSystemAccess2 subclass and created a binding as shown below.
public class MyFileSystemAccess2 extends EclipseResourceFileSystemAccess2 {
@Override
protected String getEncoding(IFile file) throws CoreException {
if (file.getName().endsWith(".csv")) {
IContainer parent = file.getParent();
if (parent != null && "export".equals(parent.getName()))
return "ISO-8859-1";
}
return super.getEncoding(file);
}
}
class LogDslRuntimeModule extends AbstractLogDslRuntimeModule {
...
def Class<? extends EclipseResourceFileSystemAccess2> bindEclipseResourceFileSystemAccess2() {
return MyFileSystemAccess2
}
}
This works fine. However, my UnitTests now don't start anymore, as Guice is unable to inject a dependency used by EclipseResourceFileSystemAccess2.
...
at de.myProject.mydsl.tests.MyDslInjectorProvider$1.createInjector(MyDslInjectorProvider.java:39)
at de.myProject.mydsl.MyDslStandaloneSetupGenerated.createInjectorAndDoEMFRegistration(MyDslStandaloneSetupGenerated.java:21)
at de.myProject.mydsl.tests.MyDslInjectorProvider.internalCreateInjector(MyDslInjectorProvider.java:41)
at de.myProject.mydsl.tests.MyDslInjectorProvider.getInjector(MyDslInjectorProvider.java:29)
at de.myProject.mydsl.tests.MyDslInjectorProvider.setupRegistry(MyDslInjectorProvider.java:63)
...
Caused by: java.lang.ClassNotFoundException: org.eclipse.xtext.ui.generator.trace.TraceMarkers
I figure my Standalone / Test Injector Setup is incorrect, but I am at a loss about how to fix it.
1. Do I have to use a different IFileSystemAccess2 subtype in test?
2. If so, how would I create the binding?
3. If so, how do I prevent the other binding (bindEclipseResourceFileSystemAccess2) from being used in test?
Maybe I did something else wrong. Any advice would be greatly appreciated!