Search in sources :

Example 1 with ISVNRepositoryLocation

use of org.tigris.subversion.subclipse.core.ISVNRepositoryLocation in project subclipse by subclipse.

the class CompareRevisionsAction method run.

public void run() {
    RevisionGraphEditorInput input = (RevisionGraphEditorInput) editor.getEditorInput();
    boolean isFolder = (input.getResource() != null && input.getResource().getType() != IResource.FILE) || (input.getRemoteResource() != null && input.getRemoteResource().isFolder());
    ISVNInfo info = input.getInfo();
    try {
        ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(info.getRepository().toString());
        ISVNRemoteResource remoteResource1;
        ISVNRemoteResource remoteResource2;
        if (isFolder) {
            remoteResource1 = new RemoteFolder(repository, new SVNUrl(repository.getLocation() + node1.getBranch().getPath()), new SVNRevision.Number(node1.getRevision()));
            remoteResource2 = new RemoteFolder(repository, new SVNUrl(repository.getLocation() + node2.getBranch().getPath()), new SVNRevision.Number(node2.getRevision()));
        } else {
            remoteResource1 = new RemoteFile(repository, new SVNUrl(repository.getLocation() + node1.getBranch().getPath()), new SVNRevision.Number(node1.getRevision()));
            remoteResource2 = new RemoteFile(repository, new SVNUrl(repository.getLocation() + node2.getBranch().getPath()), new SVNRevision.Number(node2.getRevision()));
        }
        ISVNRemoteResource[] selectedResources = { remoteResource1, remoteResource2 };
        DifferencesDialog dialog = new DifferencesDialog(Display.getDefault().getActiveShell(), null, selectedResources, editor.getEditorSite().getPart());
        dialog.setFromRevision(Long.toString(node1.getRevision()));
        dialog.setToRevision(Long.toString(node2.getRevision()));
        dialog.open();
    } catch (Exception e) {
        MessageDialog.openError(Display.getDefault().getActiveShell(), "Compare Revisions", e.getMessage());
    }
}
Also used : ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) RevisionGraphEditorInput(org.tigris.subversion.subclipse.graph.editors.RevisionGraphEditorInput) DifferencesDialog(org.tigris.subversion.subclipse.ui.dialogs.DifferencesDialog) RemoteFolder(org.tigris.subversion.subclipse.core.resources.RemoteFolder) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) ISVNInfo(org.tigris.subversion.svnclientadapter.ISVNInfo) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) RemoteFile(org.tigris.subversion.subclipse.core.resources.RemoteFile)

Example 2 with ISVNRepositoryLocation

use of org.tigris.subversion.subclipse.core.ISVNRepositoryLocation in project subclipse by subclipse.

the class SharingWizard method addPages.

/**
 * add pages
 */
