Search in sources :

Example 1 with Storage2UriMapperImpl

use of org.eclipse.xtext.ui.resource.Storage2UriMapperImpl in project xtext-eclipse by eclipse.

the class JavaProjectsStateTest method createProjectsState.

@Override
protected JavaProjectsState createProjectsState(IStorage2UriMapper mapper) {
    JavaProjectsState result = new JavaProjectsState();
    result.setMapper(mapper);
    result.setJdtHelper(new JdtHelper());
    JavaProjectsStateHelper javaProjectsStateHelper = new JavaProjectsStateHelper();
    javaProjectsStateHelper.setMapper(mapper);
    javaProjectsStateHelper.setUriMapperExtensions((IStorage2UriMapperJdtExtensions) ((Storage2UriMapperImpl) mapper).getContribution());
    javaProjectsStateHelper.setWorkspace(ResourcesPlugin.getWorkspace());
    result.setJavaProjectsHelper(javaProjectsStateHelper);
    WorkspaceProjectsStateHelper workspaceStateHelper = new WorkspaceProjectsStateHelper();
    workspaceStateHelper.setMapper(mapper);
    workspaceStateHelper.setWorkspace(ResourcesPlugin.getWorkspace());
    result.setProjectsHelper(workspaceStateHelper);
    return result;
}
Also used : JavaProjectsState(org.eclipse.xtext.ui.containers.JavaProjectsState) JavaProjectsStateHelper(org.eclipse.xtext.ui.containers.JavaProjectsStateHelper) Storage2UriMapperImpl(org.eclipse.xtext.ui.resource.Storage2UriMapperImpl) WorkspaceProjectsStateHelper(org.eclipse.xtext.ui.containers.WorkspaceProjectsStateHelper) JdtHelper(org.eclipse.xtext.ui.shared.JdtHelper)

Example 2 with Storage2UriMapperImpl

use of org.eclipse.xtext.ui.resource.Storage2UriMapperImpl 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)

Example 3 with Storage2UriMapperImpl

use of org.eclipse.xtext.ui.resource.Storage2UriMapperImpl in project xtext-eclipse by eclipse.

the class AbstractJavaProjectsStateTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    javaProject1 = makeJavaProject(project1);
    addSourceFolder(javaProject1, "src2");
    uri1 = createFileAndRegisterResource(project1, "src/file1");
    uri2 = createFileAndRegisterResource(project1, "src/file2");
    uri3 = createFileAndRegisterResource(project2, "src2/file3");
    IResource member = javaProject1.getProject().findMember("src");
    srcRoot = javaProject1.getPackageFragmentRoot(member);
    Storage2UriMapperImpl mapper = new Storage2UriMapperImpl() {

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

        @Override
        public boolean isValid(URI uri, IStorage storage) {
            return "name".equals(uri.fileExtension());
        }

        @Override
        public boolean isPossiblyManaged(IStorage storage) {
            return "name".equals(storage.getFullPath().getFileExtension());
        }
    };
    mapper.setUriValidator(uriValidator);
    Storage2UriMapperJavaImpl contribution = new Storage2UriMapperJavaImpl();
    contribution.setUriValidator(uriValidator);
    contribution.setJdtHelper(new JdtHelper());
    contribution.setLocator(new JarEntryLocator());
    contribution.setHost(mapper);
    mapper.setContribution(contribution);
    projectsState = createProjectsState(mapper);
}
Also used : Storage2UriMapperImpl(org.eclipse.xtext.ui.resource.Storage2UriMapperImpl) Storage2UriMapperJavaImpl(org.eclipse.xtext.ui.resource.Storage2UriMapperJavaImpl) JdtHelper(org.eclipse.xtext.ui.shared.JdtHelper) JarEntryLocator(org.eclipse.xtext.ui.resource.JarEntryLocator) UriValidator(org.eclipse.xtext.ui.resource.UriValidator) IStorage(org.eclipse.core.resources.IStorage) URI(org.eclipse.emf.common.util.URI) IResource(org.eclipse.core.resources.IResource)

