final IJavaProject javaProject = JavaCore.create(project); final IProjectDescription projectDescription = workspace.newProjectDescription(projectName); projectDescription.setLocation(null); project.create(projectDescription, new SubProgressMonitor(progressMonitor, 1));
private IProjectDescription getProjectDescription() { String projectName = (String) getProperty(PROJECT_NAME); IProjectDescription desc = ResourcesPlugin.getWorkspace().newProjectDescription(projectName); String projectLocation = (String) getProperty(PROJECT_LOCATION); if (projectLocation != null) desc.setLocation(new Path(projectLocation)); else desc.setLocation(null); return desc; }
private IProjectDescription getProjectDescription() { String projectName = (String) getProperty(PROJECT_NAME); IProjectDescription desc = ResourcesPlugin.getWorkspace().newProjectDescription(projectName); if (getDataModel().isPropertySet(PROJECT_LOCATION)) { String projectLocation = (String) getProperty(IProjectCreationProperties.PROJECT_LOCATION); if (projectLocation != null) desc.setLocation(new Path(projectLocation)); else desc.setLocation(null); } return desc; }
public static IContainer findOrCreateContainer (IPath path, boolean forceRefresh, IPath localLocation, IProgressMonitor progressMonitor) throws CoreException { String projectName = path.segment(0); IProjectDescription projectDescription = ResourcesPlugin.getWorkspace().newProjectDescription(projectName); projectDescription.setLocation(localLocation); return findOrCreateContainer(path, forceRefresh, projectDescription, progressMonitor); }
public static IContainer findOrCreateContainer (IPath path, boolean forceRefresh, IPath localLocation, IProgressMonitor progressMonitor) throws CoreException { String projectName = path.segment(0); IProjectDescription projectDescription = ResourcesPlugin.getWorkspace().newProjectDescription(projectName); projectDescription.setLocation(localLocation); return findOrCreateContainer(path, forceRefresh, projectDescription, progressMonitor); }
@Override public Collection<IProjectDescription> getNewProjectDescriptions() { Collection<IProjectDescription> result = new ArrayList<IProjectDescription> (); IWorkspace workspace = ResourcesPlugin.getWorkspace(); IProject project = getProjectHandle(); IPath newPath = useDefaults() ? null : getLocationPath(); IProjectDescription description = workspace.newProjectDescription(project.getName()); description.setLocation(newPath); result.add(description); return result; }
protected IProjectDescription createProjectDescription() { final IProjectDescription projectDescription = workspace.newProjectDescription(projectName); if (location != null && !Platform.getLocation().equals(location.removeLastSegments(1))) { projectDescription.setLocation(location); } if (referencedProjects != null && referencedProjects.size() != 0) { projectDescription .setReferencedProjects(referencedProjects.toArray(new IProject[referencedProjects.size()])); } if (projectNatures != null) projectDescription.setNatureIds(projectNatures.toArray(new String[projectNatures.size()])); if (builderIds != null) setBuilder(projectDescription, builderIds.toArray(new String[builderIds.size()])); return projectDescription; }
public void run(IProgressMonitor actMonitor) throws CoreException { final IProjectDescription desc = ResourcesPlugin .getWorkspace().newProjectDescription( projectName[0]); desc.setLocation(new Path(path[0])); IProject prj = ResourcesPlugin.getWorkspace().getRoot() .getProject(desc.getName()); prj.create(desc, actMonitor); prj.open(actMonitor); ConnectProviderOperation cpo = new ConnectProviderOperation( prj, repoDir[0]); cpo.execute(new NullProgressMonitor()); ResourcesPlugin.getWorkspace().getRoot().refreshLocal( IResource.DEPTH_ONE, actMonitor); } };
public void createAndOpen(IProgressMonitor monitor) throws CoreException, OperationCanceledException { monitor.beginTask(null, 2); try { IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(project.getName()); if (projectLocation != null) { description.setLocation(projectLocation); } project.create(description, new SubProgressMonitor(monitor, 1)); if (monitor.isCanceled()) { throw new OperationCanceledException(); } project.open(new SubProgressMonitor(monitor, 1)); } finally { monitor.done(); } }
private void createProj(IProject newProj, boolean isJavaProject) throws CoreException { newProj.create(null); IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(newProj.getName()); // if (isJavaProject) // description.setNatureIds(new String[]{JavaCore.NATURE_ID}); description.setLocation(null); newProj.open(null); newProj.setDescription(description, null); }
public static IProject openProject(String projectName, IPath dir, IProgressMonitor monitor) throws CoreException { IWorkspace workspace = getWorkspace(); IProject project = getProject(projectName); IProjectDescription desc = workspace.newProjectDescription(project.getName()); desc.setLocation(dir); project.create(desc, monitor); project.open(monitor); return project; }
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); }
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); }
public static void createProject(IProject project, IPath location, IProgressMonitor monitor) throws CoreException { if (!Platform.getLocation().equals(location)) { IProjectDescription desc = project.getWorkspace() .newProjectDescription(project.getName()); desc.setLocation(location); project.create(desc, monitor); } else project.create(monitor); }
public static void createProject(IProject project, IPath location, IProgressMonitor monitor) throws CoreException { if (!Platform.getLocation().equals(location)) { IProjectDescription desc = project.getWorkspace().newProjectDescription(project.getName()); desc.setLocation(location); project.create(desc, monitor); } else project.create(monitor); }
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); }
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); }
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)); try { project.create(desc, IResource.HIDDEN, monitor); } catch (CoreException e) { // If we managed to create the project in the meantime, don't complain if (!project.exists()) { throw e; } } }
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)); try { project.create(desc, IResource.HIDDEN, monitor); } catch (CoreException e) { // If we managed to create the project in the meantime, don't complain if (!project.exists()) { throw e; } } }
@Override public void copy(IPath destination, int updateFlags, IProgressMonitor monitor) throws CoreException { // FIXME - the logic here for copying projects needs to be moved to Resource.copy // so that IResource.copy(IPath,int,IProgressMonitor) works properly for // projects and honours all update flags monitor = Policy.monitorFor(monitor); if (destination.segmentCount() == 1) { // copy project to project String projectName = destination.segment(0); IProjectDescription desc = getDescription(); desc.setName(projectName); desc.setLocation(null); ((ProjectDescription) desc).setSnapshotLocationURI(null); internalCopy(desc, updateFlags, monitor); } else { // will fail since we're trying to copy a project to a non-project checkCopyRequirements(destination, IResource.PROJECT, updateFlags); } }