Search in sources :

Example 26 with ISVNRemoteResource

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

the class CompareRemoteResourcesAction method isEnabled.

/*
   * @see TeamAction#isEnabled()
   */
protected boolean isEnabled() {
    ISVNRemoteResource[] resources = getSelectedRemoteResources();
    boolean enabled = (resources.length == 2) && (resources[0].isContainer() == resources[1].isContainer());
    if (!enabled) {
        Object[] selectedObjects = selection.toArray();
        if (selectedObjects.length == 2 && selectedObjects[0] instanceof ILogEntry && selectedObjects[1] instanceof ILogEntry) {
            ILogEntry logEntry1 = (ILogEntry) selectedObjects[0];
            ILogEntry logEntry2 = (ILogEntry) selectedObjects[1];
            if (logEntry1.getResource() != null && logEntry1.getResource().isFolder() && logEntry2.getResource() != null && logEntry2.getResource().isFolder())
                enabled = true;
        }
    }
    return enabled;
}
Also used : ILogEntry(org.tigris.subversion.subclipse.core.history.ILogEntry) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource)

Example 27 with ISVNRemoteResource

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

the class CopyRemoteResourceAction method execute.

/*
   * (non-Javadoc)
   *
   * @see org.tigris.subversion.subclipse.ui.actions.SVNAction#execute(org.eclipse.jface.action.IAction)
   */
protected void execute(IAction action) {
    ISVNRemoteResource[] remoteResources = getSelectedRemoteResources();
    Clipboard clipboard = new Clipboard(getShell().getDisplay());
    clipboard.setContents(new Object[] { remoteResources[0] }, new Transfer[] { RemoteResourceTransfer.getInstance() });
    clipboard.dispose();
}
Also used : ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) Clipboard(org.eclipse.swt.dnd.Clipboard)

Example 28 with ISVNRemoteResource

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

the class CopyUrlToClipboardAction method execute.

protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
    Clipboard clipboard = new Clipboard(Display.getCurrent());
    Transfer transfer = TextTransfer.getInstance();
    ISVNRemoteResource[] selectedResources = getSelectedRemoteResources();
    clipboard.setContents(new String[] { selectedResources[0].getUrl().toString() }, new Transfer[] { transfer });
    clipboard.dispose();
}
Also used : TextTransfer(org.eclipse.swt.dnd.TextTransfer) Transfer(org.eclipse.swt.dnd.Transfer) Clipboard(org.eclipse.swt.dnd.Clipboard) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource)

Example 29 with ISVNRemoteResource

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

the class PasteRemoteResourceAction method execute.

/* (non-Javadoc)
   * @see org.tigris.subversion.subclipse.ui.actions.SVNAction#execute(org.eclipse.jface.action.IAction)
   */
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
    Clipboard clipboard = new Clipboard(getShell().getDisplay());
    final ISVNRemoteResource resource = (ISVNRemoteResource) clipboard.getContents(RemoteResourceTransfer.getInstance());
    clipboard.dispose();
    RepositoryManager manager = SVNUIPlugin.getPlugin().getRepositoryManager();
    final String message = manager.promptForComment(getShell(), new IResource[] {});
    // canceled
    if (message == null)
        return;
    ISVNRemoteResource selectedResource = getSelectedRemoteResources()[0];
    final ISVNRemoteFolder destination = (selectedResource.isFolder() ? (ISVNRemoteFolder) selectedResource : selectedResource.getParent());
    run(new IRunnableWithProgress() {

        public void run(IProgressMonitor monitor) throws InvocationTargetException {
            try {
                SVNProviderPlugin.getPlugin().getRepositoryResourcesManager().copyRemoteResource(resource, destination, message, monitor);
            } catch (TeamException e) {
                throw new InvocationTargetException(e);
            }
        }
    }, true, /* cancelable */
    PROGRESS_BUSYCURSOR);
}
Also used : TeamException(org.eclipse.team.core.TeamException) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) RepositoryManager(org.tigris.subversion.subclipse.ui.repository.RepositoryManager) Clipboard(org.eclipse.swt.dnd.Clipboard) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) ISVNRemoteFolder(org.tigris.subversion.subclipse.core.ISVNRemoteFolder) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Example 30 with ISVNRemoteResource

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

