Java Code Examples for org.eclipse.core.resources.IProject#create()

The following examples show how to use org.eclipse.core.resources.IProject#create() . 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: NewSlrProjectWizard.java    From slr-toolkit with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public boolean performFinish() {
	// create the project set up in the first wizard page
	IProject project = firstPage.getProjectHandle();
	try {
		project.create(null);
		project.open(null);
		createResourceFile(project, secondPage, BIBTEX_RESOURCE);
		createResourceFile(project, thirdPage, TAXONOMY_RESOURCE);
		createResourceFile(project, fourthPage, METAINFORMATION_RESOURCE);
		SlrProjectSupport.addNature(project);
	} catch (CoreException e) {
		e.printStackTrace();
		return false;
	}
	return true;
}
 
Example 2
Source File: ExampleImporter.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
public IProject importExample(ExampleData edata, IProgressMonitor monitor) {
	try {
		IProjectDescription original = ResourcesPlugin.getWorkspace()
				.loadProjectDescription(new Path(edata.getProjectDir().getAbsolutePath()).append("/.project"));
		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(edata.getProjectDir().getName());

		IProjectDescription clone = ResourcesPlugin.getWorkspace().newProjectDescription(original.getName());
		clone.setBuildSpec(original.getBuildSpec());
		clone.setComment(original.getComment());
		clone.setDynamicReferences(original.getDynamicReferences());
		clone.setNatureIds(original.getNatureIds());
		clone.setReferencedProjects(original.getReferencedProjects());
		if (project.exists()) {
			return project;
		}
		project.create(clone, monitor);
		project.open(monitor);

		@SuppressWarnings("unchecked")
		List<IFile> filesToImport = FileSystemStructureProvider.INSTANCE.getChildren(edata.getProjectDir());
		ImportOperation io = new ImportOperation(project.getFullPath(), edata.getProjectDir(),
				FileSystemStructureProvider.INSTANCE, new IOverwriteQuery() {

					@Override
					public String queryOverwrite(String pathString) {
						return IOverwriteQuery.ALL;
					}

				}, filesToImport);
		io.setOverwriteResources(true);
		io.setCreateContainerStructure(false);
		io.run(monitor);
		project.refreshLocal(IProject.DEPTH_INFINITE, monitor);
		return project;
	} catch (Exception e) {
		e.printStackTrace();
	}
	return null;
}
 
Example 3
Source File: BazelProjectSupport.java    From eclipse with Apache License 2.0 6 votes vote down vote up
private static IProject createBaseProject(String projectName, URI location) {
  IProject newProject = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);

  if (!newProject.exists()) {
    URI projectLocation = location;
    IProjectDescription desc =
        newProject.getWorkspace().newProjectDescription(newProject.getName());
    if (location != null
        && ResourcesPlugin.getWorkspace().getRoot().getLocationURI().equals(location)) {
      projectLocation = null;
    }

    desc.setLocationURI(projectLocation);
    try {
      newProject.create(desc, null);
      if (!newProject.isOpen()) {
        newProject.open(null);
      }
    } catch (CoreException e) {
      e.printStackTrace();
    }
  }

  return newProject;
}
 
Example 4
Source File: AbstractCorrosionTest.java    From corrosion with Eclipse Public License 2.0 6 votes vote down vote up
/**
 *
 * @param projectName
 *            the name that will be used as prefix for the project, and that
 *            will be used to find the content of the project from the plugin
 *            "projects" folder
 * @throws IOException
 * @throws CoreException
 */
protected IProject provisionProject(String projectName) throws IOException, CoreException {
	URL url = FileLocator.find(Platform.getBundle("org.eclipse.corrosion.tests"),
			Path.fromPortableString("projects/" + projectName), Collections.emptyMap());
	url = FileLocator.toFileURL(url);
	File folder = new File(url.getFile());
	if (folder.exists()) {
		IProject project = ResourcesPlugin.getWorkspace().getRoot()
				.getProject(projectName + "_" + getClass().getName() + "_" + System.currentTimeMillis());
		project.create(new NullProgressMonitor());
		this.provisionedProjects.put(projectName, project);
		FileUtils.copyDirectory(folder, project.getLocation().toFile());
		project.open(new NullProgressMonitor());
		project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
		return project;
	} 			
	return null;
}
 
