Search in sources :

Example 11 with ISVNRepositoryLocation

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

the class SVNPropertyPage method getStatus.

private void getStatus() {
    ISVNRepositoryLocation repository = null;
    ISVNClientAdapter svnClient = null;
    try {
        IResource resource = (IResource) getElement();
        SVNTeamProvider svnProvider = (SVNTeamProvider) RepositoryProvider.getProvider(resource.getProject(), SVNProviderPlugin.getTypeId());
        if (svnProvider == null)
            return;
        svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
        if (svnResource == null)
            return;
        status = svnResource.getStatus();
        if (status != null && !status.isIgnored()) {
            repository = svnResource.getRepository();
            svnClient = repository.getSVNClient();
            ISVNInfo info = svnClient.getInfoFromWorkingCopy(svnResource.getFile());
            urlCopiedFrom = info.getCopyUrl();
            revision = svnResource.getRevision();
            lockOwnerText = status.getLockOwner();
            lockCommentText = status.getLockComment();
            if (status.getLockCreationDate() != null)
                lockDateText = status.getLockCreationDate().toString();
            if (!status.isAdded()) {
                try {
                    info = svnClient.getInfo(status.getUrl());
                } catch (Exception e) {
                }
            }
            // Get lock information from server if svn:needs-lock property is set
            if (info != null && status.getLockOwner() == null && status.getUrlString() != null) {
                ISVNProperty prop = svnResource.getSvnProperty("svn:needs-lock");
                if (prop != null) {
                    lockOwnerText = info.getLockOwner();
                    if (info.getLockCreationDate() != null)
                        lockDateText = info.getLockCreationDate().toString();
                    lockCommentText = info.getLockComment();
                }
            }
        }
    } catch (Exception e) {
        SVNUIPlugin.log(new Status(IStatus.ERROR, SVNUIPlugin.ID, TeamException.UNABLE, "Property Exception", // $NON-NLS-1$
        e));
    } finally {
        if (repository != null) {
            repository.returnSVNClient(svnClient);
        }
    }
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) LocalResourceStatus(org.tigris.subversion.subclipse.core.resources.LocalResourceStatus) Status(org.eclipse.core.runtime.Status) ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) SVNTeamProvider(org.tigris.subversion.subclipse.core.SVNTeamProvider) ISVNInfo(org.tigris.subversion.svnclientadapter.ISVNInfo) ISVNProperty(org.tigris.subversion.svnclientadapter.ISVNProperty) IResource(org.eclipse.core.resources.IResource) TeamException(org.eclipse.team.core.TeamException) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 12 with ISVNRepositoryLocation

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

the class ShowDifferencesAsUnifiedDiffOperation method execute.

protected void execute(IProgressMonitor monitor) throws SVNException, InterruptedException {
    ISVNClientAdapter client = null;
    ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(fromUrl.toString());
    if (repository != null)
        client = repository.getSVNClient();
    if (client == null)
        client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
    try {
        SVNRevision pegRevision = null;
        if (fromUrl.toString().equals(toUrl.toString()) && localResource != null) {
            if (localResource.getResource() == null)
                pegRevision = SVNRevision.HEAD;
            else {
                IResource resource = localResource.getResource();
                ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
                pegRevision = svnResource.getRevision();
            }
        }
        if (pegRevision == null)
            client.diff(fromUrl, fromRevision, toUrl, toRevision, file, true);
        else
            client.diff(fromUrl, pegRevision, fromRevision, toRevision, file, true);
    } catch (SVNClientException e) {
        throw SVNException.wrapException(e);
    } finally {
        monitor.done();
        SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
    }
}
Also used : ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) IResource(org.eclipse.core.resources.IResource) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 13 with ISVNRepositoryLocation

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

the class ShowDifferencesAsUnifiedDiffOperationWC method execute.

