Search in sources :

Example 1 with SVNCompareEditorInput

use of org.tigris.subversion.subclipse.ui.compare.SVNCompareEditorInput in project subclipse by subclipse.

the class MergeWizardRevisionsPage method compareRevisions.

private void compareRevisions() {
    IStructuredSelection sel = (IStructuredSelection) changePathsViewer.getSelection();
    Object sel0 = sel.getFirstElement();
    if (sel0 instanceof LogEntryChangePath) {
        LogEntryChangePath logEntryChangePath = (LogEntryChangePath) sel0;
        try {
            if (!logEntryChangePath.getRemoteResource().isContainer()) {
                ISVNRemoteResource left = logEntryChangePath.getRemoteResource();
                compareInput = compareInputMap.get(left.getUrl().toString() + left.getRevision());
                boolean run = compareInput == null;
                if (compareInput == null) {
                    SVNRevision.Number selectedRevision = (SVNRevision.Number) left.getRevision();
                    SVNRevision.Number previousRevision = new SVNRevision.Number(selectedRevision.getNumber() - 1);
                    ISVNRemoteResource right = new RemoteFile(left.getRepository(), left.getUrl(), previousRevision);
                    compareInput = new SVNCompareEditorInput(new ResourceEditionNode(left), new ResourceEditionNode(right));
                    compareInputMap.put(left.getUrl().toString() + left.getRevision(), compareInput);
                }
                setCompareInput(compareInput, run);
                showComparePane(true);
            }
        } catch (Exception e) {
            MessageDialog.openError(getShell(), Messages.MergeWizardRevisionsPage_5, e.getMessage());
        }
    }
}
Also used : LogEntryChangePath(org.tigris.subversion.subclipse.core.history.LogEntryChangePath) ResourceEditionNode(org.tigris.subversion.subclipse.ui.compare.ResourceEditionNode) SVNCompareEditorInput(org.tigris.subversion.subclipse.ui.compare.SVNCompareEditorInput) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) RemoteFile(org.tigris.subversion.subclipse.core.resources.RemoteFile) ISVNRemoteFile(org.tigris.subversion.subclipse.core.ISVNRemoteFile) SVNException(org.tigris.subversion.subclipse.core.SVNException) InvocationTargetException(java.lang.reflect.InvocationTargetException) TeamException(org.eclipse.team.core.TeamException) MalformedURLException(java.net.MalformedURLException)

Example 2 with SVNCompareEditorInput

use of org.tigris.subversion.subclipse.ui.compare.SVNCompareEditorInput in project subclipse by subclipse.

the class MergeWizardUnblockRevisionsPage method compareRevisions.

private void compareRevisions() {
    IStructuredSelection sel = (IStructuredSelection) changePathsViewer.getSelection();
    Object sel0 = sel.getFirstElement();
    if (sel0 instanceof LogEntryChangePath) {
        LogEntryChangePath logEntryChangePath = (LogEntryChangePath) sel0;
        try {
            if (!logEntryChangePath.getRemoteResource().isContainer()) {
                ISVNRemoteResource left = logEntryChangePath.getRemoteResource();
                compareInput = compareInputMap.get(left.getUrl().toString() + left.getRevision());
                boolean run = compareInput == null;
                if (compareInput == null) {
                    SVNRevision.Number selectedRevision = (SVNRevision.Number) left.getRevision();
                    SVNRevision.Number previousRevision = new SVNRevision.Number(selectedRevision.getNumber() - 1);
                    ISVNRemoteResource right = new RemoteFile(left.getRepository(), left.getUrl(), previousRevision);
                    compareInput = new SVNCompareEditorInput(new ResourceEditionNode(left), new ResourceEditionNode(right));
                    compareInputMap.put(left.getUrl().toString() + left.getRevision(), compareInput);
                }
                setCompareInput(compareInput, run);
                showComparePane(true);
            }
        } catch (Exception e) {
            MessageDialog.openError(getShell(), Messages.MergeWizardRevisionsPage_5, e.getMessage());
        }
    }
}
Also used : LogEntryChangePath(org.tigris.subversion.subclipse.core.history.LogEntryChangePath) ResourceEditionNode(org.tigris.subversion.subclipse.ui.compare.ResourceEditionNode) SVNCompareEditorInput(org.tigris.subversion.subclipse.ui.compare.SVNCompareEditorInput) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) RemoteFile(org.tigris.subversion.subclipse.core.resources.RemoteFile) InvocationTargetException(java.lang.reflect.InvocationTargetException) TeamException(org.eclipse.team.core.TeamException)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 TeamException (org.eclipse.team.core.TeamException)2 ISVNRemoteResource (org.tigris.subversion.subclipse.core.ISVNRemoteResource)2 LogEntryChangePath (org.tigris.subversion.subclipse.core.history.LogEntryChangePath)2 RemoteFile (org.tigris.subversion.subclipse.core.resources.RemoteFile)2 ResourceEditionNode (org.tigris.subversion.subclipse.ui.compare.ResourceEditionNode)2 SVNCompareEditorInput (org.tigris.subversion.subclipse.ui.compare.SVNCompareEditorInput)2 SVNRevision (org.tigris.subversion.svnclientadapter.SVNRevision)2 MalformedURLException (java.net.MalformedURLException)1 ISVNRemoteFile (org.tigris.subversion.subclipse.core.ISVNRemoteFile)1 SVNException (org.tigris.subversion.subclipse.core.SVNException)1