/** * Return <code>true</code> if there is a change in the content area for the project. */ private boolean isContentChange(IProject project, IProjectDescription destDescription) { IProjectDescription srcDescription = ((Project) project).internalGetDescription(); URI srcLocation = srcDescription.getLocationURI(); URI destLocation = destDescription.getLocationURI(); if (srcLocation == null || destLocation == null) return true; //don't use URIUtil because we want to treat case rename as a content change return !srcLocation.equals(destLocation); }
/** * Return <code>true</code> if there is a change in the content area for the project. */ private boolean isContentChange(IProject project, IProjectDescription destDescription) { IProjectDescription srcDescription = ((Project) project).internalGetDescription(); URI srcLocation = srcDescription.getLocationURI(); URI destLocation = destDescription.getLocationURI(); if (srcLocation == null || destLocation == null) return true; //don't use URIUtil because we want to treat case rename as a content change return !srcLocation.equals(destLocation); }
/** * Return <code>true</code> if there is a change in the content area for the project. */ private boolean isContentChange(IProject project, IProjectDescription destDescription) { IProjectDescription srcDescription = ((Project) project).internalGetDescription(); URI srcLocation = srcDescription.getLocationURI(); URI destLocation = destDescription.getLocationURI(); if (srcLocation == null || destLocation == null) return true; //don't use URIUtil because we want to treat case rename as a content change return !srcLocation.equals(destLocation); }
protected static URI getLocationURI(IProject project) throws CoreException { java.net.URI locationURI = project.getDescription().getLocationURI(); return locationURI == null ? null : URI.createURI(locationURI.toString()); } }
protected static URI getLocationURI(IProject project) throws CoreException { java.net.URI locationURI = project.getDescription().getLocationURI(); return locationURI == null ? null : URI.createURI(locationURI.toString()); } }
private IFileStore computeDestinationStore(IProjectDescription destDescription) throws CoreException { URI destLocation = destDescription.getLocationURI(); // Use the default area if necessary for the destination. if (destLocation == null) { IPath rootLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation(); destLocation = rootLocation.append(destDescription.getName()).toFile().toURI(); } return EFS.getStore(destLocation); }
private IFileStore computeDestinationStore(IProjectDescription destDescription) throws CoreException { URI destLocation = destDescription.getLocationURI(); // Use the default area if necessary for the destination. if (destLocation == null) { IPath rootLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation(); destLocation = rootLocation.append(destDescription.getName()).toFile().toURI(); } return EFS.getStore(destLocation); }
private IFileStore computeDestinationStore(IProjectDescription destDescription) throws CoreException { URI destLocation = destDescription.getLocationURI(); // Use the default area if necessary for the destination. if (destLocation == null) { IPath rootLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation(); destLocation = rootLocation.append(destDescription.getName()).toFile().toURI(); } return EFS.getStore(destLocation); }
URI moveProject(IProject project, URI locationURI, IProgressMonitor monitor) throws CoreException { monitor .setTaskName(UndoMessages.AbstractCopyOrMoveResourcesOperation_moveProjectProgress); IProjectDescription description = project.getDescription(); // Record the original path so this can be undone URI newDestinationURI = description.getLocationURI(); // Set the new location into the project's description description.setLocationURI(locationURI); project.move(description, IResource.FORCE | IResource.SHALLOW, monitor); // Now adjust the projectLocation so this can be undone/redone. return newDestinationURI; }
protected void assertCreateRequirements(IProjectDescription description) throws CoreException { checkDoesNotExist(); checkDescription(this, description, false); URI location = description.getLocationURI(); if (location != null) return; //if the project is in the default location, need to check for collision with existing folder of different case if (!Workspace.caseSensitive) { IFileStore store = getStore(); IFileInfo localInfo = store.fetchInfo(); if (localInfo.exists()) { String name = getLocalManager().getLocalName(store); if (name != null && !store.getName().equals(name)) { String msg = NLS.bind(Messages.resources_existsLocalDifferentCase, new Path(store.toString()).removeLastSegments(1).append(name).toOSString()); throw new ResourceException(IResourceStatus.CASE_VARIANT_EXISTS, getFullPath(), msg, null); } } } }
protected void assertCreateRequirements(IProjectDescription description) throws CoreException { checkDoesNotExist(); checkDescription(this, description, false); URI location = description.getLocationURI(); if (location != null) return; //if the project is in the default location, need to check for collision with existing folder of different case if (!Workspace.caseSensitive) { IFileStore store = getStore(); IFileInfo localInfo = store.fetchInfo(); if (localInfo.exists()) { String name = getLocalManager().getLocalName(store); if (name != null && !store.getName().equals(name)) { String msg = NLS.bind(Messages.resources_existsLocalDifferentCase, new Path(store.toString()).removeLastSegments(1).append(name).toOSString()); throw new ResourceException(IResourceStatus.CASE_VARIANT_EXISTS, getFullPath(), msg, null); } } } }
private boolean projectFolderAlreadyExists(String newName) throws CoreException { boolean isNotInWorkpace= fProject.getProject().getDescription().getLocationURI() != null; if (isNotInWorkpace) return false; // projects outside of the workspace are not renamed URI locationURI= fProject.getProject().getLocationURI(); IFileStore projectStore= EFS.getStore(locationURI); if (!projectStore.getFileSystem().isCaseSensitive() && newName.equalsIgnoreCase(fProject.getElementName())) return false; // allow to change case IFileStore newProjectStore= projectStore.getParent().getChild(newName); return newProjectStore.fetchInfo().exists(); }
private boolean projectFolderAlreadyExists(String newName) throws CoreException { boolean isNotInWorkpace= fProject.getProject().getDescription().getLocationURI() != null; if (isNotInWorkpace) return false; // projects outside of the workspace are not renamed URI locationURI= fProject.getProject().getLocationURI(); IFileStore projectStore= EFS.getStore(locationURI); if (!projectStore.getFileSystem().isCaseSensitive() && newName.equalsIgnoreCase(fProject.getElementName())) return false; // allow to change case IFileStore newProjectStore= projectStore.getParent().getChild(newName); return newProjectStore.fetchInfo().exists(); }
protected void assertCreateRequirements(IProjectDescription description) throws CoreException { checkDoesNotExist(); checkDescription(this, description, false); URI location = description.getLocationURI(); if (location != null) return; //if the project is in the default location, need to check for collision with existing folder of different case if (!Workspace.caseSensitive) { IFileStore store = getStore(); IFileInfo localInfo = store.fetchInfo(); if (localInfo.exists()) { String name = getLocalManager().getLocalName(store); if (name != null && !store.getName().equals(name)) { String msg = NLS.bind(Messages.resources_existsLocalDifferentCase, new Path(store.toString()).removeLastSegments(1).append(name).toOSString()); throw new ResourceException(IResourceStatus.CASE_VARIANT_EXISTS, getFullPath(), msg, null); } } } }
private boolean projectFolderAlreadyExists(String newName) throws CoreException { boolean isNotInWorkpace= fProject.getProject().getDescription().getLocationURI() != null; if (isNotInWorkpace) return false; // projects outside of the workspace are not renamed URI locationURI= fProject.getProject().getLocationURI(); IFileStore projectStore= EFS.getStore(locationURI); IFileStore newProjectStore= projectStore.getParent().getChild(newName); return newProjectStore.fetchInfo().exists(); }
/** * Sets this project's description to the given value. This is the body of the * corresponding API method but is needed separately since it is used * during workspace restore (i.e., when you cannot do an operation) */ void internalSetDescription(IProjectDescription value, boolean incrementContentId) { // Project has been added / removed. Build order is out-of-step workspace.flushBuildOrder(); ProjectInfo info = (ProjectInfo) getResourceInfo(false, true); info.setDescription((ProjectDescription) value); getLocalManager().setLocation(this, info, value.getLocationURI()); if (incrementContentId) { info.incrementContentId(); //if the project is not accessible, stamp will be null and should remain null if (info.getModificationStamp() != NULL_STAMP) workspace.updateModificationStamp(info); } }
/** * Sets this project's description to the given value. This is the body of the * corresponding API method but is needed separately since it is used * during workspace restore (i.e., when you cannot do an operation) */ void internalSetDescription(IProjectDescription value, boolean incrementContentId) { // Project has been added / removed. Build order is out-of-step workspace.flushBuildOrder(); ProjectInfo info = (ProjectInfo) getResourceInfo(false, true); info.setDescription((ProjectDescription) value); getLocalManager().setLocation(this, info, value.getLocationURI()); if (incrementContentId) { info.incrementContentId(); //if the project is not accessible, stamp will be null and should remain null if (info.getModificationStamp() != NULL_STAMP) workspace.updateModificationStamp(info); } }
/** * Sets this project's description to the given value. This is the body of the * corresponding API method but is needed separately since it is used * during workspace restore (i.e., when you cannot do an operation) */ void internalSetDescription(IProjectDescription value, boolean incrementContentId) { // Project has been added / removed. Build order is out-of-step workspace.flushBuildOrder(); ProjectInfo info = (ProjectInfo) getResourceInfo(false, true); info.setDescription((ProjectDescription) value); getLocalManager().setLocation(this, info, value.getLocationURI()); if (incrementContentId) { info.incrementContentId(); //if the project is not accessible, stamp will be null and should remain null if (info.getModificationStamp() != NULL_STAMP) workspace.updateModificationStamp(info); } }
/** * Checks validity of the given project description. */ protected void checkDescription(IProject project, IProjectDescription desc, boolean moving) throws CoreException { URI location = desc.getLocationURI(); String message = Messages.resources_invalidProjDesc; MultiStatus status = new MultiStatus(ResourcesPlugin.PI_RESOURCES, IResourceStatus.INVALID_VALUE, message, null); status.merge(workspace.validateName(desc.getName(), IResource.PROJECT)); if (moving) { // if we got here from a move call then we should check the location in the description since // its possible that we want to do a rename without moving the contents. (and we shouldn't // throw an Overlapping mapping exception in this case) So if the source description's location // is null (we are using the default) or if the locations aren't equal, then validate the location // of the new description. Otherwise both locations aren't null and they are equal so ignore validation. URI sourceLocation = internalGetDescription().getLocationURI(); if (sourceLocation == null || !sourceLocation.equals(location)) status.merge(workspace.validateProjectLocationURI(project, location)); } else // otherwise continue on like before status.merge(workspace.validateProjectLocationURI(project, location)); if (!status.isOK()) throw new ResourceException(status); }
/** * Checks validity of the given project description. */ protected void checkDescription(IProject project, IProjectDescription desc, boolean moving) throws CoreException { URI location = desc.getLocationURI(); String message = Messages.resources_invalidProjDesc; MultiStatus status = new MultiStatus(ResourcesPlugin.PI_RESOURCES, IResourceStatus.INVALID_VALUE, message, null); status.merge(workspace.validateName(desc.getName(), IResource.PROJECT)); if (moving) { // if we got here from a move call then we should check the location in the description since // its possible that we want to do a rename without moving the contents. (and we shouldn't // throw an Overlapping mapping exception in this case) So if the source description's location // is null (we are using the default) or if the locations aren't equal, then validate the location // of the new description. Otherwise both locations aren't null and they are equal so ignore validation. URI sourceLocation = internalGetDescription().getLocationURI(); if (sourceLocation == null || !sourceLocation.equals(location)) status.merge(workspace.validateProjectLocationURI(project, location)); } else // otherwise continue on like before status.merge(workspace.validateProjectLocationURI(project, location)); if (!status.isOK()) throw new ResourceException(status); }