Search in sources :

Example 1 with ProjectDescriptionBasedContainerManager

use of org.eclipse.xtext.resource.containers.ProjectDescriptionBasedContainerManager in project xtext-eclipse by eclipse.

the class StateBasedContainerManagerTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    IResourcesSetupUtil.setReference(project1, project2);
    uri1 = createFileAndRegisterResource(project1, "file1");
    uri2 = createFileAndRegisterResource(project1, "file2");
    uri3 = createFileAndRegisterResource(project2, "file3");
    Storage2UriMapperImpl mapper = new Storage2UriMapperImpl() {

        @Override
        public boolean isValidUri(URI uri, IStorage storage) {
            return uri != null && !uri.toString().endsWith("/.project");
        }
    };
    mapper.setUriValidator(new UriValidator() {

        @Override
        public boolean isPossiblyManaged(IStorage storage) {
            return true;
        }

        @Override
        public boolean isValid(URI uri, IStorage storage) {
            return true;
        }
    });
    projectsState = new WorkspaceProjectsState();
    projectsState.setMapper(mapper);
    WorkspaceProjectsStateHelper helper = new WorkspaceProjectsStateHelper();
    helper.setMapper(mapper);
    helper.setWorkspace(ResourcesPlugin.getWorkspace());
    projectsState.setHelper(helper);
    containerManager = new StateBasedContainerManager();
    containerManager.setStateProvider(this);
    containerManager.setDelegate(new ProjectDescriptionBasedContainerManager());
}
Also used : WorkspaceProjectsState(org.eclipse.xtext.ui.containers.WorkspaceProjectsState) StateBasedContainerManager(org.eclipse.xtext.resource.containers.StateBasedContainerManager) ProjectDescriptionBasedContainerManager(org.eclipse.xtext.resource.containers.ProjectDescriptionBasedContainerManager) Storage2UriMapperImpl(org.eclipse.xtext.ui.resource.Storage2UriMapperImpl) WorkspaceProjectsStateHelper(org.eclipse.xtext.ui.containers.WorkspaceProjectsStateHelper) UriValidator(org.eclipse.xtext.ui.resource.UriValidator) IStorage(org.eclipse.core.resources.IStorage) URI(org.eclipse.emf.common.util.URI)

Aggregations

IStorage (org.eclipse.core.resources.IStorage)1 URI (org.eclipse.emf.common.util.URI)1 ProjectDescriptionBasedContainerManager (org.eclipse.xtext.resource.containers.ProjectDescriptionBasedContainerManager)1 StateBasedContainerManager (org.eclipse.xtext.resource.containers.StateBasedContainerManager)1 WorkspaceProjectsState (org.eclipse.xtext.ui.containers.WorkspaceProjectsState)1 WorkspaceProjectsStateHelper (org.eclipse.xtext.ui.containers.WorkspaceProjectsStateHelper)1 Storage2UriMapperImpl (org.eclipse.xtext.ui.resource.Storage2UriMapperImpl)1 UriValidator (org.eclipse.xtext.ui.resource.UriValidator)1