the class RepositoryBranchTagAction method execute.

protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
    ISVNRemoteResource[] resources = getSelectedRemoteResources();
    BranchTagWizard wizard = new BranchTagWizard(resources);
    WizardDialog dialog = // $NON-NLS-1$
    new SizePersistedWizardDialog(getShell(), wizard, "BranchTag");
    if (dialog.open() == WizardDialog.OK) {
        SVNUrl[] sourceUrls = wizard.getUrls();
        SVNUrl destinationUrl = wizard.getToUrl();
        String message = wizard.getComment();
        SVNRevision revision = wizard.getRevision();
        boolean makeParents = wizard.isMakeParents();
        ISVNClientAdapter client = null;
        try {
            ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(sourceUrls[0].toString());
            if (repository != null)
                client = repository.getSVNClient();
            if (client == null)
                client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
            RepositoryBranchTagOperation branchTagOperation = new RepositoryBranchTagOperation(getTargetPart(), client, sourceUrls, destinationUrl, revision, message, makeParents);
            branchTagOperation.setMultipleTransactions(wizard.isSameStructure());
            branchTagOperation.run();
        } catch (Exception e) {
            MessageDialog.openError(getShell(), Policy.bind("BranchTagDialog.title"), e.getMessage());
        } finally {
        // BranchTagCommand will dispose.
        // SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
        }
    }
}
Also used : SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) RepositoryBranchTagOperation(org.tigris.subversion.subclipse.ui.operations.RepositoryBranchTagOperation) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) InvocationTargetException(java.lang.reflect.InvocationTargetException) TeamException(org.eclipse.team.core.TeamException) ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) BranchTagWizard(org.tigris.subversion.subclipse.ui.wizards.BranchTagWizard) SizePersistedWizardDialog(org.tigris.subversion.subclipse.ui.wizards.SizePersistedWizardDialog) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) WizardDialog(org.eclipse.jface.wizard.WizardDialog) SizePersistedWizardDialog(org.tigris.subversion.subclipse.ui.wizards.SizePersistedWizardDialog) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Aggregations

ISVNRemoteResource (org.tigris.subversion.subclipse.core.ISVNRemoteResource)69 SVNException (org.tigris.subversion.subclipse.core.SVNException)23 SVNUrl (org.tigris.subversion.svnclientadapter.SVNUrl)21 InvocationTargetException (java.lang.reflect.InvocationTargetException)16 TeamException (org.eclipse.team.core.TeamException)16 SVNRevision (org.tigris.subversion.svnclientadapter.SVNRevision)16 IResource (org.eclipse.core.resources.IResource)15 ILogEntry (org.tigris.subversion.subclipse.core.history.ILogEntry)14 ArrayList (java.util.ArrayList)12 ParseException (java.text.ParseException)11 ISVNLocalResource (org.tigris.subversion.subclipse.core.ISVNLocalResource)10 CoreException (org.eclipse.core.runtime.CoreException)9 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)9 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)9 ISVNRepositoryLocation (org.tigris.subversion.subclipse.core.ISVNRepositoryLocation)8 MalformedURLException (java.net.MalformedURLException)7 ISVNRemoteFolder (org.tigris.subversion.subclipse.core.ISVNRemoteFolder)7 RemoteFile (org.tigris.subversion.subclipse.core.resources.RemoteFile)7 HistoryDialog (org.tigris.subversion.subclipse.ui.dialogs.HistoryDialog)6 ISVNClientAdapter (org.tigris.subversion.svnclientadapter.ISVNClientAdapter)6