Search in sources :

Example 1 with NonJavaResource

use of org.eclipse.jdt.internal.core.NonJavaResource in project xtext-eclipse by eclipse.

the class Storage2UriMapperJdtImplTest method testBug463258_04.

@Test
public void testBug463258_04() throws Exception {
    IFolder externalFolder = createExternalFolder("externalFolder");
    IJavaProject project = createJavaProject("foo");
    addExternalFolderToClasspath(project, externalFolder);
    Storage2UriMapperJavaImpl impl = getStorage2UriMapper();
    IPackageFragmentRoot root = project.getPackageFragmentRoot(externalFolder);
    IPackageFragment foo = root.getPackageFragment("foo");
    NonJavaResource fileInFolder = new NonJavaResource(foo, externalFolder.getFile("foo/does.notexist"));
    externalFolder.delete(true, null);
    URI uri = impl.getUri(fileInFolder);
    assertNull(uri);
}
Also used : IPackageFragment(org.eclipse.jdt.core.IPackageFragment) IJavaProject(org.eclipse.jdt.core.IJavaProject) Storage2UriMapperJavaImpl(org.eclipse.xtext.ui.resource.Storage2UriMapperJavaImpl) NonJavaResource(org.eclipse.jdt.internal.core.NonJavaResource) URI(org.eclipse.emf.common.util.URI) IFolder(org.eclipse.core.resources.IFolder) IPackageFragmentRoot(org.eclipse.jdt.core.IPackageFragmentRoot) Test(org.junit.Test)

Example 2 with NonJavaResource

use of org.eclipse.jdt.internal.core.NonJavaResource in project xtext-eclipse by eclipse.

the class JavaClassPathResourceForIEditorInputFactoryTest method testBug463258_04.

@Test(expected = CoreException.class)
public void testBug463258_04() throws Throwable {
    IFolder externalFolder = createExternalFolder("externalFolder");
    IJavaProject project = createJavaProject("foo");
    addExternalFolderToClasspath(project, externalFolder);
    IPackageFragmentRoot root = project.getPackageFragmentRoot(externalFolder);
    IPackageFragment foo = root.getPackageFragment("foo");
    NonJavaResource fileInFolder = new NonJavaResource(foo, externalFolder.getFile("foo/doesNotExist.testlanguage"));
    externalFolder.delete(true, null);
    XtextReadonlyEditorInput editorInput = new XtextReadonlyEditorInput(fileInFolder);
    try {
        factory.createResource(editorInput);
    } catch (WrappedException e) {
        throw e.getCause();
    }
}
Also used : XtextReadonlyEditorInput(org.eclipse.xtext.ui.editor.XtextReadonlyEditorInput) IPackageFragment(org.eclipse.jdt.core.IPackageFragment) WrappedException(org.eclipse.emf.common.util.WrappedException) IJavaProject(org.eclipse.jdt.core.IJavaProject) NonJavaResource(org.eclipse.jdt.internal.core.NonJavaResource) IFolder(org.eclipse.core.resources.IFolder) IPackageFragmentRoot(org.eclipse.jdt.core.IPackageFragmentRoot) Test(org.junit.Test) AbstractWorkbenchTest(org.eclipse.xtext.ui.testing.AbstractWorkbenchTest)

Aggregations

IFolder (org.eclipse.core.resources.IFolder)2 IJavaProject (org.eclipse.jdt.core.IJavaProject)2 IPackageFragment (org.eclipse.jdt.core.IPackageFragment)2 IPackageFragmentRoot (org.eclipse.jdt.core.IPackageFragmentRoot)2 NonJavaResource (org.eclipse.jdt.internal.core.NonJavaResource)2 Test (org.junit.Test)2 URI (org.eclipse.emf.common.util.URI)1 WrappedException (org.eclipse.emf.common.util.WrappedException)1 XtextReadonlyEditorInput (org.eclipse.xtext.ui.editor.XtextReadonlyEditorInput)1 Storage2UriMapperJavaImpl (org.eclipse.xtext.ui.resource.Storage2UriMapperJavaImpl)1 AbstractWorkbenchTest (org.eclipse.xtext.ui.testing.AbstractWorkbenchTest)1