Example 5
Source File: HybridProjectCreator.java    From thym with Eclipse Public License 1.0 6 votes vote down vote up
private IProject createBasicProject( String name, URI location, IProgressMonitor monitor ) throws CoreException {
    
    IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
    IProject newProject = workspaceRoot.getProject(name);
    
    if ( !newProject.exists() ){
        IProjectDescription description = newProject.getWorkspace().newProjectDescription(name);
        if( location != null ){
            description.setLocationURI(location);
        }
        
        newProject.create(description, monitor);
        if( !newProject.isOpen() ){
            newProject.open(monitor);
        }
    }
    return newProject;
}
 
Example 6
Source File: TexlipseProjectCreationOperation.java    From texlipse with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Create the project directory.
 * If the user has specified an external project location,
 * the project is created with a custom description for the location.
 * 
 * @param project project
 * @param monitor progress monitor
 * @throws CoreException
 */
private void createProject(IProject project, IProgressMonitor monitor)
        throws CoreException {

    monitor.subTask(TexlipsePlugin.getResourceString("projectWizardProgressDirectory"));
    
    if (!project.exists()) {
        if (attributes.getProjectLocation() != null) {
            IProjectDescription desc = project.getWorkspace().newProjectDescription(project.getName());
            IPath projectPath = new Path(attributes.getProjectLocation());
            IStatus stat = ResourcesPlugin.getWorkspace().validateProjectLocation(project, projectPath);
            if (stat.getSeverity() != IStatus.OK) {
                // should not happen. the location should have been checked in the wizard page
                throw new CoreException(stat);
            }
            desc.setLocation(projectPath);
            project.create(desc, monitor);
        } else {
            project.create(monitor);
        }
    }
    if (!project.isOpen()) {
        project.open(monitor);
    }
}
 
Example 7
Source File: Utils.java    From wildwebdeveloper with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Provisions a project that's part of the "testProjects"
 * @param folderName the folderName under "testProjects" to provision from
 * @return the provisioned project
 * @throws CoreException
 * @throws IOException
 */
public static IProject provisionTestProject(String folderName) throws CoreException, IOException {
	URL url = FileLocator.find(Platform.getBundle("org.eclipse.wildwebdeveloper.tests"),
			Path.fromPortableString("testProjects/" + folderName), null);
	url = FileLocator.toFileURL(url);
	File folder = new File(url.getFile());
	if (folder.exists()) {
		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("testProject" + System.nanoTime());
		project.create(null);
		project.open(null);
		java.nio.file.Path sourceFolder = folder.toPath();
		java.nio.file.Path destFolder = project.getLocation().toFile().toPath();

		Files.walk(sourceFolder).forEach(source -> {
			try {
				Files.copy(source, destFolder.resolve(sourceFolder.relativize(source)), StandardCopyOption.REPLACE_EXISTING);
			} catch (IOException e) {
				e.printStackTrace();
			}
		});
		project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
		return project;
	}
	return null;
}
 
Example 8
Source File: TestYaml.java    From wildwebdeveloper with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void testFalseDetectionAsKubernetes() throws Exception {
	IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject("p");
	p.create(new NullProgressMonitor());
	p.open(new NullProgressMonitor());
	IFile file = p.getFile("blah.yaml");
	file.create(new ByteArrayInputStream(new byte[0]), true, new NullProgressMonitor());
	IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
	ITextEditor editor = (ITextEditor)IDE.openEditor(activePage, file, true);
	IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
	document.set("name: a\ndescrition: b");
	boolean markerFound = new DisplayHelper() {
		@Override protected boolean condition() {
			try {
				return file.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_ZERO).length > 0;
			} catch (CoreException e) {
				return false;
			}
		}
	}.waitForCondition(activePage.getWorkbenchWindow().getShell().getDisplay(), 3000);
	assertFalse(Arrays.stream(file.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_ZERO)).map(Object::toString).collect(Collectors.joining("\n")), markerFound);
}
 