public void addPages() {
    ImageDescriptor sharingImage = SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_WIZBAN_SHARE);
    if (project.getLocation() == null) {
        CannotSharePage cannotSharePage = new CannotSharePage("cannotSharePage", Policy.bind("SharingWizard.importTitle"), sharingImage, // $NON-NLS-1$ //$NON-NLS-2$
        project);
        addPage(cannotSharePage);
    } else if (doesSVNDirectoryExist()) {
        // if .svn directory exists, we add the autoconnect page
        autoconnectPage = new ConfigurationWizardAutoconnectPage("autoconnectPage", Policy.bind("SharingWizard.autoConnectTitle"), sharingImage, // $NON-NLS-1$ //$NON-NLS-2$
        projectStatus);
        autoconnectPage.setProject(project);
        autoconnectPage.setDescription(// $NON-NLS-1$
        Policy.bind("SharingWizard.autoConnectTitleDescription"));
        addPage(autoconnectPage);
    } else {
        try {
            ISVNLocalFolder localFolder = SVNWorkspaceRoot.getSVNFolderFor(project);
            if (localFolder instanceof LocalFolder) {
                IFolder[] svnFolders = ((LocalFolder) localFolder).getSVNFolders(null, false);
                if (svnFolders.length > 0) {
                    warningPage = new SvnFoldersExistWarningPage("warningPage", Policy.bind("SharingWizard.importTitle"), sharingImage, // $NON-NLS-1$ //$NON-NLS-2$
                    svnFolders);
                    // $NON-NLS-1$
                    warningPage.setDescription(Policy.bind("SharingWizard.svnFolderExists"));
                    addPage(warningPage);
                // Remember to update getNextPage.
                }
            }
        } catch (SVNException e) {
            SVNUIPlugin.openError(getShell(), null, null, e, SVNUIPlugin.PERFORM_SYNC_EXEC);
        }
        // otherwise we add :
        // - the repository selection page
        // - any contributed repository source pages
        // - the create location page
        // - the module selection page
        // - the finish page
        IRunnableWithProgress runnable = new IRunnableWithProgress() {

            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                locations = SVNUIPlugin.getPlugin().getRepositoryManager().getKnownRepositoryLocations(monitor);
            }
        };
        try {
            new ProgressMonitorDialog(getShell()).run(true, false, runnable);
        } catch (Exception e) {
            SVNUIPlugin.openError(getShell(), null, null, e, SVNUIPlugin.LOG_TEAM_EXCEPTIONS);
        }
        locationPage = new RepositorySelectionPage("importPage", Policy.bind("SharingWizard.importTitle"), // $NON-NLS-1$ //$NON-NLS-2$
        sharingImage);
        locationPage.setDescription(// $NON-NLS-1$
        Policy.bind("SharingWizard.importTitleDescription"));
        addPage(locationPage);
        ISVNRepositorySourceProvider[] repositorySourceProviders = null;
        try {
            repositorySourceProviders = SVNUIPlugin.getRepositorySourceProviders();
        } catch (Exception e) {
        }
        if (repositorySourceProviders != null && repositorySourceProviders.length > 0) {
            repositorySourceProviderPage = new ConfigurationWizardRepositorySourceProviderPage("source", Policy.bind("NewLocationWizard.heading"), SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_WIZBAN_NEW_LOCATION), // $NON-NLS-1$ //$NON-NLS-2$
            repositorySourceProviders);
            repositorySourceProviderPage.setDescription(// $NON-NLS-1$
            Policy.bind("NewLocationWizard.0"));
            addPage(repositorySourceProviderPage);
            for (ISVNRepositorySourceProvider repositorySourceProvider : repositorySourceProviders) {
                SVNRepositoryProviderWizardPage wizardPage = repositorySourceProvider.getWizardPage();
                addPage(wizardPage);
                wizardPageMap.put(repositorySourceProvider, wizardPage);
            }
        }
        createLocationPage = new ConfigurationWizardMainPage("createLocationPage", Policy.bind("SharingWizard.enterInformation"), // $NON-NLS-1$ //$NON-NLS-2$
        sharingImage);
        createLocationPage.setDescription(// $NON-NLS-1$
        Policy.bind("SharingWizard.enterInformationDescription"));
        addPage(createLocationPage);
        createLocationPage.setDialogSettings(getDialogSettings());
        ISVNRepositoryLocationProvider repositoryLocationProvider = new ISVNRepositoryLocationProvider() {

            public ISVNRepositoryLocation getLocation() throws TeamException {
                return SharingWizard.this.getLocation();
            }

            public IProject getProject() {
                return SharingWizard.this.getProject();
            }
        };
        directoryPage = new DirectorySelectionPage("modulePage", Policy.bind("SharingWizard.enterModuleName"), sharingImage, // $NON-NLS-1$ //$NON-NLS-2$
        repositoryLocationProvider);
        directoryPage.setDescription(// $NON-NLS-1$
        Policy.bind("SharingWizard.enterModuleNameDescription"));
        addPage(directoryPage);
        finishPage = new SharingWizardFinishPage("finishPage", Policy.bind("SharingWizard.readyToFinish"), sharingImage, // $NON-NLS-1$ //$NON-NLS-2$
        repositoryLocationProvider);
        finishPage.setDescription(// $NON-NLS-1$
        Policy.bind("SharingWizard.readyToFinishDescription"));
        addPage(finishPage);
    }
}
Also used : ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) ConfigurationWizardMainPage(org.tigris.subversion.subclipse.ui.wizards.ConfigurationWizardMainPage) SVNException(org.tigris.subversion.subclipse.core.SVNException) SVNRepositoryProviderWizardPage(org.tigris.subversion.subclipse.ui.wizards.SVNRepositoryProviderWizardPage) ConfigurationWizardRepositorySourceProviderPage(org.tigris.subversion.subclipse.ui.wizards.ConfigurationWizardRepositorySourceProviderPage) InvocationTargetException(java.lang.reflect.InvocationTargetException) CoreException(org.eclipse.core.runtime.CoreException) SVNException(org.tigris.subversion.subclipse.core.SVNException) InvocationTargetException(java.lang.reflect.InvocationTargetException) TeamException(org.eclipse.team.core.TeamException) IOException(java.io.IOException) IProject(org.eclipse.core.resources.IProject) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) ISVNLocalFolder(org.tigris.subversion.subclipse.core.ISVNLocalFolder) ISVNLocalFolder(org.tigris.subversion.subclipse.core.ISVNLocalFolder) LocalFolder(org.tigris.subversion.subclipse.core.resources.LocalFolder) ISVNRepositorySourceProvider(org.tigris.subversion.subclipse.ui.ISVNRepositorySourceProvider) TeamException(org.eclipse.team.core.TeamException) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor)

