Search in sources :

Example 36 with IPath

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;
}
Also used : MoveResourcesDescriptor(org.eclipse.ltk.core.refactoring.resource.MoveResourcesDescriptor) IPath(org.eclipse.core.runtime.IPath) HashMap(java.util.HashMap)

Example 37 with IPath

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));
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) ArrayList(java.util.ArrayList)

Example 38 with IPath

use of org.eclipse.core.runtime.IPath in project che by eclipse.

the class ResourceModifications method addRename.

/**
	 * Adds the given resource to the list of renamed
	 * resources.
	 *
	 * @param rename the resource to be renamed
	 * @param arguments the arguments of the rename
	 */
public void addRename(IResource rename, RenameArguments arguments) {
    Assert.isNotNull(rename);
    Assert.isNotNull(arguments);
    if (fRename == null) {
        fRename = new ArrayList(2);
        fRenameArguments = new ArrayList(2);
    }
    fRename.add(rename);
    fRenameArguments.add(arguments);
    if (fIgnoreCount == 0) {
        IPath newPath = rename.getFullPath().removeLastSegments(1).append(arguments.getNewName());
        internalAdd(new MoveDescription(rename, newPath));
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) ArrayList(java.util.ArrayList)

Example 39 with IPath

use of org.eclipse.core.runtime.IPath in project che by eclipse.

the class ResourceModifications method buildCopyDelta.

public static void buildCopyDelta(IResourceChangeDescriptionFactory builder, IResource resource, CopyArguments args) {
    IPath destination = ((IResource) args.getDestination()).getFullPath().append(resource.getName());
    builder.copy(resource, destination);
}
Also used : IPath(org.eclipse.core.runtime.IPath)

Example 40 with IPath

use of org.eclipse.core.runtime.IPath in project che by eclipse.

the class ResourceModifications method buildMoveDelta.

public static void buildMoveDelta(IResourceChangeDescriptionFactory builder, IResource resource, MoveArguments args) {
    IPath destination = ((IResource) args.getDestination()).getFullPath().append(resource.getName());
    builder.move(resource, destination);
}
Also used : IPath(org.eclipse.core.runtime.IPath)

Aggregations

IPath (org.eclipse.core.runtime.IPath)800 Path (org.eclipse.core.runtime.Path)219 File (java.io.File)161 IFile (org.eclipse.core.resources.IFile)150 CoreException (org.eclipse.core.runtime.CoreException)135 IResource (org.eclipse.core.resources.IResource)112 IOException (java.io.IOException)100 ArrayList (java.util.ArrayList)92 IProject (org.eclipse.core.resources.IProject)85 IFolder (org.eclipse.core.resources.IFolder)80 Test (org.junit.Test)72 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)58 IClasspathEntry (org.eclipse.jdt.core.IClasspathEntry)55 IStatus (org.eclipse.core.runtime.IStatus)48 InputStream (java.io.InputStream)44 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)42 Status (org.eclipse.core.runtime.Status)36 IJavaProject (org.eclipse.jdt.core.IJavaProject)36 URL (java.net.URL)33 IContainer (org.eclipse.core.resources.IContainer)33