Search in sources :

Example 16 with SVNRevision

use of org.tigris.subversion.svnclientadapter.SVNRevision in project subclipse by subclipse.

the class SVNCompareEditorInput method getLabel.

/**
 * Returns the label for the given input element (which is a ResourceEditionNode).
 */
private String getLabel(ITypedElement element) {
    if (element instanceof ResourceEditionNode) {
        ISVNRemoteResource edition = ((ResourceEditionNode) element).getRemoteResource();
        SVNRevision revision = edition.getLastChangedRevision();
        if (revision == null) {
            revision = edition.getRevision();
        }
        if (edition instanceof ISVNRemoteFile) {
            return Policy.bind("nameAndRevision", edition.getName(), // $NON-NLS-1$
            revision.toString());
        }
        if (edition.isContainer()) {
            // $NON-NLS-1$
            return Policy.bind("SVNCompareEditorInput.inHead", edition.getName());
        } else {
            return Policy.bind("SVNCompareEditorInput.repository", // $NON-NLS-1$
            new Object[] { edition.getName(), revision.toString() });
        }
    }
    return element.getName();
}
Also used : ISVNRemoteFile(org.tigris.subversion.subclipse.core.ISVNRemoteFile) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision)

Example 17 with SVNRevision

use of org.tigris.subversion.svnclientadapter.SVNRevision in project subclipse by subclipse.

the class SVNCompareEditorInput method getVersionLabel.

/**
 * Returns the label for the given input element. (which is a ResourceEditionNode)
 */
private String getVersionLabel(ITypedElement element) {
    if (element instanceof ResourceEditionNode) {
        ISVNRemoteResource edition = ((ResourceEditionNode) element).getRemoteResource();
        SVNRevision revision = edition.getLastChangedRevision();
        if (revision == null) {
            revision = edition.getRevision();
        }
        if (edition.isContainer()) {
            // $NON-NLS-1$
            return Policy.bind("SVNCompareEditorInput.headLabel");
        } else {
            return revision.toString();
        }
    }
    return element.getName();
}
Also used : ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision)

Example 18 with SVNRevision

use of org.tigris.subversion.svnclientadapter.SVNRevision in project subclipse by subclipse.

the class MergeWizardUnblockRevisionsPage method getLogEntries.

private void getLogEntries() {
    entryArray = new ArrayList();
    IRunnableWithProgress runnable = new IRunnableWithProgress() {

        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            try {
                monitor.setTaskName(Messages.MergeWizardUnblockRevisionsPage_retrievingRevisionLogInfo);
                monitor.beginTask(Messages.MergeWizardUnblockRevisionsPage_retrievingRevisionLogInfo, 3);
                if (SVNUIPlugin.getPlugin().getPreferenceStore().getBoolean(ISVNUIConstants.PREF_SHOW_TAGS_IN_REMOTE))
                    tagManager = new AliasManager(remoteResource.getUrl());
                SVNRevision pegRevision = remoteResource.getRevision();
                monitor.worked(1);
                for (int i = 0; i < revisionRanges.length; i++) {
                    rangeEntries = getLogEntries(pegRevision, revisionRanges[i].getFromRevision(), revisionRanges[i].getToRevision(), true, 0, tagManager, true);
                    monitor.worked(1);
                    for (int j = 0; j < rangeEntries.length; j++) {
                        entryArray.add(rangeEntries[j]);
                    }
                }
                entries = new ILogEntry[entryArray.size()];
                entryArray.toArray(entries);
            } catch (Exception e) {
                setErrorMessage(e.getMessage());
                entries = new ILogEntry[0];
            }
            monitor.worked(1);
            monitor.done();
        }
    };
    try {
        getContainer().run(false, false, runnable);
    } catch (Exception e1) {
        Activator.handleError(e1);
    }
    setErrorMessage(standardPage.getErrorMessage());
}
Also used : AliasManager(org.tigris.subversion.subclipse.core.history.AliasManager) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ILogEntry(org.tigris.subversion.subclipse.core.history.ILogEntry) ArrayList(java.util.ArrayList) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) Point(org.eclipse.swt.graphics.Point) InvocationTargetException(java.lang.reflect.InvocationTargetException) TeamException(org.eclipse.team.core.TeamException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Example 19 with SVNRevision

use of org.tigris.subversion.svnclientadapter.SVNRevision in project subclipse by subclipse.

the class UpdateDialogAction method execute.

public void execute(IAction action) throws InterruptedException, InvocationTargetException {
    if (action != null && !action.isEnabled()) {
        action.setEnabled(true);
    } else {
        IResource[] resources = getSelectedResources();
        String pageName;
        if (resources.length > 1)
            // $NON-NLS-1$
            pageName = "UpdateDialogWithConflictHandling.multiple";
        else
            // $NON-NLS-1$
            pageName = "UpdateDialogWithConflictHandling";
        SvnWizardUpdatePage updatePage = new SvnWizardUpdatePage(pageName, resources);
        updatePage.setDefaultRevision(revision);
        updatePage.setDepth(depth);
        updatePage.setSetDepth(setDepth);
        SvnWizard wizard = new SvnWizard(updatePage);
        SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
        wizard.setParentDialog(dialog);
        if (dialog.open() == SvnWizardDialog.OK) {
            SVNRevision svnRevision = updatePage.getRevision();
            UpdateOperation updateOperation = new UpdateOperation(getTargetPart(), resources, svnRevision);
            updateOperation.setDepth(updatePage.getDepth());
            updateOperation.setSetDepth(updatePage.isSetDepth());
            updateOperation.setForce(updatePage.isForce());
            updateOperation.setIgnoreExternals(updatePage.isIgnoreExternals());
            updateOperation.setCanRunAsJob(canRunAsJob);
            updateOperation.setConflictResolver(updatePage.getConflictResolver());
            updateOperation.run();
        }
    }
}
Also used : SvnWizardUpdatePage(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardUpdatePage) UpdateOperation(org.tigris.subversion.subclipse.ui.operations.UpdateOperation) SvnWizardDialog(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog) SvnWizard(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizard) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) IResource(org.eclipse.core.resources.IResource)