Example 3 with ISVNRepositoryLocation

use of org.tigris.subversion.subclipse.core.ISVNRepositoryLocation in project subclipse by subclipse.

the class SharingWizard method performFinish.

/*
   * @see IWizard#performFinish
   */
public boolean performFinish() {
    shareCanceled = false;
    if (!WorkspacePathValidator.validateWorkspacePath())
        return true;
    final boolean[] result = new boolean[] { true };
    try {
        final boolean[] doSync = new boolean[] { false };
        getContainer().run(true, /* fork */
        true, /* cancel */
        new IRunnableWithProgress() {

            public void run(IProgressMonitor monitor) throws InvocationTargetException {
                try {
                    // $NON-NLS-1$
                    monitor.beginTask("", 100);
                    if (autoconnectPage != null && (projectStatus != null)) {
                        // Autoconnect to the repository using svn/ directories
                        // Get the repository location (the get will add the locatin to the provider)
                        boolean isPreviouslyKnown = SVNProviderPlugin.getPlugin().getRepositories().isKnownRepository(projectStatus.getUrlString(), false);
                        // Validate the connection if the user wants to
                        boolean validate = autoconnectPage.getValidate();
                        if (validate && !isPreviouslyKnown) {
                            ISVNRepositoryLocation location = SVNProviderPlugin.getPlugin().getRepository(projectStatus.getUrlString());
                            // Do the validation
                            try {
                                location.validateConnection(new SubProgressMonitor(monitor, 50));
                            } catch (final TeamException e) {
                                // Exception validating. We can continue if the user wishes.
                                final boolean[] keep = new boolean[] { false };
                                getShell().getDisplay().syncExec(new Runnable() {

                                    public void run() {
                                        keep[0] = MessageDialog.openQuestion(getContainer().getShell(), Policy.bind(// $NON-NLS-1$
                                        "SharingWizard.validationFailedTitle"), Policy.bind("SharingWizard.validationFailedText", new Object[] { e.getStatus().getMessage() }));
                                    // $NON-NLS-1$
                                    }
                                });
                                if (!keep[0]) {
                                    // Remove the root
                                    try {
                                        if (!isPreviouslyKnown) {
                                            SVNProviderPlugin.getPlugin().getRepositories().disposeRepository(location);
                                        }
                                    } catch (TeamException e1) {
                                        SVNUIPlugin.openError(getContainer().getShell(), Policy.bind("exception"), null, e1, // $NON-NLS-1$
                                        SVNUIPlugin.PERFORM_SYNC_EXEC);
                                    }
                                    result[0] = false;
                                    return;
                                }
                            // They want to keep the connection anyway. Fall through.
                            }
                        }
                        // Set the sharing
                        SVNWorkspaceRoot.setSharing(project, new SubProgressMonitor(monitor, 50));
                    } else {
                        // No svn directory : Share the project
                        doSync[0] = true;
                        // Check if the directory exists on the server
                        ISVNRepositoryLocation location = null;
                        boolean isKnown = false;
                        boolean createDirectory = true;
                        try {
                            location = getLocation();
                            isKnown = SVNProviderPlugin.getPlugin().getRepositories().isKnownRepository(location.getLocation(), false);
                            // Purge any svn folders that may exists in subfolders
                            SVNWorkspaceRoot.getSVNFolderFor(project).unmanage(null);
                            // check if the remote directory already exist
                            String remoteDirectoryName = getRemoteDirectoryName();
                            ISVNRemoteFolder folder = location.getRemoteFolder(remoteDirectoryName);
                            if (folder.exists(new SubProgressMonitor(monitor, 50))) {
                                if (autoconnectPage == null) {
                                    getShell().getDisplay().syncExec(new Runnable() {

                                        public void run() {
                                            if (!MessageDialog.openQuestion(getShell(), Policy.bind("SharingWizard.couldNotImport"), Policy.bind("SharingWizard.couldNotImportLong"))) {
                                                // $NON-NLS-1$ //$NON-NLS-2$
                                                shareCanceled = true;
                                                return;
                                            }
                                        }
                                    });
                                    if (shareCanceled)
                                        return;
                                }
                                createDirectory = false;
                            }
                        } catch (TeamException e) {
                            SVNUIPlugin.openError(getShell(), null, null, e, SVNUIPlugin.PERFORM_SYNC_EXEC);
                            result[0] = false;
                            doSync[0] = false;
                            return;
                        }
                        // Add the location to the provider if it is new
                        if (!isKnown) {
                            SVNProviderPlugin.getPlugin().getRepositories().addOrUpdateRepository(location);
                        }
                        // Create the remote module for the project
                        SVNWorkspaceRoot.shareProject(location, project, getRemoteDirectoryName(), finishPage.getComment(), createDirectory, new SubProgressMonitor(monitor, 50));
                        try {
                            project.refreshLocal(IProject.DEPTH_INFINITE, new SubProgressMonitor(monitor, 50));
                        } catch (CoreException ce) {
                            throw new TeamException(ce.getStatus());
                        }
                        // Map any nested projects to repository provider.
                        Collection<File> files = new ArrayList<File>();
                        collectProjectFilesFromDirectory(files, project.getLocation().toFile(), null, monitor);
                        for (File file : files) {
                            IResource resource = File2Resource.getResource(file.getParentFile());
                            IProject childProject = resource.getProject();
                            if (!childProject.equals(project)) {
                                RepositoryProvider.map(childProject, SVNProviderPlugin.getTypeId());
                            }
                        }
                    }
                } catch (TeamException e) {
                    throw new InvocationTargetException(e);
                } finally {
                    monitor.done();
                }
            }
        });
        if (shareCanceled)
            return false;
        if (doSync[0]) {
            final List syncList = new ArrayList();
            syncList.add(project);
            try {
                ISynchronizeParticipantReference[] references = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
                if (references != null) {
                    for (int i = 0; i < references.length; i++) {
                        ISynchronizeParticipantReference reference = references[i];
                        ISynchronizeParticipant participant = reference.getParticipant();
                        if (participant instanceof SVNSynchronizeParticipant) {
                            SVNSynchronizeParticipant svnParticipant = (SVNSynchronizeParticipant) participant;
                            IResource[] resources = svnParticipant.getResources();
                            if (resources != null) {
                                for (int j = 0; j < resources.length; j++) {
                                    IResource resource = resources[j];
                                    if (!resource.equals(project)) {
                                        syncList.add(resource);
                                    }
                                }
                            }
                            break;
                        }
                    }
                }
            } catch (Exception e) {
            }
            SynchronizeAction synchronizeAction = new SynchronizeAction() {

                protected IResource[] getSelectedResources() {
                    IResource[] selection = new IResource[syncList.size()];
                    syncList.toArray(selection);
                    return selection;
                }
            };
            synchronizeAction.run(null);
        }
    } catch (InterruptedException e) {
        return true;
    } catch (InvocationTargetException e) {
        SVNUIPlugin.openError(getContainer().getShell(), null, null, e);
        return false;
    }
    return result[0];
}
Also used : ArrayList(java.util.ArrayList) ISynchronizeParticipantReference(org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference) ISVNRemoteFolder(org.tigris.subversion.subclipse.core.ISVNRemoteFolder) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) TeamException(org.eclipse.team.core.TeamException) ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) SVNSynchronizeParticipant(org.tigris.subversion.subclipse.ui.subscriber.SVNSynchronizeParticipant) List(java.util.List) ArrayList(java.util.ArrayList) SynchronizeAction(org.tigris.subversion.subclipse.ui.actions.SynchronizeAction) InvocationTargetException(java.lang.reflect.InvocationTargetException) SubProgressMonitor(org.eclipse.core.runtime.SubProgressMonitor) IProject(org.eclipse.core.resources.IProject) CoreException(org.eclipse.core.runtime.CoreException) SVNException(org.tigris.subversion.subclipse.core.SVNException) InvocationTargetException(java.lang.reflect.InvocationTargetException) TeamException(org.eclipse.team.core.TeamException) IOException(java.io.IOException) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) CoreException(org.eclipse.core.runtime.CoreException) Collection(java.util.Collection) ISynchronizeParticipant(org.eclipse.team.ui.synchronize.ISynchronizeParticipant) File(java.io.File) IResource(org.eclipse.core.resources.IResource)