Example 9
Source File: NewProjectCreator.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
private static IProject createProject(String projectName, String location) {
    IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
    String workspacePath = ResourceUtils.getAbsolutePath(workspaceRoot);
    String differentCasingProjectName = ResourceUtils.checkResourceExistWithDifferentCasing(workspaceRoot, projectName);
    if (differentCasingProjectName != null) {
        projectName = differentCasingProjectName;
    }
    
    cleanProjectArea(projectName, location);
    
    IProject newProject = workspaceRoot
            .getProject(projectName);
    
    URI projectLocation = new File(location).toURI();
    IProjectDescription desc = newProject.getWorkspace().newProjectDescription(newProject.getName());
    String locationParent = new File(location).getParent();
    if (location != null && (workspacePath.equals(location) || workspacePath.equals(locationParent))) {
        projectLocation = null;
    } else if (location == null) {
        projectLocation = null;
    }
    desc.setLocationURI(projectLocation);
    try {
        newProject.create(desc, null);
    } catch (CoreException e) {
        LogHelper.logError(e);
    }

    return newProject;
}
 
Example 10
Source File: AbstractJavaGeneratorTest.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
public IMarker[] generateAndCompile(Statechart statechart) throws Exception {
	GeneratorEntry entry = createGeneratorEntry(statechart.getName(), SRC_GEN);
	entry.setElementRef(statechart);
	IProject targetProject = getProject(entry);
	targetProject.delete(true, new NullProgressMonitor());
	targetProject = getProject(entry);
	if (!targetProject.exists()) {
		targetProject.create(new NullProgressMonitor());
		targetProject.open(new NullProgressMonitor());
	}
	IGeneratorEntryExecutor executor = new EclipseContextGeneratorExecutorLookup() {
		protected Module getContextModule() {
			return Modules.override(super.getContextModule()).with(new Module() {
				@Override
				public void configure(Binder binder) {
					binder.bind(IConsoleLogger.class).to(TestLogger.class);
				}
			});
		};
	}.createExecutor(entry, "yakindu::java");
	executor.execute(entry);
	targetProject.refreshLocal(IResource.DEPTH_INFINITE, null);
	targetProject.getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null);
	targetProject.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new NullProgressMonitor());
	IMarker[] markers = targetProject.findMarkers(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, true,
			IResource.DEPTH_INFINITE);
	return markers;
}
 
Example 11
Source File: XbaseResourceForEditorInputFactoryTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testValidationIsDisabled_01() throws Exception {
	IProject project = workspace.getRoot().getProject("simpleProject");
	project.create(null);
	project.open(null);
	IFile file = project.getFile("Hello.xtext");
	InputStream stream = new InputStream() {
		@Override
		public int read() throws IOException {
			return -1;
		}
	};
	file.create(stream, true, null);
	assertTrue(isValidationDisabled(file));
}
 
Example 12
Source File: TestHTML.java    From wildwebdeveloper with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testFormat() throws Exception {
	final IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("testHTMLFile" + System.currentTimeMillis());
	project.create(null);
	project.open(null);
	final IFile file = project.getFile("blah.html");
	file.create(new ByteArrayInputStream("<html><body><a></a></body></html>".getBytes()), true, null);
	ITextEditor editor = (ITextEditor) IDE
			.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), file);
	editor.setFocus();
	editor.getSelectionProvider().setSelection(new TextSelection(0, 0));
	IHandlerService handlerService = PlatformUI.getWorkbench().getService(IHandlerService.class);
	AtomicReference<Exception> ex = new AtomicReference<>();
	new DisplayHelper() {
		@Override protected boolean condition() {
			try {
				handlerService.executeCommand("org.eclipse.lsp4e.format", null);
				return true;
			} catch (Exception e) {
				return false;
			}
		}
	}.waitForCondition(editor.getSite().getShell().getDisplay(), 3000);
	if (ex.get() != null) {
		throw ex.get();
	}
	new DisplayHelper() {
		@Override protected boolean condition() {
			return editor.getDocumentProvider().getDocument(editor.getEditorInput()).getNumberOfLines() > 1;
		}
	}.waitForCondition(editor.getSite().getShell().getDisplay(), 3000);
}
 
