use of org.eclipse.core.resources.IWorkspace in project xtext-xtend by eclipse.
the class BuildAffectionTest method tearDownProject.
@AfterClass
public static void tearDownProject() throws Exception {
IResourcesSetupUtil.cleanWorkspace();
final IWorkspace workspace = ResourcesPlugin.getWorkspace();
final IWorkspaceDescription description = workspace.getDescription();
description.setAutoBuilding(BuildAffectionTest.wasAutoBuilding);
workspace.setDescription(description);
}
use of org.eclipse.core.resources.IWorkspace in project xtext-xtend by eclipse.
the class BuildAffectionTest method setUpProject.
@BeforeClass
public static void setUpProject() throws Exception {
TargetPlatformUtil.setTargetPlatform(BuildAffectionTest.class);
IResourcesSetupUtil.cleanWorkspace();
final IWorkspace workspace = ResourcesPlugin.getWorkspace();
final IWorkspaceDescription description = workspace.getDescription();
BuildAffectionTest.wasAutoBuilding = description.isAutoBuilding();
description.setAutoBuilding(false);
workspace.setDescription(description);
WorkbenchTestHelper.createPluginProject(WorkbenchTestHelper.TESTPROJECT_NAME);
}
use of org.eclipse.core.resources.IWorkspace in project xtext-xtend by eclipse.
the class PerformanceTestProjectSetup method createJavaProject.
public static IJavaProject createJavaProject(final String projectName, String[] projectNatures) {
IProject project = null;
IJavaProject javaProject = null;
try {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
project = workspace.getRoot().getProject(projectName);
deleteProject(project);
javaProject = JavaCore.create(project);
IProjectDescription projectDescription = ResourcesPlugin.getWorkspace().newProjectDescription(projectName);
project.create(projectDescription, null);
List<IClasspathEntry> classpathEntries = new ArrayList<IClasspathEntry>();
projectDescription.setNatureIds(projectNatures);
final ICommand java = projectDescription.newCommand();
java.setBuilderName(JavaCore.BUILDER_ID);
final ICommand manifest = projectDescription.newCommand();
manifest.setBuilderName("org.eclipse.pde.ManifestBuilder");
final ICommand schema = projectDescription.newCommand();
schema.setBuilderName("org.eclipse.pde.SchemaBuilder");
projectDescription.setBuildSpec(new ICommand[] { java, manifest, schema });
project.open(null);
project.setDescription(projectDescription, null);
classpathEntries.add(JavaCore.newContainerEntry(new Path("org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5")));
classpathEntries.add(JavaCore.newContainerEntry(new Path("org.eclipse.pde.core.requiredPlugins")));
javaProject.setRawClasspath(classpathEntries.toArray(new IClasspathEntry[classpathEntries.size()]), null);
makeJava5Compliant(javaProject);
javaProject.setOutputLocation(new Path("/" + projectName + "/bin"), null);
createManifest(projectName, project);
// project.build(IncrementalProjectBuilder.FULL_BUILD, null);
refreshExternalArchives(javaProject);
refresh(javaProject);
} catch (final Exception exception) {
throw new RuntimeException(exception);
}
return javaProject;
}
use of org.eclipse.core.resources.IWorkspace in project xtext-xtend by eclipse.
the class EclipseFileSystemTest method testGetURIForImportedProject.
@Test
public void testGetURIForImportedProject() {
try {
final IWorkspace ws = ResourcesPlugin.getWorkspace();
final IWorkspaceRoot root = ws.getRoot();
final IProjectDescription description = ws.newProjectDescription("bar");
description.setLocation(root.getLocation().append("foo/bar"));
final IProject project = root.getProject("bar");
project.create(description, null);
project.open(null);
final Path file = new Path("/bar/Foo.text");
Assert.assertFalse(this.fs.exists(file));
Assert.assertNull(this.fs.toURI(file));
try {
this.fs.setContents(file, "Hello Foo");
Assert.fail();
} catch (final Throwable _t) {
if (_t instanceof IllegalArgumentException) {
} else {
throw Exceptions.sneakyThrow(_t);
}
}
Assert.assertFalse(this.fs.exists(file));
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.core.resources.IWorkspace in project linuxtools by eclipse.
the class STDataViewersExportToCSVDialog method handleBrowseWorkspace.
private void handleBrowseWorkspace() {
SaveAsDialog dialog = new SaveAsDialog(getShell());
dialog.setTitle("Output file");
if (dialog.open() == IDialogConstants.OK_ID) {
IPath p = dialog.getResult();
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IFile file = workspace.getRoot().getFile(p);
outputFile.setText(file.getLocation().toOSString());
}
}
Aggregations