Search in sources :

Example 1 with ReplaceOperation

use of org.tigris.subversion.subclipse.ui.operations.ReplaceOperation in project subclipse by subclipse.

the class SVNHistoryPage method getUpdateToRevisionAction.

// update to the selected revision (context menu)
private IAction getUpdateToRevisionAction() {
    if (updateToRevisionAction == null) {
        updateToRevisionAction = getContextMenuAction(Policy.bind("HistoryView.getRevisionAction"), new // $NON-NLS-1$
        IWorkspaceRunnable() {

            public void run(IProgressMonitor monitor) throws CoreException {
                ISelection selection = getSelection();
                if (!(selection instanceof IStructuredSelection))
                    return;
                IStructuredSelection ss = (IStructuredSelection) selection;
                ISVNRemoteFile remoteFile = (ISVNRemoteFile) getLogEntry(ss).getRemoteResource();
                try {
                    if (remoteFile != null) {
                        if (confirmOverwrite()) {
                            IFile file = (IFile) resource;
                            new ReplaceOperation(getSite().getPage().getActivePart(), file, remoteFile.getLastChangedRevision()).run(monitor);
                            historyTableProvider.setRemoteResource(remoteFile);
                            historyTableProvider.setProjectProperties(ProjectProperties.getProjectProperties(resource));
                            Display.getDefault().asyncExec(new Runnable() {

                                public void run() {
                                    tableHistoryViewer.refresh();
                                }
                            });
                        }
                    }
                } catch (InvocationTargetException e) {
                    throw new CoreException(new SVNStatus(IStatus.ERROR, 0, e.getMessage()));
                } catch (InterruptedException e) {
                // Cancelled by user
                }
            }
        });
        PlatformUI.getWorkbench().getHelpSystem().setHelp(updateToRevisionAction, IHelpContextIds.GET_FILE_REVISION_ACTION);
    }
    return updateToRevisionAction;
}
Also used : SVNStatus(org.tigris.subversion.subclipse.core.SVNStatus) IWorkspaceRunnable(org.eclipse.core.resources.IWorkspaceRunnable) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IFile(org.eclipse.core.resources.IFile) ReplaceOperation(org.tigris.subversion.subclipse.ui.operations.ReplaceOperation) CoreException(org.eclipse.core.runtime.CoreException) ISVNRemoteFile(org.tigris.subversion.subclipse.core.ISVNRemoteFile) IWorkspaceRunnable(org.eclipse.core.resources.IWorkspaceRunnable) ISelection(org.eclipse.jface.viewers.ISelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 2 with ReplaceOperation

use of org.tigris.subversion.subclipse.ui.operations.ReplaceOperation in project subclipse by subclipse.

the class ReplaceWithRemoteAction method execute.

public void execute(IAction action) throws InvocationTargetException, InterruptedException {
    IResource[] resources = null;
    try {
        resources = checkOverwriteOfDirtyResources(getSelectedResources());
    } catch (TeamException e) {
        throw new InvocationTargetException(e);
    }
    // Peform the replace in the background
    ReplaceOperation replaceOperation = new ReplaceOperation(getTargetPart(), resources, this.revision);
    // replaceOperation.setResourcesToUpdate(getSelectedResources());
    replaceOperation.run();
}
Also used : TeamException(org.eclipse.team.core.TeamException) ReplaceOperation(org.tigris.subversion.subclipse.ui.operations.ReplaceOperation) IResource(org.eclipse.core.resources.IResource) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)2 ReplaceOperation (org.tigris.subversion.subclipse.ui.operations.ReplaceOperation)2 IFile (org.eclipse.core.resources.IFile)1 IResource (org.eclipse.core.resources.IResource)1 IWorkspaceRunnable (org.eclipse.core.resources.IWorkspaceRunnable)1 CoreException (org.eclipse.core.runtime.CoreException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 ISelection (org.eclipse.jface.viewers.ISelection)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 TeamException (org.eclipse.team.core.TeamException)1 ISVNRemoteFile (org.tigris.subversion.subclipse.core.ISVNRemoteFile)1 SVNStatus (org.tigris.subversion.subclipse.core.SVNStatus)1