/** * Adds the given resource to the list of resources to be moved. * * @param move the resource to be moved */ 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)); } }
public static void testArguments(MoveArguments[] args) { testNumberOfElements(args.length); for (int i = 0; i < args.length; i++) { MoveArguments expected = args[i]; MoveArguments actual = (MoveArguments) fgInstance.fArguments.get(i); Assert.assertEquals(expected.getDestination(), actual.getDestination()); Assert.assertEquals(expected.getUpdateReferences(), actual.getUpdateReferences()); } }
private IConnectionProfileRepository getTargetRepository() throws CoreException { Object destination = mArguments.getDestination(); if (destination instanceof ProfileManager) { return null; } else if (destination instanceof IConnectionProfile) { IManagedConnection imc = ((IConnectionProfile) destination) .getManagedConnection(IConnectionProfileRepository.class.getName()); if (imc == null) { // invalid profile Status status = new Status( Status.ERROR, ConnectivityUIPlugin.getDefault().getBundle().getSymbolicName(), -1, ConnectivityUIPlugin.getDefault() .getResourceString("CPCopyChange.error.InvalidTarget"), null); //$NON-NLS-1$ throw new CoreException(status); } else if (!imc.isConnected() || imc.getConnection() == null || imc.getConnection().getRawConnection() == null) { // repository must be connected Status status = new Status( Status.ERROR, ConnectivityUIPlugin.getDefault().getBundle().getSymbolicName(), -1, ConnectivityUIPlugin.getDefault() .getResourceString( "CPCopyChange.error.RepositoryNotConnected", //$NON-NLS-1$ new Object[] {((IConnectionProfile) destination).getName()}), null); throw new CoreException(status); } return (IConnectionProfileRepository) imc.getConnection().getRawConnection(); } // unsupported type Status status = new Status( Status.ERROR, ConnectivityUIPlugin.getDefault().getBundle().getSymbolicName(), -1, ConnectivityUIPlugin.getDefault().getResourceString("CPCopyChange.error.InvalidTarget"), null); //$NON-NLS-1$ throw new CoreException(status); }
public static void buildMoveDelta( IResourceChangeDescriptionFactory builder, IResource resource, MoveArguments args) { IPath destination = ((IResource) args.getDestination()).getFullPath().append(resource.getName()); builder.move(resource, destination); }