Example 13
Source File: VibeLauncherTester.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * <p>
 * This operation sets up the workspace. 
 * </p>
 */
@BeforeClass
public static void beforeTests() {

	// Local Declarations
	IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
	IProject project = null;
	String separator = System.getProperty("file.separator");
	String userDir = System.getProperty("user.home") + separator
			+ "ICETests" + separator + "caebatTesterWorkspace";
	// Enable Debugging
	System.setProperty("DebugICE", "");

	// Setup the project
	try {
		// Get the project handle
		IPath projectPath = new Path(userDir + separator + ".project");
		// Create the project description
		IProjectDescription desc = ResourcesPlugin.getWorkspace()
		                    .loadProjectDescription(projectPath);
		// Get the project handle and create it
		project = workspaceRoot.getProject(desc.getName());
		// Create the project if it doesn't exist
		if (!project.exists()) {
			project.create(desc, new NullProgressMonitor());
		}
		// Open the project if it is not already open
		if (project.exists() && !project.isOpen()) {
		   project.open(new NullProgressMonitor());
		}
		// Refresh the workspace
		project.refreshLocal(IResource.DEPTH_INFINITE, null);
	} catch (CoreException e) {
		// Catch exception for creating the project
		e.printStackTrace();
		fail();
	}

	// Set the global project reference.
	projectSpace = project;

	return;
}
 
Example 14
Source File: CoreTester.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * This is a utility operation that returns the project of the given name
 * for the test. It removes any old test files from the project . It
 * attempts to create the project if it does not exist.
 *
 * @param name
 *            the name of the project to retrieve from the Workspace
 * @return the project
 */
public IProject getProject(String name) {

	IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
	URI defaultProjectLocation = null;
	IProject project = null;
	String separator = System.getProperty("file.separator");

	// Setup the project space so that the output file can be checked.
	System.out.println("CoreTester Workspace Root = " + workspaceRoot.getLocation());
	System.out.println("Constructing project " + name);
	try {
		// Get the project handle
		project = workspaceRoot.getProject(name);
		// If the project does not exist, create it
		if (!project.exists()) {
			defaultProjectLocation = (new File(System.getProperty("user.dir") + separator + name)).toURI();
			// Create the project description
			IProjectDescription desc = ResourcesPlugin.getWorkspace().newProjectDescription(name);
			// Set the location of the project
			desc.setLocationURI(defaultProjectLocation);
			System.out.println("CoreTester Message: " + "Project location is " + desc.getLocationURI());
			// Create the project
			project.create(desc, null);
		}
		// Open the project if it is not already open
		if (project.exists() && !project.isOpen()) {
			project.open(null);
		}
	} catch (CoreException e) {
		// Catch for creating the project
		e.printStackTrace();
		fail();
	}

	// Clean out any old test files
	try {
		for (IResource resource : project.members()) {
			resource.delete(true, null);
		}
	} catch (CoreException e1) {
		// Complain
		e1.printStackTrace();
		fail();
	}

	return project;
}
 
Example 15
Source File: CSVReaderTester.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @throws java.lang.Exception
 */