Example 20 with SVNRevision

use of org.tigris.subversion.svnclientadapter.SVNRevision in project subclipse by subclipse.

the class ShowDifferencesAsUnifiedDiffActionWC method execute.

protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
    IResource[] resources = getSelectedResources();
    boolean refreshFile = false;
    for (int i = 0; i < resources.length; i++) {
        if (resources[i] instanceof IFile && !resources[i].isSynchronized(Depth.immediates)) {
            if (refreshFile || MessageDialog.openQuestion(getShell(), Policy.bind("DifferencesDialog.compare"), Policy.bind("CompareWithRemoteAction.fileChanged"))) {
                refreshFile = true;
                try {
                    resources[i].refreshLocal(Depth.immediates, new NullProgressMonitor());
                } catch (CoreException e) {
                    throw new InvocationTargetException(e);
                }
            } else {
                break;
            }
        }
    }
    if (resources.length > 1) {
        SvnWizardCompareMultipleResourcesWithBranchTagPage comparePage = new SvnWizardCompareMultipleResourcesWithBranchTagPage(resources);
        SvnWizard wizard = new SvnWizard(comparePage);
        SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
        if (dialog.open() == SvnWizardDialog.OK) {
            ISVNLocalResource[] localResources = new ISVNLocalResource[resources.length];
            for (int i = 0; i < resources.length; i++) {
                localResources[i] = SVNWorkspaceRoot.getSVNResourceFor(resources[i]);
            }
            try {
                SVNLocalBranchTagCompareInput compareInput = new SVNLocalBranchTagCompareInput(localResources, comparePage.getUrls(), comparePage.getRevision(), getTargetPart());
                CompareUI.openCompareEditorOnPage(compareInput, getTargetPage());
            } catch (SVNException e) {
                MessageDialog.openError(getShell(), Policy.bind("ShowDifferencesAsUnifiedDiffDialog.branchTag"), e.getMessage());
            }
        }
        return;
    }
    ShowDifferencesAsUnifiedDiffDialogWC dialog = new ShowDifferencesAsUnifiedDiffDialogWC(getShell(), resources[0], getTargetPart());
    if (dialog.open() == ShowDifferencesAsUnifiedDiffDialogWC.OK) {
        try {
            if (dialog.isDiffToOutputFile())
                dialog.getOperation().run();
            if (!dialog.isDiffToOutputFile()) {
                SVNRevision pegRevision = dialog.getPegRevision();
                if (pegRevision == null) {
                    pegRevision = SVNRevision.HEAD;
                }
                if (resources[0] instanceof IContainer) {
                    ISVNRemoteFolder remoteFolder = new RemoteFolder(dialog.getSvnResource().getRepository(), dialog.getToUrl(), dialog.getToRevision());
                    ((RemoteFolder) remoteFolder).setPegRevision(pegRevision);
                    SVNLocalCompareInput compareInput = new SVNLocalCompareInput(dialog.getSvnResource(), remoteFolder, pegRevision);
                    compareInput.setDiffOperation(dialog.getOperation());
                    CompareUI.openCompareEditorOnPage(compareInput, getTargetPage());
                } else {
                    ISVNRemoteFile remoteFile = new RemoteFile(dialog.getSvnResource().getRepository(), dialog.getToUrl(), dialog.getToRevision());
                    ((RemoteFile) remoteFile).setPegRevision(pegRevision);
                    SVNLocalCompareInput compareInput = new SVNLocalCompareInput(dialog.getSvnResource(), remoteFile, pegRevision);
                    CompareUI.openCompareEditorOnPage(compareInput, getTargetPage());
                }
            }
        } catch (SVNException e) {
            MessageDialog.openError(getShell(), Policy.bind("ShowDifferencesAsUnifiedDiffDialog.branchTag"), e.getMessage());
        }
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) SVNLocalCompareInput(org.tigris.subversion.subclipse.ui.compare.SVNLocalCompareInput) IFile(org.eclipse.core.resources.IFile) RemoteFolder(org.tigris.subversion.subclipse.core.resources.RemoteFolder) ISVNRemoteFolder(org.tigris.subversion.subclipse.core.ISVNRemoteFolder) SvnWizardDialog(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog) SvnWizard(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizard) ShowDifferencesAsUnifiedDiffDialogWC(org.tigris.subversion.subclipse.ui.dialogs.ShowDifferencesAsUnifiedDiffDialogWC) SVNException(org.tigris.subversion.subclipse.core.SVNException) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) ISVNRemoteFolder(org.tigris.subversion.subclipse.core.ISVNRemoteFolder) InvocationTargetException(java.lang.reflect.InvocationTargetException) SVNLocalBranchTagCompareInput(org.tigris.subversion.subclipse.ui.compare.SVNLocalBranchTagCompareInput) CoreException(org.eclipse.core.runtime.CoreException) ISVNRemoteFile(org.tigris.subversion.subclipse.core.ISVNRemoteFile) SvnWizardCompareMultipleResourcesWithBranchTagPage(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardCompareMultipleResourcesWithBranchTagPage) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) IContainer(org.eclipse.core.resources.IContainer) IResource(org.eclipse.core.resources.IResource) ISVNRemoteFile(org.tigris.subversion.subclipse.core.ISVNRemoteFile) RemoteFile(org.tigris.subversion.subclipse.core.resources.RemoteFile)

