public static IWorkspaceRoot setupWorkspace() throws CoreException, IOException, InvocationTargetException, InterruptedException { if (isSetup) { clearDoiModel(); return workspaceRoot; } taskscape = new InteractionContext(HELPER_CONTEXT_ID, new InteractionContextScaling()); workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); project1 = ContextTestUtil.createJavaPluginProjectFromZip("project1", "project1.zip"); project2 = ContextTestUtil.createJavaPluginProjectFromZip("project2", "project2.zip"); jdtCoreDomProject = new TestJavaProject("workspace-helper-project"); IPackageFragment jdtCoreDomPkg = jdtCoreDomProject.createPackage("org.eclipse.jdt.core.dom"); IType astNodeType = jdtCoreDomProject.createType(jdtCoreDomPkg, "ASTNode.java", "public class ASTNode { }"); astNodeType.createMethod( "public final void setSourceRange(int startPosition, int length) { }", null, false, null); isSetup = true; project1.open(new NullProgressMonitor()); project2.open(new NullProgressMonitor()); jdtCoreDomProject.getJavaProject().open(new NullProgressMonitor()); return workspaceRoot; }
public static IJavaProject getJdtCoreDomProject() throws CoreException, IOException, InvocationTargetException, InterruptedException { if (!isSetup) { setupWorkspace(); } return jdtCoreDomProject.getJavaProject(); }