Example 4 with Storage2UriMapperImpl

use of org.eclipse.xtext.ui.resource.Storage2UriMapperImpl in project xtext-eclipse by eclipse.

the class StrictJavaProjectsStateTest method createProjectsState.

@Override
protected StrictJavaProjectsState createProjectsState(IStorage2UriMapper mapper) {
    StrictJavaProjectsState result = new StrictJavaProjectsState();
    result.setMapper(mapper);
    result.setJdtHelper(new JdtHelper());
    JavaProjectsStateHelper javaProjectsStateHelper = new JavaProjectsStateHelper();
    javaProjectsStateHelper.setMapper(mapper);
    javaProjectsStateHelper.setUriMapperExtensions((IStorage2UriMapperJdtExtensions) ((Storage2UriMapperImpl) mapper).getContribution());
    javaProjectsStateHelper.setWorkspace(ResourcesPlugin.getWorkspace());
    result.setHelper(javaProjectsStateHelper);
    return result;
}
Also used : JavaProjectsStateHelper(org.eclipse.xtext.ui.containers.JavaProjectsStateHelper) Storage2UriMapperImpl(org.eclipse.xtext.ui.resource.Storage2UriMapperImpl) JdtHelper(org.eclipse.xtext.ui.shared.JdtHelper) StrictJavaProjectsState(org.eclipse.xtext.ui.containers.StrictJavaProjectsState)

Example 5 with Storage2UriMapperImpl

use of org.eclipse.xtext.ui.resource.Storage2UriMapperImpl in project xtext-eclipse by eclipse.

the class WorkspaceProjectsStateTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    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 isValid(URI uri, IStorage storage) {
            return true;
        }

        @Override
        public boolean isPossiblyManaged(IStorage storage) {
            return true;
        }
    });
    projectsState = new WorkspaceProjectsState();
    projectsState.setMapper(mapper);
    WorkspaceProjectsStateHelper helper = new WorkspaceProjectsStateHelper();
    helper.setMapper(mapper);
    helper.setWorkspace(ResourcesPlugin.getWorkspace());
    projectsState.setHelper(helper);
}
Also used : WorkspaceProjectsState(org.eclipse.xtext.ui.containers.WorkspaceProjectsState) 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

Storage2UriMapperImpl (org.eclipse.xtext.ui.resource.Storage2UriMapperImpl)6 IStorage (org.eclipse.core.resources.IStorage)4 URI (org.eclipse.emf.common.util.URI)4 UriValidator (org.eclipse.xtext.ui.resource.UriValidator)4 WorkspaceProjectsStateHelper (org.eclipse.xtext.ui.containers.WorkspaceProjectsStateHelper)3 JdtHelper (org.eclipse.xtext.ui.shared.JdtHelper)3 JavaProjectsStateHelper (org.eclipse.xtext.ui.containers.JavaProjectsStateHelper)2 WorkspaceProjectsState (org.eclipse.xtext.ui.containers.WorkspaceProjectsState)2 IFile (org.eclipse.core.resources.IFile)1 IResource (org.eclipse.core.resources.IResource)1 ProjectDescriptionBasedContainerManager (org.eclipse.xtext.resource.containers.ProjectDescriptionBasedContainerManager)1 StateBasedContainerManager (org.eclipse.xtext.resource.containers.StateBasedContainerManager)1 JavaProjectsState (org.eclipse.xtext.ui.containers.JavaProjectsState)1 StrictJavaProjectsState (org.eclipse.xtext.ui.containers.StrictJavaProjectsState)1 JarEntryLocator (org.eclipse.xtext.ui.resource.JarEntryLocator)1 Storage2UriMapperJavaImpl (org.eclipse.xtext.ui.resource.Storage2UriMapperJavaImpl)1 Test (org.junit.Test)1