Search in sources :

Example 16 with MoveArguments

use of org.eclipse.ltk.core.refactoring.participants.MoveArguments in project che by eclipse.

the class MoveModifications method move.

public void move(ICompilationUnit unit, MoveArguments args) throws CoreException {
    add(unit, args, null);
    IType[] types = unit.getTypes();
    for (int tt = 0; tt < types.length; tt++) {
        add(types[tt], args, null);
    }
    IResource resourceDestination = getResourceDestination(args);
    if (resourceDestination != null && unit.getResource() != null) {
        IResource parent = resourceDestination;
        while (!parent.exists()) {
            getResourceModifications().addCreate(parent);
            parent = parent.getParent();
        }
        getResourceModifications().addMove(unit.getResource(), new MoveArguments(resourceDestination, args.getUpdateReferences()));
    }
}
Also used : MoveArguments(org.eclipse.ltk.core.refactoring.participants.MoveArguments) IResource(org.eclipse.core.resources.IResource) IType(org.eclipse.jdt.core.IType)

Aggregations

MoveArguments (org.eclipse.ltk.core.refactoring.participants.MoveArguments)16 IResource (org.eclipse.core.resources.IResource)9 IFolder (org.eclipse.core.resources.IFolder)7 RenameArguments (org.eclipse.ltk.core.refactoring.participants.RenameArguments)7 IPackageFragment (org.eclipse.jdt.core.IPackageFragment)6 IFile (org.eclipse.core.resources.IFile)4 Ignore (org.junit.Ignore)4 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)3 IContainer (org.eclipse.core.resources.IContainer)3 IPath (org.eclipse.core.runtime.IPath)3 HashSet (java.util.HashSet)2 List (java.util.List)2 RefactoringStatus (org.eclipse.ltk.core.refactoring.RefactoringStatus)2 CopyArguments (org.eclipse.ltk.core.refactoring.participants.CopyArguments)2 CopyParticipant (org.eclipse.ltk.core.refactoring.participants.CopyParticipant)2 CreateArguments (org.eclipse.ltk.core.refactoring.participants.CreateArguments)2 CreateParticipant (org.eclipse.ltk.core.refactoring.participants.CreateParticipant)2 DeleteArguments (org.eclipse.ltk.core.refactoring.participants.DeleteArguments)2 DeleteParticipant (org.eclipse.ltk.core.refactoring.participants.DeleteParticipant)2