Example 4 with ISVNRepositoryLocation

use of org.tigris.subversion.subclipse.core.ISVNRepositoryLocation in project subclipse by subclipse.

the class GetLogsCommand method run.

/**
 * execute the command
 *
 * @param aMonitor
 * @throws SVNException
 */
public void run(IProgressMonitor aMonitor) throws SVNException {
    ISVNRepositoryLocation repository = null;
    ISVNClientAdapter svnClient = null;
    logEntries = null;
    IProgressMonitor monitor = Policy.monitorFor(aMonitor);
    // $NON-NLS-1$
    monitor.beginTask(Policy.bind("RemoteFile.getLogEntries"), 100);
    ISVNLogMessage[] logMessages;
    try {
        if (callback == null) {
            logMessages = remoteResource.getLogMessages(pegRevision, revisionStart, revisionEnd, stopOnCopy, !SVNProviderPlugin.getPlugin().getSVNClientManager().isFetchChangePathOnDemand(), limit, includeMergedRevisions);
        } else {
            repository = remoteResource.getRepository();
            svnClient = repository.getSVNClient();
            if (remoteResource instanceof BaseResource) {
                boolean logMessagesRetrieved = false;
                ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(remoteResource.getResource());
                if (svnResource != null) {
                    LocalResourceStatus status = svnResource.getStatus();
                    if (status != null && status.isCopied()) {
                        ISVNInfo info = svnClient.getInfoFromWorkingCopy(svnResource.getFile());
                        SVNUrl copiedFromUrl = info.getCopyUrl();
                        if (copiedFromUrl != null) {
                            svnClient.getLogMessages(copiedFromUrl, SVNRevision.HEAD, revisionStart, revisionEnd, stopOnCopy, !SVNProviderPlugin.getPlugin().getSVNClientManager().isFetchChangePathOnDemand(), limit, includeMergedRevisions, ISVNClientAdapter.DEFAULT_LOG_PROPERTIES, callback);
                            logMessagesRetrieved = true;
                            GetRemoteResourceCommand getRemoteResourceCommand = new GetRemoteResourceCommand(remoteResource.getRepository(), copiedFromUrl, SVNRevision.HEAD);
                            getRemoteResourceCommand.run(null);
                            remoteResource = getRemoteResourceCommand.getRemoteResource();
                        }
                    }
                }
                if (!logMessagesRetrieved)
                    svnClient.getLogMessages(((BaseResource) remoteResource).getFile(), pegRevision, revisionStart, revisionEnd, stopOnCopy, !SVNProviderPlugin.getPlugin().getSVNClientManager().isFetchChangePathOnDemand(), limit, includeMergedRevisions, ISVNClientAdapter.DEFAULT_LOG_PROPERTIES, callback);
            } else {
                svnClient.getLogMessages(remoteResource.getUrl(), pegRevision, revisionStart, revisionEnd, stopOnCopy, !SVNProviderPlugin.getPlugin().getSVNClientManager().isFetchChangePathOnDemand(), limit, includeMergedRevisions, ISVNClientAdapter.DEFAULT_LOG_PROPERTIES, callback);
            }
            logMessages = callback.getLogMessages();
        }
        if (remoteResource.isFolder()) {
            logEntries = LogEntry.createLogEntriesFrom((ISVNRemoteFolder) remoteResource, logMessages, getTags(logMessages));
        } else {
            logEntries = LogEntry.createLogEntriesFrom((ISVNRemoteFile) remoteResource, logMessages, getTags(logMessages), getUrls(logMessages));
        }
    } catch (Exception e) {
        throw SVNException.wrapException(e);
    } finally {
        if (repository != null) {
            repository.returnSVNClient(svnClient);
        }
        monitor.done();
    }
}
Also used : SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) BaseResource(org.tigris.subversion.subclipse.core.resources.BaseResource) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) ISVNRemoteFolder(org.tigris.subversion.subclipse.core.ISVNRemoteFolder) ISVNLogMessage(org.tigris.subversion.svnclientadapter.ISVNLogMessage) SVNException(org.tigris.subversion.subclipse.core.SVNException) ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ISVNRemoteFile(org.tigris.subversion.subclipse.core.ISVNRemoteFile) ISVNInfo(org.tigris.subversion.svnclientadapter.ISVNInfo) LocalResourceStatus(org.tigris.subversion.subclipse.core.resources.LocalResourceStatus) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 5 with ISVNRepositoryLocation

