Java Code Examples for org.eclipse.xtext.ui.testing.util.JavaProjectSetupUtil#findJavaProject()

The following examples show how to use org.eclipse.xtext.ui.testing.util.JavaProjectSetupUtil#findJavaProject() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Bug462915Test.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public IJavaProject getJavaProject(final ResourceSet resourceSet) {
  IJavaProject javaProject = JavaProjectSetupUtil.findJavaProject(Bug462915Test.NO_GUICE_PROJECT_NAME);
  if (((javaProject == null) || (!javaProject.exists()))) {
    try {
      this.noGuiceProject = WorkbenchTestHelper.createPluginProject(Bug462915Test.NO_GUICE_PROJECT_NAME, ((String[])Conversions.unwrapArray(this.getTestProjectRequiredBundles(), String.class)));
      javaProject = JavaProjectSetupUtil.findJavaProject(Bug462915Test.NO_GUICE_PROJECT_NAME);
    } catch (final Throwable _t) {
      if (_t instanceof CoreException) {
        final CoreException e = (CoreException)_t;
        String _message = e.getMessage();
        String _plus = ("cannot create java project due to: " + _message);
        String _plus_1 = (_plus + " / ");
        String _plus_2 = (_plus_1 + e);
        Assert.fail(_plus_2);
      } else {
        throw Exceptions.sneakyThrow(_t);
      }
    }
  }
  return javaProject;
}
 
Example 2
Source File: AbstractXbaseContentAssistBugTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public IJavaProject getJavaProject(ResourceSet resourceSet) {
	String projectName = getProjectName();
	IJavaProject javaProject = JavaProjectSetupUtil.findJavaProject(projectName);
	if (javaProject == null || !javaProject.exists()) {
		try {
			demandCreateProject = createPluginProject(projectName);
			javaProject = JavaProjectSetupUtil.findJavaProject(projectName);
		} catch (CoreException e) {
			Assert.fail("cannot create java project due to: " + e.getMessage() + " / " + e);
		}
	}
	return javaProject;
}
 
Example 3
Source File: AbstractXbaseQuickfixTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public IJavaProject getJavaProject(ResourceSet resourceSet) {
	String projectName = getProjectName();
	IJavaProject javaProject = JavaProjectSetupUtil.findJavaProject(projectName);
	if (javaProject == null || !javaProject.exists()) {
		try {
			demandCreateProject = AbstractXbaseUITestCase.createPluginProject(projectName);
			javaProject = JavaProjectSetupUtil.findJavaProject(projectName);
		} catch (CoreException e) {
			Assert.fail("cannot create java project due to: " + e.getMessage() + " / " + e);
		}
	}
	return javaProject;
}
 
Example 4
Source File: AbstractXtendUITestCase.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
protected void setJavaVersion(JavaVersion javaVersion) throws Exception {
	IJavaProject javaProject = JavaProjectSetupUtil.findJavaProject(WorkbenchTestHelper.TESTPROJECT_NAME);
	Pair<String,Boolean> result = WorkbenchTestHelper.changeBree(javaProject, javaVersion);
	IExecutionEnvironment execEnv = JavaRuntime.getExecutionEnvironmentsManager().getEnvironment(result.getKey());
	Assume.assumeNotNull("Execution environment not found for: " + javaVersion.getLabel(), execEnv);
	Assume.assumeTrue("No compatible VM was found for: " + javaVersion.getLabel(),
			execEnv.getCompatibleVMs().length > 0);
	if(result.getValue()) {
		WorkbenchTestHelper.makeCompliantFor(javaProject, javaVersion);
		IResourcesSetupUtil.reallyWaitForAutoBuild();
	}
}