@Override public IProjectDescription newProjectDescription(String projectName) { IProjectDescription result = new ProjectDescription(); result.setName(projectName); return result; }
@Override public IProjectDescription newProjectDescription(String projectName) { IProjectDescription result = new ProjectDescription(); result.setName(projectName); return result; }
@Override public IProjectDescription newProjectDescription(String projectName) { IProjectDescription result = new ProjectDescription(); result.setName(projectName); return result; }
@Override public IProject renameProject(IProject project, String newName, IProgressMonitor monitor) { Preconditions.checkNotNull(project); Preconditions.checkNotNull(newName); Preconditions.checkArgument(project.isAccessible(), "Project must be open."); SubMonitor progress = SubMonitor.convert(monitor, 1); if (project.getName().equals(newName)) { return project; } IPath location = project.getLocation(); if (location != null && isDirectChildOfWorkspaceRootFolder(location.toFile())) { throw new GradlePluginsRuntimeException(String.format("Project %s cannot be renamed, because it is in the default location.", project.getName())); } if (findProjectByName(newName).isPresent()) { throw new GradlePluginsRuntimeException(String.format("Workspace already contains a project with name %s.", newName)); } try { IProjectDescription description = project.getDescription(); description.setName(newName); project.move(description, false, progress.newChild(1)); } catch (CoreException e) { throw new GradlePluginsRuntimeException(e); } return findProjectByName(newName).get(); }
protected void doRename(IProgressMonitor pm) throws CoreException { try { pm.beginTask(getName(), 2); if (fUpdateReferences) modifyClassPaths(new SubProgressMonitor(pm, 1)); IProject project= getProject(); if (project != null) { IProjectDescription description= project.getDescription(); description.setName(getNewName()); project.move(description, IResource.FORCE | IResource.SHALLOW, new SubProgressMonitor(pm, 1)); } } finally { pm.done(); } }
@Override protected void doRename(IProgressMonitor pm) throws CoreException { try { pm.beginTask(getName(), 2); if (fUpdateReferences) modifyClassPaths(new SubProgressMonitor(pm, 1)); IProject project= getProject(); if (project != null) { IProjectDescription description= project.getDescription(); description.setName(getNewName()); project.move(description, IResource.FORCE | IResource.SHALLOW, new SubProgressMonitor(pm, 1)); } } finally { pm.done(); } }
@Override protected void doRename(IProgressMonitor pm) throws CoreException { try { pm.beginTask(getName(), 2); if (fUpdateReferences) modifyClassPaths(new SubProgressMonitor(pm, 1)); IProject project= getProject(); if (project != null) { IProjectDescription description= project.getDescription(); description.setName(getNewName()); project.move(description, IResource.FORCE | IResource.SHALLOW, new SubProgressMonitor(pm, 1)); } } finally { pm.done(); } }
/** * Create a new IProjectDescription for the copy using the name and path * selected from the dialog. * * @return IProjectDescription * @param project * the source project * @param projectName * the name for the new project * @param rootLocation * the path the new project will be stored under. */ protected IProjectDescription createDescription(IProject project, String projectName, IPath rootLocation) throws CoreException { // Get a copy of the current description and modify it IProjectDescription newDescription = project.getDescription(); newDescription.setName(projectName); // If the location is the default then set the location to null if (rootLocation.equals(Platform.getLocation())) { newDescription.setLocation(null); } else { newDescription.setLocation(rootLocation); } return newDescription; }
} else { project = findUniqueProject(workspace, name); descriptor.setName(project.getName());
@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); } }
@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); } }
record.getProjectDescription().setLocation(locationPath); } else record.getProjectDescription().setName(projectName);
@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); } }
IProject copyProject(IProject project, IPath destinationPath, URI locationURI, IProgressMonitor monitor) throws CoreException { monitor.setTaskName(UndoMessages.AbstractCopyOrMoveResourcesOperation_copyProjectProgress); boolean open = project.isOpen(); if (!open) { // Must open project in order to get the original project // description for performing the undo. project.open(null); } originalProjectDescription = new ProjectDescription(project); IProjectDescription description = project.getDescription(); // Set the new name and location into the project's description description.setName(destinationPath.lastSegment()); description.setLocationURI(locationURI); project.copy(description, IResource.FORCE | IResource.SHALLOW, monitor); // Close the original project if it was closed when we started. if (!open) { project.close(null); } // Now return the handle of the new project return (IProject) getWorkspace().getRoot().findMember(destinationPath); } }
return false; IProjectDescription description = project.getDescription(); description.setName(destination.getName()); if (!hook.moveProject(tree, project, description, updateFlags, Policy.subMonitorFor(monitor, Policy.opWork / 2))) tree.standardMoveProject(project, description, updateFlags, Policy.subMonitorFor(monitor, Policy.opWork));
return false; IProjectDescription description = project.getDescription(); description.setName(destination.getName()); if (!hook.moveProject(tree, project, description, updateFlags, Policy.subMonitorFor(monitor, Policy.opWork / 2))) tree.standardMoveProject(project, description, updateFlags, Policy.subMonitorFor(monitor, Policy.opWork));
return false; IProjectDescription description = project.getDescription(); description.setName(destination.getName()); if (!hook.moveProject(tree, project, description, updateFlags, progress.split(1))) tree.standardMoveProject(project, description, updateFlags, progress.split(1));
if (description == null) { description = new ProjectDescription(); description.setName(getName());
if (description == null) { description = new ProjectDescription(); description.setName(getName());
if (description == null) { description = new ProjectDescription(); description.setName(getName());