Search in sources :

Example 16 with IProjectDescription

use of org.eclipse.core.resources.IProjectDescription in project bndtools by bndtools.

the class BndProjectNature method deconfigure.

@Override
public void deconfigure() throws CoreException {
    IProjectDescription desc = project.getDescription();
    removeBuilder(desc);
    updateProject(desc, false);
}
Also used : IProjectDescription(org.eclipse.core.resources.IProjectDescription)

Example 17 with IProjectDescription

use of org.eclipse.core.resources.IProjectDescription in project bndtools by bndtools.

the class BndProjectNature method configure.

@Override
public void configure() throws CoreException {
    final IProjectDescription desc = project.getDescription();
    addBuilder(desc);
    updateProject(desc, true);
}
Also used : IProjectDescription(org.eclipse.core.resources.IProjectDescription)

Example 18 with IProjectDescription

use of org.eclipse.core.resources.IProjectDescription in project eclipse.platform.text by eclipse.

the class ResourceHelper method createLinkedProject.

public static IProject createLinkedProject(String projectName, Plugin plugin, IPath linkPath) throws CoreException {
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IProject project = workspace.getRoot().getProject(projectName);
    IProjectDescription desc = workspace.newProjectDescription(projectName);
    File file = FileTool.getFileInPlugin(plugin, linkPath);
    IPath projectLocation = new Path(file.getAbsolutePath());
    if (Platform.getLocation().equals(projectLocation))
        projectLocation = null;
    desc.setLocation(projectLocation);
    project.create(desc, NULL_MONITOR);
    if (!project.isOpen())
        project.open(NULL_MONITOR);
    return project;
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) IWorkspace(org.eclipse.core.resources.IWorkspace) IProjectDescription(org.eclipse.core.resources.IProjectDescription) File(java.io.File) IFile(org.eclipse.core.resources.IFile) ZipFile(java.util.zip.ZipFile) IProject(org.eclipse.core.resources.IProject)

Example 19 with IProjectDescription

use of org.eclipse.core.resources.IProjectDescription in project eclipse.platform.text by eclipse.

the class ResourceHelper method createLinkedProject.

public static IProject createLinkedProject(String projectName, Plugin plugin, IPath linkPath) throws CoreException {
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IProject project = workspace.getRoot().getProject(projectName);
    IProjectDescription desc = workspace.newProjectDescription(projectName);
    File file = FileTool.getFileInPlugin(plugin, linkPath);
    IPath projectLocation = new Path(file.getAbsolutePath());
    if (Platform.getLocation().equals(projectLocation))
        projectLocation = null;
    desc.setLocation(projectLocation);
    project.create(desc, NULL_MONITOR);
    if (!project.isOpen())
        project.open(NULL_MONITOR);
    return project;
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) IWorkspace(org.eclipse.core.resources.IWorkspace) IProjectDescription(org.eclipse.core.resources.IProjectDescription) File(java.io.File) IFile(org.eclipse.core.resources.IFile) IProject(org.eclipse.core.resources.IProject)

Example 20 with IProjectDescription

use of org.eclipse.core.resources.IProjectDescription 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;
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IJavaProject(org.eclipse.jdt.core.IJavaProject) IClasspathEntry(org.eclipse.jdt.core.IClasspathEntry) ICommand(org.eclipse.core.resources.ICommand) IWorkspace(org.eclipse.core.resources.IWorkspace) IProjectDescription(org.eclipse.core.resources.IProjectDescription) ArrayList(java.util.ArrayList) IProject(org.eclipse.core.resources.IProject) JavaModelException(org.eclipse.jdt.core.JavaModelException) CoreException(org.eclipse.core.runtime.CoreException)

Aggregations

IProjectDescription (org.eclipse.core.resources.IProjectDescription)68 IProject (org.eclipse.core.resources.IProject)35 CoreException (org.eclipse.core.runtime.CoreException)18 IWorkspace (org.eclipse.core.resources.IWorkspace)16 IPath (org.eclipse.core.runtime.IPath)13 ICommand (org.eclipse.core.resources.ICommand)12 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)11 File (java.io.File)9 IStatus (org.eclipse.core.runtime.IStatus)9 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)8 Path (org.eclipse.core.runtime.Path)8 Status (org.eclipse.core.runtime.Status)6 InvocationTargetException (java.lang.reflect.InvocationTargetException)5 URI (java.net.URI)5 IResource (org.eclipse.core.resources.IResource)5 Test (org.junit.Test)5 HashSet (java.util.HashSet)4 InputStream (java.io.InputStream)3 IFile (org.eclipse.core.resources.IFile)3 Resource (org.eclipse.emf.ecore.resource.Resource)3