Search in sources :

Example 1 with MultiRootWorkspaceConfigFactory

use of org.eclipse.xtext.ide.server.MultiRootWorkspaceConfigFactory in project xtext-core by eclipse.

the class IndexOnlyProjectTest method getServerModule.

@Override
public com.google.inject.Module getServerModule() {
    return Modules2.mixin(new ServerModule(), new Module() {

        @Override
        public void configure(Binder binder) {
            binder.bind(IMultiRootWorkspaceConfigFactory.class).toInstance(new MultiRootWorkspaceConfigFactory() {

                @Override
                public void addProjectsForWorkspaceFolder(WorkspaceConfig workspaceConfig, WorkspaceFolder workspaceFolder, Set<String> existingNames) {
                    String uri = null;
                    if (workspaceFolder != null) {
                        uri = workspaceFolder.getUri();
                    }
                    if (uri != null) {
                        FileProjectConfig project = new FileProjectConfig(getUriExtensions().toUri(workspaceFolder.getUri()), getUniqueProjectName(workspaceFolder.getName(), existingNames)) {

                            @Override
                            public boolean isIndexOnly() {
                                return true;
                            }
                        };
                        project.addSourceFolder(".");
                        workspaceConfig.addProject(project);
                    }
                }
            });
        }
    });
}
Also used : Binder(com.google.inject.Binder) IMultiRootWorkspaceConfigFactory(org.eclipse.xtext.ide.server.IMultiRootWorkspaceConfigFactory) MultiRootWorkspaceConfigFactory(org.eclipse.xtext.ide.server.MultiRootWorkspaceConfigFactory) Set(java.util.Set) WorkspaceConfig(org.eclipse.xtext.workspace.WorkspaceConfig) ServerModule(org.eclipse.xtext.ide.server.ServerModule) Module(com.google.inject.Module) FileProjectConfig(org.eclipse.xtext.workspace.FileProjectConfig) ServerModule(org.eclipse.xtext.ide.server.ServerModule) WorkspaceFolder(org.eclipse.lsp4j.WorkspaceFolder)

Aggregations

Binder (com.google.inject.Binder)1 Module (com.google.inject.Module)1 Set (java.util.Set)1 WorkspaceFolder (org.eclipse.lsp4j.WorkspaceFolder)1 IMultiRootWorkspaceConfigFactory (org.eclipse.xtext.ide.server.IMultiRootWorkspaceConfigFactory)1 MultiRootWorkspaceConfigFactory (org.eclipse.xtext.ide.server.MultiRootWorkspaceConfigFactory)1 ServerModule (org.eclipse.xtext.ide.server.ServerModule)1 FileProjectConfig (org.eclipse.xtext.workspace.FileProjectConfig)1 WorkspaceConfig (org.eclipse.xtext.workspace.WorkspaceConfig)1