Aggregations

SVNRevision (org.tigris.subversion.svnclientadapter.SVNRevision)48 SVNUrl (org.tigris.subversion.svnclientadapter.SVNUrl)22 ISVNClientAdapter (org.tigris.subversion.svnclientadapter.ISVNClientAdapter)17 IResource (org.eclipse.core.resources.IResource)15 TeamException (org.eclipse.team.core.TeamException)15 SVNException (org.tigris.subversion.subclipse.core.SVNException)14 InvocationTargetException (java.lang.reflect.InvocationTargetException)12 ISVNRemoteResource (org.tigris.subversion.subclipse.core.ISVNRemoteResource)12 File (java.io.File)9 CoreException (org.eclipse.core.runtime.CoreException)9 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)9 ISVNLocalResource (org.tigris.subversion.subclipse.core.ISVNLocalResource)9 ArrayList (java.util.ArrayList)8 ISelection (org.eclipse.jface.viewers.ISelection)8 ILogEntry (org.tigris.subversion.subclipse.core.history.ILogEntry)8 PartInitException (org.eclipse.ui.PartInitException)7 ISVNRepositoryLocation (org.tigris.subversion.subclipse.core.ISVNRepositoryLocation)7 RemoteFile (org.tigris.subversion.subclipse.core.resources.RemoteFile)7 ParseException (java.text.ParseException)6 Action (org.eclipse.jface.action.Action)6