Search in sources :

Example 1 with WorkspaceLockAccess

use of org.eclipse.xtext.ui.workspace.WorkspaceLockAccess in project xtext-eclipse by eclipse.

the class Storage2UriMapperJavaImplTest method createFreshStorage2UriMapper.

protected Storage2UriMapperJavaImpl createFreshStorage2UriMapper() {
    Storage2UriMapperJavaImpl mapper = new Storage2UriMapperJavaImpl();
    mapper.setUriValidator(new UriValidator() {

        @Override
        public boolean isPossiblyManaged(IStorage storage) {
            return "indexed".equals(storage.getFullPath().getFileExtension());
        }

        @Override
        public boolean isValid(URI uri, IStorage storage) {
            return "indexed".equals(storage.getFullPath().getFileExtension());
        }
    });
    mapper.setLocator(new JarEntryLocator());
    mapper.setWorkspace(ResourcesPlugin.getWorkspace());
    mapper.setWorkspaceLockAccess(new WorkspaceLockAccess());
    mapper.setJavaProjectClasspathChangeAnalyzer(new JavaProjectClasspathChangeAnalyzer());
    return mapper;
}
Also used : WorkspaceLockAccess(org.eclipse.xtext.ui.workspace.WorkspaceLockAccess) Storage2UriMapperJavaImpl(org.eclipse.xtext.ui.resource.Storage2UriMapperJavaImpl) JarEntryLocator(org.eclipse.xtext.ui.resource.JarEntryLocator) UriValidator(org.eclipse.xtext.ui.resource.UriValidator) IStorage(org.eclipse.core.resources.IStorage) JavaProjectClasspathChangeAnalyzer(org.eclipse.xtext.ui.util.JavaProjectClasspathChangeAnalyzer) URI(org.eclipse.emf.common.util.URI)

Example 2 with WorkspaceLockAccess

use of org.eclipse.xtext.ui.workspace.WorkspaceLockAccess 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.setWorkspaceLockAccess(new WorkspaceLockAccess());
    contribution.setLocator(new JarEntryLocator());
    contribution.setHost(mapper);
    mapper.setContribution(contribution);
    projectsState = createProjectsState(mapper);
}
Also used : WorkspaceLockAccess(org.eclipse.xtext.ui.workspace.WorkspaceLockAccess) 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)

Aggregations

IStorage (org.eclipse.core.resources.IStorage)2 URI (org.eclipse.emf.common.util.URI)2 JarEntryLocator (org.eclipse.xtext.ui.resource.JarEntryLocator)2 Storage2UriMapperJavaImpl (org.eclipse.xtext.ui.resource.Storage2UriMapperJavaImpl)2 UriValidator (org.eclipse.xtext.ui.resource.UriValidator)2 WorkspaceLockAccess (org.eclipse.xtext.ui.workspace.WorkspaceLockAccess)2 IResource (org.eclipse.core.resources.IResource)1 Storage2UriMapperImpl (org.eclipse.xtext.ui.resource.Storage2UriMapperImpl)1 JdtHelper (org.eclipse.xtext.ui.shared.JdtHelper)1 JavaProjectClasspathChangeAnalyzer (org.eclipse.xtext.ui.util.JavaProjectClasspathChangeAnalyzer)1