Search in sources :

Example 66 with ISVNRepositoryLocation

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

the class BranchTagAction method isEnabledForMultipleResources.

/*
   * (non-Javadoc)
   * @see org.tigris.subversion.subclipse.ui.actions.WorkspaceAction#isEnabledForMultipleResources()
   */
protected boolean isEnabledForMultipleResources() {
    try {
        // Must all be from same repository.
        ISVNRepositoryLocation repository = null;
        IResource[] selectedResources = getSelectedResources();
        for (int i = 0; i < selectedResources.length; i++) {
            ISVNRepositoryLocation compareToRepository = null;
            ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(selectedResources[i]);
            if (svnResource == null || !svnResource.isManaged()) {
                return false;
            }
            LocalResourceStatus status = svnResource.getStatusFromCache();
            if (status != null) {
                compareToRepository = status.getRepository();
            }
            if (compareToRepository == null) {
                return false;
            }
            if (repository != null && !compareToRepository.equals(repository)) {
                return false;
            }
            repository = compareToRepository;
        }
        return true;
    } catch (Exception e) {
        return false;
    }
}
Also used : ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) LocalResourceStatus(org.tigris.subversion.subclipse.core.resources.LocalResourceStatus) IResource(org.eclipse.core.resources.IResource) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 67 with ISVNRepositoryLocation

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

the class SwitchAction method isEnabledForMultipleResources.

/*
   * (non-Javadoc)
   * @see org.tigris.subversion.subclipse.ui.actions.WorkspaceAction#isEnabledForMultipleResources()
   */
protected boolean isEnabledForMultipleResources() {
    try {
        // Must all be from same repository.
        ISVNRepositoryLocation repository = null;
        IResource[] selectedResources = getSelectedResources();
        for (int i = 0; i < selectedResources.length; i++) {
            ISVNRepositoryLocation compareToRepository = null;
            ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(selectedResources[i]);
            if (svnResource == null || !svnResource.isManaged()) {
                return false;
            }
            LocalResourceStatus status = svnResource.getStatusFromCache();
            if (status != null) {
                compareToRepository = status.getRepository();
            }
            if (compareToRepository == null) {
                return false;
            }
            if (repository != null && !compareToRepository.equals(repository)) {
                return false;
            }
            repository = compareToRepository;
        }
        return true;
    } catch (Exception e) {
        return false;
    }
}
Also used : ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) LocalResourceStatus(org.tigris.subversion.subclipse.core.resources.LocalResourceStatus) IResource(org.eclipse.core.resources.IResource) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 68 with ISVNRepositoryLocation

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

the class SVNRepositoryPropertiesPage method initialize.

/**
 * Initializes the page
 */
private void initialize() {
    location = null;
    IAdaptable element = getElement();
    if (element instanceof ISVNRepositoryLocation) {
        location = (ISVNRepositoryLocation) element;
    } else {
        Object adapter = element.getAdapter(ISVNRepositoryLocation.class);
        if (adapter instanceof ISVNRepositoryLocation) {
            location = (ISVNRepositoryLocation) adapter;
        }
    }
    showCredentials = SVNProviderPlugin.getPlugin().getSVNClientManager().getSvnClientInterface().equals(COMMANDLINE_CLIENT);
    if (!showCredentials) {
        if (location.getUsername() != null && !location.getUsername().trim().equals(""))
            showCredentials = true;
    }
}
Also used : IAdaptable(org.eclipse.core.runtime.IAdaptable) ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation)

Example 69 with ISVNRepositoryLocation

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

the class RemoveOperation method execute.

protected void execute(IProgressMonitor monitor) throws SVNException, InterruptedException {
    ISVNClientAdapter client = null;
    ISVNRepositoryLocation repository = null;
    ArrayList files = new ArrayList();
    for (int i = 0; i < resources.length; i++) {
        ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resources[i]);
        if (client == null) {
            repository = svnResource.getRepository();
            client = repository.getSVNClient();
        }
        files.add(svnResource.getFile());
    }
    File[] fileArray = new File[files.size()];
    files.toArray(fileArray);
    try {
        client.remove(fileArray, true);
        refresh();
    } catch (SVNClientException e) {
        throw SVNException.wrapException(e);
    } finally {
        if (repository != null) {
            repository.returnSVNClient(client);
        }
        monitor.done();
    }
}
Also used : ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) ArrayList(java.util.ArrayList) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) File(java.io.File) 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