@BeforeClass
public static void setUpBeforeClass() throws Exception {
	// Get the file separator used on this system, which is different across
	// OSes.
	String separator = System.getProperty("file.separator");
	// Create the path for the reflectivity file in the ICE tests directory
	String userHome = System.getProperty("user.home");
	IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
	IProject project = null;
	String projectName = "CSVLoaderTesterWorkspace";
	String filename = "getSpecRefSqrdMod_q841.csv";
	IPath projectPath = new Path(userHome + separator + "ICETests"
			+ separator + projectName + separator + ".project");

	// Setup the project
	try {
		// Create the project description
		IProjectDescription desc = ResourcesPlugin.getWorkspace()
				.loadProjectDescription(projectPath);
		// Get the project handle and create it
		project = workspaceRoot.getProject(desc.getName());
		if (!project.exists()) {
			project.create(desc, new NullProgressMonitor());
		}
		// Open the project if it is not already open
		if (project.exists() && !project.isOpen()) {
			project.open(new NullProgressMonitor());
		}
		// Refresh the workspace
		project.refreshLocal(IResource.DEPTH_INFINITE,
				new NullProgressMonitor());
		// Create the IFile handle for the csv file
		testFile = project.getFile(filename);
	} catch (CoreException e) {
		// Catch exception for creating the project
		e.printStackTrace();
		fail();
	}

	// Create the reader
	reader = new CSVReader();

	return;
}
 
Example 16
Source File: IResourcesSetupUtil.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public static IProject createProject(IProject project) throws CoreException {
	if (!project.exists())
		project.create(monitor());
	project.open(monitor());
	return project;
}
 
Example 17
Source File: XMLPersistenceProviderTester.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * This operation creates a project that is used during the persistence and
 * loading tests.
 * 
 * @param projectName
 *            The name for the new project.
 * @return The new Eclipse project.
 */
private static IProject createProject(String projectName) {

	// Local Declarations
	IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
	URI defaultProjectLocation = null;
	String separator = System.getProperty("file.separator");
	String userDir = System.getProperty("user.home") + separator
			+ "ICETests" + separator + "persistenceData";
	String projectPath = userDir + separator + projectName;
	IProject createdProject = null;

	// Setup the project
	try {
		// Get the project handle
		createdProject = workspaceRoot.getProject(projectName);
		// If the project does not exist, create it
		if (!createdProject.exists()) {
			// Set the location as ${workspace_loc}/ItemTesterWorkspace
			defaultProjectLocation = (new File(projectPath).toURI());
			// Create the project description
			IProjectDescription desc = ResourcesPlugin.getWorkspace()
					.newProjectDescription(projectName);
			// Set the location of the project
			desc.setLocationURI(defaultProjectLocation);
			// Create the project
			createdProject.create(desc, null);
		}
		// Open the project if it is not already open
		if (createdProject.exists() && !createdProject.isOpen()) {
			createdProject.open(null);
		}
		// Refresh the workspace
		createdProject.refreshLocal(IResource.DEPTH_INFINITE, null);
	} catch (CoreException e) {
		// Catch exception for creating the project
		e.printStackTrace();
		fail();
	}

	return createdProject;
}
 
Example 18
Source File: ExternalFoldersManager.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void createExternalFoldersProject(IProject project, IProgressMonitor monitor) throws CoreException {
	IProjectDescription desc = project.getWorkspace().newProjectDescription(project.getName());
	IPath stateLocation = JavaCore.getPlugin().getStateLocation();
	desc.setLocation(stateLocation.append(EXTERNAL_PROJECT_NAME));
	project.create(desc, IResource.HIDDEN, monitor);
}
 
