Search in sources :

Example 16 with ISVNRepositoryLocation

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

the class RepositoryManager method startup.

/**
 * called when plugin is started
 */
public void startup() {
    commentsManager.loadCommentHistory();
    commentsManager.loadCommentTemplates();
    keyFilesManager.loadKeyFileHistory();
    // we listen to changes to repository so that we can advise concerned views
    SVNProviderPlugin.getPlugin().getRepositoryResourcesManager().addRepositoryListener(new ISVNListener() {

        public void repositoryAdded(ISVNRepositoryLocation root) {
            rootAdded(root);
        }

        public void repositoryRemoved(ISVNRepositoryLocation root) {
            rootRemoved(root);
        }

        public void remoteResourceDeleted(ISVNRemoteResource resource) {
            resourceDeleted(resource);
        }

        public void remoteResourceCreated(ISVNRemoteFolder parent, String resourceName) {
            resourceCreated(parent, resourceName);
        }

        public void remoteResourceCopied(ISVNRemoteResource source, ISVNRemoteFolder destination) {
            resourceCopied(source, destination);
        }

        public void remoteResourceMoved(ISVNRemoteResource resource, ISVNRemoteFolder destinationFolder, String destinationResourceName) {
            resourceMoved(resource, destinationFolder, destinationResourceName);
        }

        public void repositoryModified(ISVNRepositoryLocation root) {
            rootModified(root);
        }
    });
}
Also used : ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) ISVNListener(org.tigris.subversion.subclipse.core.repo.ISVNListener) ISVNRemoteFolder(org.tigris.subversion.subclipse.core.ISVNRemoteFolder)

Example 17 with ISVNRepositoryLocation

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

the class SVNRepositoryRootElement method internalGetChildren.

public Object[] internalGetChildren(Object o, IProgressMonitor monitor) {
    ISVNRepositoryLocation location = null;
    if (o instanceof ISVNRepositoryLocation) {
        location = (ISVNRepositoryLocation) o;
    }
    if (location == null)
        return null;
    Object[] result = null;
    try {
        result = location.members(monitor);
    } catch (Exception e) {
    }
    return result;
}
Also used : ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 18 with ISVNRepositoryLocation

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

the class SVNRepositoryRootElement method fetchDeferredChildren.

public void fetchDeferredChildren(Object o, IElementCollector collector, IProgressMonitor monitor) {
    // If it's not a folder, return an empty array
    if (!(o instanceof ISVNRepositoryLocation)) {
        collector.add(new Object[0], monitor);
    }
    try {
        monitor = Policy.monitorFor(monitor);
        monitor.beginTask(Policy.bind("RemoteFolderElement_fetchingRemoteMembers.message", getLabel(o)), // $NON-NLS-1$
        100);
        FetchMembersOperation operation = new FetchMembersOperation(null, ((ISVNRepositoryLocation) o).getRootFolder(), collector);
        operation.run(Policy.subMonitorFor(monitor, 100));
    } catch (InvocationTargetException e) {
        SVNUIPlugin.openError(null, null, null, e);
    } catch (InterruptedException e) {
    // Cancelled by the user;
    } finally {
        monitor.done();
    }
}
Also used : ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) FetchMembersOperation(org.tigris.subversion.subclipse.ui.operations.FetchMembersOperation) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 19 with ISVNRepositoryLocation

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

the class ExportOperation method execute.

protected void execute(SVNTeamProvider provider, IResource[] resources, IProgressMonitor monitor) throws SVNException, InterruptedException {
    ISVNClientAdapter client = null;
    ISVNRepositoryLocation repository = null;
    try {
        for (int i = 0; i < resources.length; i++) {
            if (client == null) {
                repository = SVNWorkspaceRoot.getSVNResourceFor(resources[i]).getRepository();
                client = repository.getSVNClient();
            }
            File srcPath = new File(resources[i].getLocation().toString());
            File destPath = new File(directory + File.separator + resources[i].getName());
            try {
                client.doExport(srcPath, destPath, true);
            } catch (SVNClientException e) {
                throw SVNException.wrapException(e);
            }
        }
    } catch (SVNException e) {
        if (e.operationInterrupted()) {
            showCancelledMessage();
        } else {
            collectStatus(e.getStatus());
        }
    } finally {
        if (repository != null) {
            repository.returnSVNClient(client);
        }
        monitor.done();
    }
}
Also used : ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) SVNException(org.tigris.subversion.subclipse.core.SVNException) File(java.io.File) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 20 with ISVNRepositoryLocation

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

the class SvnWizardNewRepositoryPage method performFinish.

public boolean performFinish() {
    success = true;
    BusyIndicator.showWhile(Display.getDefault(), new Runnable() {

        public void run() {
            ISVNClientAdapter svnClient = null;
            try {
                SVNProviderPlugin provider = SVNProviderPlugin.getPlugin();
                String url = getUrl();
                if (provider.getRepositories().isKnownRepository(url, true)) {
                    MessageDialog.openError(getShell(), Policy.bind("NewRepositoryDialog.title"), // $NON-NLS-1$
                    Policy.bind("NewRepositoryDialog.alreadyExists"));
                    success = false;
                    return;
                }
                svnClient = SVNProviderPlugin.getPlugin().getSVNClient();
                File path = new File(folderText.getText().trim());
                if (!path.exists())
                    path.mkdirs();
                svnClient.createRepository(path, ISVNClientAdapter.REPOSITORY_FSTYPE_FSFS);
                if (connectionButton.getSelection()) {
                    Properties properties = new Properties();
                    // $NON-NLS-1$
                    properties.setProperty("url", url);
                    ISVNRepositoryLocation repository = provider.getRepositories().createRepository(properties);
                    provider.getRepositories().addOrUpdateRepository(repository);
                }
            } catch (Exception e) {
                MessageDialog.openError(getShell(), Policy.bind("NewRepositoryDialog.title"), // $NON-NLS-1$
                e.getLocalizedMessage());
                success = false;
            } finally {
                SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(svnClient);
            }
        }
    });
    return success;
}
Also used : ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) SVNProviderPlugin(org.tigris.subversion.subclipse.core.SVNProviderPlugin) Properties(java.util.Properties) 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