Search in sources :

Example 1 with WorkspaceConfig

use of org.eclipse.xtext.workspace.WorkspaceConfig in project xtext-core by eclipse.

the class ProjectWorkspaceConfigFactory method getWorkspaceConfig.

@Override
public IWorkspaceConfig getWorkspaceConfig(final URI workspaceBaseURI) {
    final WorkspaceConfig workspaceConfig = new WorkspaceConfig();
    this.findProjects(workspaceConfig, workspaceBaseURI);
    return workspaceConfig;
}
Also used : IWorkspaceConfig(org.eclipse.xtext.workspace.IWorkspaceConfig) WorkspaceConfig(org.eclipse.xtext.workspace.WorkspaceConfig)

Example 2 with WorkspaceConfig

use of org.eclipse.xtext.workspace.WorkspaceConfig 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)

Example 3 with WorkspaceConfig

use of org.eclipse.xtext.workspace.WorkspaceConfig in project xtext-core by eclipse.

the class LiveShadowedChunkedContainerTest method setUp.

@Before
public void setUp() throws Exception {
    workspaceConfig = new WorkspaceConfig();
    fooProject = new ProjectConfig("foo", workspaceConfig);
    barProject = new ProjectConfig("bar", workspaceConfig);
    XtextResourceSet rs0 = resourceSetProvider.get();
    fooURI = Iterables.getFirst(fooProject.getSourceFolders(), null).getPath().trimSegments(1).appendSegment("foo.livecontainertestlanguage");
    barURI = Iterables.getFirst(barProject.getSourceFolders(), null).getPath().trimSegments(1).appendSegment("bar.livecontainertestlanguage");
    Map<String, ResourceDescriptionsData> chunks = ImmutableMap.<String, ResourceDescriptionsData>builder().put("foo", createResourceDescriptionData(Collections.singletonList(parseHelper.parse("foo", fooURI, rs0).eResource()))).put("bar", createResourceDescriptionData(Collections.singletonList(parseHelper.parse("bar", barURI, rs0).eResource()))).build();
    rs1 = resourceSetProvider.get();
    new ChunkedResourceDescriptions(chunks, rs1);
    ProjectConfigAdapter.install(rs1, fooProject);
    liveShadowedChunkedResourceDescriptions = provider.get();
    liveShadowedChunkedResourceDescriptions.setContext(rs1);
    fooContainer = new LiveShadowedChunkedContainer(liveShadowedChunkedResourceDescriptions, "foo");
    barContainer = new LiveShadowedChunkedContainer(liveShadowedChunkedResourceDescriptions, "bar");
}
Also used : ResourceDescriptionsData(org.eclipse.xtext.resource.impl.ResourceDescriptionsData) XtextResourceSet(org.eclipse.xtext.resource.XtextResourceSet) WorkspaceConfig(org.eclipse.xtext.workspace.WorkspaceConfig) LiveShadowedChunkedResourceDescriptions(org.eclipse.xtext.resource.impl.LiveShadowedChunkedResourceDescriptions) ChunkedResourceDescriptions(org.eclipse.xtext.resource.impl.ChunkedResourceDescriptions) Before(org.junit.Before)

Example 4 with WorkspaceConfig

use of org.eclipse.xtext.workspace.WorkspaceConfig in project xtext-core by eclipse.

the class MultiRootWorkspaceConfigFactory method getWorkspaceConfig.

@Override
public IWorkspaceConfig getWorkspaceConfig(List<WorkspaceFolder> workspaceFolders) {
    WorkspaceConfig workspaceConfig = new WorkspaceConfig();
    Set<String> existingProjectNames = new HashSet<>();
    for (WorkspaceFolder workspaceFolder : workspaceFolders) addProjectsForWorkspaceFolder(workspaceConfig, workspaceFolder, existingProjectNames);
    return workspaceConfig;
}
Also used : IWorkspaceConfig(org.eclipse.xtext.workspace.IWorkspaceConfig) WorkspaceConfig(org.eclipse.xtext.workspace.WorkspaceConfig) HashSet(java.util.HashSet) WorkspaceFolder(org.eclipse.lsp4j.WorkspaceFolder)

Aggregations

WorkspaceConfig (org.eclipse.xtext.workspace.WorkspaceConfig)4 WorkspaceFolder (org.eclipse.lsp4j.WorkspaceFolder)2 IWorkspaceConfig (org.eclipse.xtext.workspace.IWorkspaceConfig)2 Binder (com.google.inject.Binder)1 Module (com.google.inject.Module)1 HashSet (java.util.HashSet)1 Set (java.util.Set)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 XtextResourceSet (org.eclipse.xtext.resource.XtextResourceSet)1 ChunkedResourceDescriptions (org.eclipse.xtext.resource.impl.ChunkedResourceDescriptions)1 LiveShadowedChunkedResourceDescriptions (org.eclipse.xtext.resource.impl.LiveShadowedChunkedResourceDescriptions)1 ResourceDescriptionsData (org.eclipse.xtext.resource.impl.ResourceDescriptionsData)1 FileProjectConfig (org.eclipse.xtext.workspace.FileProjectConfig)1 Before (org.junit.Before)1