use of org.eclipse.core.runtime.IPath in project che by eclipse.
the class ImportOperation method createFromRoot.
/**
* Creates the folders that appear in the specified resource path
* assuming that the destinationContainer begins at the root. Do not create projects.
*
* @param path the relative path of the resource
* @return the container resource coresponding to the given path
* @exception CoreException if this method failed
*/
private IContainer createFromRoot(IPath path) throws CoreException {
int segmentCount = path.segmentCount();
//Assume the project exists
IContainer currentFolder = ((IWorkspaceRoot) destinationContainer).getProject(path.segment(0));
for (int i = 1; i < segmentCount; i++) {
currentFolder = currentFolder.getFolder(new Path(path.segment(i)));
if (!currentFolder.exists()) {
((IFolder) currentFolder).create(false, true, null);
}
}
return currentFolder;
}
use of org.eclipse.core.runtime.IPath in project che by eclipse.
the class FileNamePatternSearchScope method addToList.
private static void addToList(ArrayList res, IResource curr, boolean includeDerived) {
// if (!includeDerived && curr.isDerived(IResource.CHECK_ANCESTORS)) {
// return;
// }
IPath currPath = curr.getFullPath();
for (int k = res.size() - 1; k >= 0; k--) {
IResource other = (IResource) res.get(k);
IPath otherPath = other.getFullPath();
if (otherPath.isPrefixOf(currPath)) {
return;
}
if (currPath.isPrefixOf(otherPath)) {
res.remove(k);
}
}
res.add(curr);
}
use of org.eclipse.core.runtime.IPath in project che by eclipse.
the class ContainerDescription method recordStateFromHistory.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.internal.ide.undo.ResourceDescription#recordStateFromHistory(org.eclipse.core.resources.IResource,
* org.eclipse.core.runtime.IProgressMonitor)
*/
public void recordStateFromHistory(IResource resource, IProgressMonitor monitor) throws CoreException {
monitor.beginTask(UndoMessages.FolderDescription_SavingUndoInfoProgress, 100);
if (members != null) {
for (int i = 0; i < members.length; i++) {
if (members[i] instanceof FileDescription) {
IPath path = resource.getFullPath().append(((FileDescription) members[i]).name);
IFile fileHandle = resource.getWorkspace().getRoot().getFile(path);
members[i].recordStateFromHistory(fileHandle, new SubProgressMonitor(monitor, 100 / members.length));
} else if (members[i] instanceof FolderDescription) {
IPath path = resource.getFullPath().append(((FolderDescription) members[i]).name);
IFolder folderHandle = resource.getWorkspace().getRoot().getFolder(path);
members[i].recordStateFromHistory(folderHandle, new SubProgressMonitor(monitor, 100 / members.length));
}
}
}
monitor.done();
}
use of org.eclipse.core.runtime.IPath in project che by eclipse.
the class MoveResourcesRefactoringContribution method retrieveArgumentMap.
/* (non-Javadoc)
* @see org.eclipse.ltk.core.refactoring.RefactoringContribution#retrieveArgumentMap(org.eclipse.ltk.core.refactoring.RefactoringDescriptor)
*/
public Map retrieveArgumentMap(final RefactoringDescriptor descriptor) {
HashMap map = new HashMap();
if (descriptor instanceof MoveResourcesDescriptor) {
MoveResourcesDescriptor moveDescriptor = (MoveResourcesDescriptor) descriptor;
IPath[] paths = moveDescriptor.getResourcePathsToMove();
String project = moveDescriptor.getProject();
IPath destinationPath = moveDescriptor.getDestinationPath();
map.put(ATTRIBUTE_NUMBER_OF_RESOURCES, String.valueOf(paths.length));
for (int i = 0; i < paths.length; i++) {
map.put(ATTRIBUTE_ELEMENT + (i + 1), ResourceProcessors.resourcePathToHandle(project, paths[i]));
}
map.put(ATTRIBUTE_DESTINATION, ResourceProcessors.resourcePathToHandle(project, destinationPath));
//$NON-NLS-1$//$NON-NLS-2$
map.put(ATTRIBUTE_UPDATE_REFERENCES, moveDescriptor.isUpdateReferences() ? "true" : "false");
return map;
}
return null;
}
use of org.eclipse.core.runtime.IPath in project che by eclipse.
the class ResourceModifications method addMove.
/**
* Adds the given resource to the list of resources
* to be moved.
*
* @param move the resource to be moved
* @param arguments the move arguments
*/
public void addMove(IResource move, MoveArguments arguments) {
if (fMove == null) {
fMove = new ArrayList(2);
fMoveArguments = new ArrayList(2);
}
fMove.add(move);
fMoveArguments.add(arguments);
if (fIgnoreCount == 0) {
IPath destination = ((IResource) arguments.getDestination()).getFullPath().append(move.getName());
internalAdd(new MoveDescription(move, destination));
}
}
Aggregations