Search in sources :

Example 1 with IWorkspaceConfig

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

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

the class WorkspaceManager method refreshWorkspaceConfig.

/**
 * Refresh the workspace.
 */
protected void refreshWorkspaceConfig(CancelIndicator cancelIndicator) {
    IWorkspaceConfig newWorkspaceConfig = createWorkspaceConfig();
    setWorkspaceConfig(newWorkspaceConfig);
    List<ProjectDescription> newProjects = new ArrayList<>();
    Set<String> projectNames = projectName2ProjectManager.keySet();
    Set<String> remainingProjectNames = new HashSet<>(projectNames);
    for (IProjectConfig projectConfig : getWorkspaceConfig().getProjects()) {
        if (projectName2ProjectManager.containsKey(projectConfig.getName())) {
            remainingProjectNames.remove(projectConfig.getName());
        } else {
            ProjectManager projectManager = projectManagerProvider.get();
            ProjectDescription projectDescription = projectDescriptionFactory.getProjectDescription(projectConfig);
            projectManager.initialize(projectDescription, projectConfig, issueAcceptor, openedDocumentsContentProvider, () -> fullIndex, cancelIndicator);
            projectName2ProjectManager.put(projectDescription.getName(), projectManager);
            newProjects.add(projectDescription);
        }
    }
    for (String deletedProject : remainingProjectNames) {
        ProjectManager projectManager = projectName2ProjectManager.remove(deletedProject);
        projectManager.aboutToRemoveFromWorkspace();
        fullIndex.remove(deletedProject);
    }
    afterBuild(buildManager.doInitialBuild(newProjects, cancelIndicator));
}
Also used : IWorkspaceConfig(org.eclipse.xtext.workspace.IWorkspaceConfig) ArrayList(java.util.ArrayList) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) IProjectConfig(org.eclipse.xtext.workspace.IProjectConfig) ProjectDescription(org.eclipse.xtext.resource.impl.ProjectDescription) HashSet(java.util.HashSet)

Example 3 with IWorkspaceConfig

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

the class LiveShadowedChunkedContainer method getProjectConfig.

protected IProjectConfig getProjectConfig() {
    if ((!this.isProjectConfigSet)) {
        IWorkspaceConfig _workspaceConfig = this.descriptions.getWorkspaceConfig();
        IProjectConfig _findProjectByName = null;
        if (_workspaceConfig != null) {
            _findProjectByName = _workspaceConfig.findProjectByName(this.containerName);
        }
        this.projectConfig = _findProjectByName;
        this.isProjectConfigSet = true;
    }
    return this.projectConfig;
}
Also used : IWorkspaceConfig(org.eclipse.xtext.workspace.IWorkspaceConfig) IProjectConfig(org.eclipse.xtext.workspace.IProjectConfig)

Example 4 with IWorkspaceConfig

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

IWorkspaceConfig (org.eclipse.xtext.workspace.IWorkspaceConfig)4 HashSet (java.util.HashSet)2 IProjectConfig (org.eclipse.xtext.workspace.IProjectConfig)2 WorkspaceConfig (org.eclipse.xtext.workspace.WorkspaceConfig)2 ArrayList (java.util.ArrayList)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 WorkspaceFolder (org.eclipse.lsp4j.WorkspaceFolder)1 ProjectDescription (org.eclipse.xtext.resource.impl.ProjectDescription)1