Example 19
Source File: TestAutoClosing.java    From tm4e with Eclipse Public License 1.0 4 votes vote down vote up
@Test
public void testAutoClose() throws Exception {
	IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(getClass().getName() + System.currentTimeMillis());
	p.create(null);
	p.open(null);
	IFile file = p.getFile("test.lc-test");
	file.create(new ByteArrayInputStream(new byte[0]), true, null);
	ITextEditor editor = (ITextEditor) IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), file);
	StyledText text = (StyledText)editor.getAdapter(Control.class);
	// insert closing
	text.setText("");
	text.replaceTextRange(0, 0, "(");
	Assert.assertEquals("()", text.getText());
	Assert.assertEquals(1, text.getCaretOffset());
	// nested insert closing
	text.setText("foo(String::from)");
	text.replaceTextRange(16, 0, "(");
	Assert.assertEquals("foo(String::from())", text.getText());
	Assert.assertEquals(17, text.getCaretOffset());
	// ignore already opened
	text.setText("()");
	text.replaceTextRange(0, 0, "(");
	Assert.assertEquals("()", text.getText());
	Assert.assertEquals(1, text.getCaretOffset());
	// ignore already closed
	text.setText("()");
	text.replaceTextRange(1, 0, ")");
	Assert.assertEquals("()", text.getText());
	Assert.assertEquals(2, text.getCaretOffset());
	//
	text.setText("()");
	text.replaceTextRange(2, 0, ")");
	Assert.assertEquals("())", text.getText());
	//
	text.setText("");
	text.replaceTextRange(0, 0, "\"");
	Assert.assertEquals("\"\"", text.getText());
	Assert.assertEquals(1, text.getCaretOffset());
	// continued
	text.replaceTextRange(1, 0, "\"");
	Assert.assertEquals("\"\"", text.getText());
	Assert.assertEquals(2, text.getCaretOffset());
	// continued
	text.replaceTextRange(2, 0, "\"");
	Assert.assertEquals("\"\"\"\"", text.getText());
	Assert.assertEquals(3, text.getCaretOffset());
}
 
Example 20
Source File: GeometryEditorBuilderTester.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * <p>
 * This operations checks the GeometryEditorBuilder to make sure that it
 * properly creates GeometryEditors. It also checks the name and the type of
 * the GeometryEditorBuilder and the GeometryEditor.
 * </p>
 * 
 */
@Test
public void checkConstruction() {

	// Local Declarations
	IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
	URI defaultProjectLocation = null;
	IProject project = null;
	String separator = System.getProperty("file.separator");
	String filename = null;

	// Setup the project workspace
	try {
		// Get the project handle
		project = workspaceRoot.getProject("itemTesterWorkspace");
		// If the project does not exist, create it
		if (!project.exists()) {
			// Set the location as ${workspace_loc}/ItemTesterWorkspace
			defaultProjectLocation = (new File(
					System.getProperty("user.dir") + separator
							+ "itemTesterWorkspace")).toURI();
			// Create the project description
			IProjectDescription desc = ResourcesPlugin.getWorkspace()
					.newProjectDescription("itemTesterWorkspace");
			// Set the location of the project
			desc.setLocationURI(defaultProjectLocation);
			// Create the project
			project.create(desc, null);
		}
		// Open the project if it is not already open
		if (project.exists() && !project.isOpen()) {
			project.open(null);
		}
	} catch (CoreException e) {
		// Catch for creating the project
		e.printStackTrace();
		fail();
	}

	// Instantiate the builder
	geometryEditorBuilder = new GeometryEditorBuilder();

	// Check the name - the static value, the getter and the comparison of
	// the two
	assertEquals("Geometry Editor", geometryEditorBuilder.name);
	assertEquals("Geometry Editor", geometryEditorBuilder.getItemName());
	assertEquals(geometryEditorBuilder.name,
			geometryEditorBuilder.getItemName());

	// Check the type - the static value, the getter and the comparison of
	// the two
	assertEquals(ItemType.Geometry, geometryEditorBuilder.type);
	assertEquals(ItemType.Geometry, geometryEditorBuilder.getItemType());
	assertEquals(geometryEditorBuilder.type,
			geometryEditorBuilder.getItemType());

	// Make sure construction works properly
	Item editor = geometryEditorBuilder.build(project);
	assertNotNull(editor);
	assertTrue(editor instanceof GeometryEditor);
	assertEquals("Geometry Editor", editor.getName());
	assertEquals(ItemType.Geometry, editor.getItemType());

	return;

}