Search in sources :

Example 1 with Event

use of org.eclipse.xtext.resource.IResourceDescription.Event in project xtext-eclipse by eclipse.

the class Bug486584Test method testNoFullBuildIfAttachmentChangeOnly.

@Test
public void testNoFullBuildIfAttachmentChangeOnly() throws CoreException, InterruptedException {
    IJavaProject project = setupProject();
    assertFalse(getEvents().isEmpty());
    getEvents().clear();
    IFile libaryFile = copyAndGetXtendExampleJar(project);
    IClasspathEntry libraryEntry = JavaCore.newLibraryEntry(libaryFile.getFullPath(), null, null);
    addToClasspath(project, libraryEntry);
    build();
    assertEquals(1, getEvents().size());
    Event singleEvent = getEvents().get(0);
    ImmutableList<Delta> deltas = singleEvent.getDeltas();
    assertEquals(1, deltas.size());
    getEvents().clear();
    IClasspathEntry[] classpath = project.getRawClasspath();
    for (int i = 0; i < classpath.length; ++i) {
        IPath entryPath = classpath[i].getPath();
        if (libraryEntry.getPath().equals(entryPath)) {
            IClasspathEntry[] newClasspath = new IClasspathEntry[classpath.length];
            System.arraycopy(classpath, 0, newClasspath, 0, classpath.length);
            classpath[i] = JavaCore.newLibraryEntry(libaryFile.getFullPath(), libaryFile.getFullPath(), null);
            project.setRawClasspath(classpath, null);
        }
    }
    build();
    assertEquals(0, getEvents().size());
}
Also used : IJavaProject(org.eclipse.jdt.core.IJavaProject) IFile(org.eclipse.core.resources.IFile) IPath(org.eclipse.core.runtime.IPath) IClasspathEntry(org.eclipse.jdt.core.IClasspathEntry) Delta(org.eclipse.xtext.resource.IResourceDescription.Delta) Event(org.eclipse.xtext.resource.IResourceDescription.Event) Test(org.junit.Test)

Example 2 with Event

use of org.eclipse.xtext.resource.IResourceDescription.Event in project xtext-eclipse by eclipse.

the class Bug486584Test method testFullBuildWhenClasspathChanged_1.

@Test
public void testFullBuildWhenClasspathChanged_1() throws CoreException, InterruptedException {
    IJavaProject project = setupProject();
    assertFalse(getEvents().isEmpty());
    getEvents().clear();
    IFile libaryFile = copyAndGetXtendExampleJar(project);
    IClasspathEntry libraryEntry = JavaCore.newLibraryEntry(libaryFile.getFullPath(), null, null);
    addToClasspath(project, libraryEntry);
    assertEquals(1, getEvents().size());
    Event singleEvent = getEvents().get(0);
    ImmutableList<Delta> deltas = singleEvent.getDeltas();
    assertEquals(1, deltas.size());
}
Also used : IJavaProject(org.eclipse.jdt.core.IJavaProject) IFile(org.eclipse.core.resources.IFile) IClasspathEntry(org.eclipse.jdt.core.IClasspathEntry) Delta(org.eclipse.xtext.resource.IResourceDescription.Delta) Event(org.eclipse.xtext.resource.IResourceDescription.Event) Test(org.junit.Test)

Example 3 with Event

use of org.eclipse.xtext.resource.IResourceDescription.Event in project xtext-eclipse by eclipse.

the class Bug486584Test method testFullBuildWhenClasspathChanged_2.

@Test
public void testFullBuildWhenClasspathChanged_2() throws CoreException, InterruptedException {
    IJavaProject project = setupProject();
    IFile libaryFile = copyAndGetXtendExampleJar(project);
    IClasspathEntry libraryEntry = JavaCore.newLibraryEntry(libaryFile.getFullPath(), null, null);
    addToClasspath(project, libraryEntry);
    build();
    assertFalse(getEvents().isEmpty());
    getEvents().clear();
    libaryFile.touch(null);
    libaryFile.refreshLocal(IResource.DEPTH_INFINITE, null);
    build();
    assertEquals(1, getEvents().size());
    Event singleEvent = getEvents().get(0);
    ImmutableList<Delta> deltas = singleEvent.getDeltas();
    assertEquals(1, deltas.size());
}
Also used : IJavaProject(org.eclipse.jdt.core.IJavaProject) IFile(org.eclipse.core.resources.IFile) IClasspathEntry(org.eclipse.jdt.core.IClasspathEntry) Delta(org.eclipse.xtext.resource.IResourceDescription.Delta) Event(org.eclipse.xtext.resource.IResourceDescription.Event) Test(org.junit.Test)

Aggregations

IFile (org.eclipse.core.resources.IFile)3 IClasspathEntry (org.eclipse.jdt.core.IClasspathEntry)3 IJavaProject (org.eclipse.jdt.core.IJavaProject)3 Delta (org.eclipse.xtext.resource.IResourceDescription.Delta)3 Event (org.eclipse.xtext.resource.IResourceDescription.Event)3 Test (org.junit.Test)3 IPath (org.eclipse.core.runtime.IPath)1