protected void execute(IProgressMonitor monitor) throws SVNException, InterruptedException {
    ISVNClientAdapter client = null;
    ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(toUrl.toString());
    if (repository != null)
        client = repository.getSVNClient();
    if (client == null)
        client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
    try {
        client.diff(path, toUrl, toRevision, file, true);
        if (monitor.isCanceled())
            canceled = true;
    } catch (SVNClientException e) {
        throw SVNException.wrapException(e);
    } finally {
        monitor.done();
        SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
    }
}
Also used : ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 14 with ISVNRepositoryLocation

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

the class RemoveRootAction method run.

public void run() {
    ISVNRepositoryLocation[] roots = getSelectedRemoteRoots();
    if (roots.length == 0)
        return;
    SVNProviderPlugin provider = SVNProviderPlugin.getPlugin();
    for (int i = 0; i < roots.length; i++) {
        try {
            // Check if any projects are shared with the repository
            IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
            final ArrayList shared = new ArrayList();
            for (int j = 0; j < projects.length; j++) {
                RepositoryProvider teamProvider = RepositoryProvider.getProvider(projects[j], SVNProviderPlugin.getTypeId());
                if (teamProvider != null) {
                    try {
                        SVNTeamProvider svnProvider = (SVNTeamProvider) teamProvider;
                        if (svnProvider.getSVNWorkspaceRoot().getRepository().equals(roots[i])) {
                            shared.add(projects[j]);
                        }
                    } catch (Exception e) {
                    // Don't let any exception prevent from
                    // continuing
                    }
                }
            }
            // This will notify the RepositoryManager of the removal
            if (!shared.isEmpty()) {
                final String location = roots[i].getLocation();
                shell.getDisplay().syncExec(new Runnable() {

                    public void run() {
                        DetailsDialogWithProjects dialog = new DetailsDialogWithProjects(shell, Policy.bind(// $NON-NLS-1$
                        "RemoteRootAction.Unable_to_Discard_Location_1"), Policy.bind("RemoteRootAction.Projects_in_the_local_workspace_are_shared_with__2", // $NON-NLS-1$
                        location), Policy.bind(// $NON-NLS-1$
                        "RemoteRootAction.The_projects_that_are_shared_with_the_above_repository_are__4"), (IProject[]) shared.toArray(new IProject[shared.size()]), false, SVNUIPlugin.getStandardDisplay().getSystemImage(SWT.ICON_ERROR));
                        dialog.open();
                    }
                });
            } else {
                provider.getRepositories().disposeRepository(roots[i]);
            }
        } catch (SVNException e) {
            SVNUIPlugin.openError(shell, null, null, e);
            SVNUIPlugin.log(e);
        }
    }
}
Also used : SVNProviderPlugin(org.tigris.subversion.subclipse.core.SVNProviderPlugin) ArrayList(java.util.ArrayList) SVNException(org.tigris.subversion.subclipse.core.SVNException) IProject(org.eclipse.core.resources.IProject) SVNException(org.tigris.subversion.subclipse.core.SVNException) ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) SVNTeamProvider(org.tigris.subversion.subclipse.core.SVNTeamProvider) DetailsDialogWithProjects(org.tigris.subversion.subclipse.ui.util.DetailsDialogWithProjects) RepositoryProvider(org.eclipse.team.core.RepositoryProvider)

Example 15 with ISVNRepositoryLocation

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

the class RepositoriesView method refreshViewerNode.

protected void refreshViewerNode() {
    IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
    Iterator iter = selection.iterator();
    while (iter.hasNext()) {
        Object object = iter.next();
        if (object instanceof ISVNRepositoryLocation) {
            refreshAction.run();
            break;
        }
        if (object instanceof ISVNRemoteFolder)
            ((ISVNRemoteFolder) object).refresh();
        treeViewer.refresh(object);
    }
}
Also used : ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) Iterator(java.util.Iterator) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ISVNRemoteFolder(org.tigris.subversion.subclipse.core.ISVNRemoteFolder)

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