@Test public void testAddToBrokenPlugin() throws Exception { pluginProjectFactory.setProjectName("test"); pluginProjectFactory.addFolders(Collections.singletonList("src")); pluginProjectFactory.addBuilderIds( JavaCore.BUILDER_ID, "org.eclipse.pde.ManifestBuilder", "org.eclipse.pde.SchemaBuilder", XtextProjectHelper.BUILDER_ID); pluginProjectFactory.addProjectNatures( JavaCore.NATURE_ID, "org.eclipse.pde.PluginNature", XtextProjectHelper.NATURE_ID); IProject project = pluginProjectFactory.createProject(null, null); IJavaProject javaProject = JavaCore.create(project); JavaProjectSetupUtil.makeJava5Compliant(javaProject); project.findMember("META-INF").delete(true, null); IFile file = project.getFile("src/Foo.xtend"); file.create( new StringInputStream( "import org.eclipse.xtend.lib.annotations.Accessors class Foo { @Accessors int bar }"), true, null); syncUtil.waitForBuild(null); markerAssert.assertErrorMarker(file, IssueCodes.XBASE_LIB_NOT_ON_CLASSPATH); adder.addLibsToClasspath(javaProject, null); waitForAutoBuild(); syncUtil.waitForBuild(null); markerAssert.assertNoErrorMarker(file); }
/** * Behavior relies on scheduled jobs which are not really builds but still belong to the {@link * org.eclipse.core.resources.ResourcesPlugin#FAMILY_AUTO_BUILD} thus we wait for that one here. */ protected void waitForAutoBuild() { // changing classpath triggers multiple builds, the first one only sets forgetlastBuildState // we need to wait for that IResourcesSetupUtil.reallyWaitForAutoBuild(); // now lets do a build syncUtil.waitForBuild(null); }