use of org.tigris.subversion.subclipse.core.ISVNRepositoryLocation in project subclipse by subclipse.

the class RepositoryResourcesManager method deleteRemoteResources.

/**
 * delete some remote resources Resources can be from several RemoteRepositoryLocations
 */
public void deleteRemoteResources(ISVNRemoteResource[] remoteResources, String message, IProgressMonitor monitor) throws SVNException {
    IProgressMonitor progress = Policy.monitorFor(monitor);
    progress.beginTask(Policy.bind("RepositoryResourcesManager.deleteRemoteResources"), // $NON-NLS-1$
    100 * remoteResources.length);
    // the given remote resources can come from more than a repository and so needs
    // more than one svnClient
    // we associate each repository with the corresponding resources to delete
    HashMap<ISVNRepositoryLocation, List<ISVNRemoteResource>> mapRepositories = new HashMap<ISVNRepositoryLocation, List<ISVNRemoteResource>>();
    for (ISVNRemoteResource remoteResource : remoteResources) {
        ISVNRepositoryLocation repositoryLocation = remoteResource.getRepository();
        List<ISVNRemoteResource> resources = (List<ISVNRemoteResource>) mapRepositories.get(repositoryLocation);
        if (resources == null) {
            resources = new ArrayList<ISVNRemoteResource>();
            mapRepositories.put(repositoryLocation, resources);
        }
        resources.add(remoteResource);
    }
    ISVNClientAdapter svnClient = null;
    ISVNRepositoryLocation repository = null;
    try {
        for (List<ISVNRemoteResource> resources : mapRepositories.values()) {
            repository = (resources.get(0)).getRepository();
            svnClient = repository.getSVNClient();
            SVNUrl[] urls = new SVNUrl[resources.size()];
            for (int i = 0; i < resources.size(); i++) {
                ISVNRemoteResource resource = resources.get(i);
                urls[i] = resource.getUrl();
                // refresh just says that resource needs to be updated
                // it does not update immediatly
                resource.getParent().refresh();
            }
            svnClient.remove(urls, message);
            repository.returnSVNClient(svnClient);
            svnClient = null;
            repository = null;
            for (ISVNRemoteResource resource : resources) {
                remoteResourceDeleted(resource);
            }
            progress.worked(100 * urls.length);
        }
    } catch (SVNClientException e) {
        throw SVNException.wrapException(e);
    } finally {
        if (repository != null) {
            repository.returnSVNClient(svnClient);
        }
        progress.done();
    }
}
Also used : HashMap(java.util.HashMap) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) ArrayList(java.util.ArrayList) List(java.util.List) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Aggregations

