Hello,
I must be missing something. For days now I have been stepping through the code of xText, reading the forum, setting breakpoints end trying stuff.
I have an external folder that contains dsl files. This external folder will eventually be added to the project in the same style as JDT does (external class folder).
As far as I can see I need to bind an IAllContainersState implementation. The one I have now looks like this:
public class TestStateProjectState extends AbstractAllContainersState implements IAllContainersState {
@Inject
private WorkspaceProjectsStateHelper workspaceProjectsStateHelper;
final protected URI getUri(IStorage file) {
return super.getUri(file);
}
@Inject
private ExternalFoldersManager externalFoldersManager;
@Override
protected String doInitHandle(URI uri) {
return workspaceProjectsStateHelper.initHandle(uri);
}
@Override
protected Collection<URI> doInitContainedURIs(String containerHandle) {
if (containerHandle.equals("test"))
{
IPath path = new Path("D:/temp");
final Collection<URI> containedURIs = new HashSet<URI>();
try {
IFolder folder = externalFoldersManager.createLinkFolder(path, false, new NullProgressMonitor());
folder.accept(new IResourceVisitor() {
@Override
public boolean visit(IResource resource) throws CoreException {
if (resource instanceof IFile)
{
URI uri = getUri((IFile) resource);
containedURIs.add(uri);
return false;
}
return true;
}
});
} catch (CoreException e) {
e.printStackTrace();
}
return containedURIs;
} else
{
return workspaceProjectsStateHelper.initContainedURIs(containerHandle);
}
}
@Override
protected List<String> doInitVisibleHandles(String handle) {
List<String> initVisibleHandles = workspaceProjectsStateHelper.initVisibleHandles(handle);
if (!initVisibleHandles.contains("test"))
{
initVisibleHandles.add("test");
}
return initVisibleHandles;
}
}
The ExternalFoldersManager is modeled after the one from JDT and creates an invisible project to store the locations as linked resources. Their uri looks like this: platform:/resource/.ee.xtext.test.external.folders/.link0/String.test
The State is bound like this (in the ui project):
public Provider<IAllContainersState> provideIAllContainersState() {
return org.eclipse.xtext.ui.shared.Access.<IAllContainersState>provider(TestStateProjectState.class);
}
The mwe2 workflow has these lines:
fragment = scoping.ImportNamespacesScopingFragment {}
fragment = exporting.QualifiedNamesFragment {}
fragment = builder.BuilderIntegrationFragment {}
I do not want to use the JDT features.
As far as I can tell no resource descriptions are being created. What am I missing? How can I tell the index to parse the files in this external folder?