ISVNRepositoryLocation (org.tigris.subversion.subclipse.core.ISVNRepositoryLocation)69 ISVNClientAdapter (org.tigris.subversion.svnclientadapter.ISVNClientAdapter)20 InvocationTargetException (java.lang.reflect.InvocationTargetException)18 IResource (org.eclipse.core.resources.IResource)15 ISVNLocalResource (org.tigris.subversion.subclipse.core.ISVNLocalResource)15 TeamException (org.eclipse.team.core.TeamException)14 ArrayList (java.util.ArrayList)13 SVNException (org.tigris.subversion.subclipse.core.SVNException)13 SVNUrl (org.tigris.subversion.svnclientadapter.SVNUrl)13 SVNClientException (org.tigris.subversion.svnclientadapter.SVNClientException)12 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)11 File (java.io.File)10 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)9 ISVNRemoteResource (org.tigris.subversion.subclipse.core.ISVNRemoteResource)8 LocalResourceStatus (org.tigris.subversion.subclipse.core.resources.LocalResourceStatus)8 SVNRevision (org.tigris.subversion.svnclientadapter.SVNRevision)8 Iterator (java.util.Iterator)7 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)7 ISVNRemoteFolder (org.tigris.subversion.subclipse.core.ISVNRemoteFolder)7 List (java.util.List)6