Search in sources :

Example 1 with SwitchOperation

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

the class SVNHistoryPage method getSwitchAction.

// get switch action (context menu)
private IAction getSwitchAction() {
    if (switchAction == null) {
        switchAction = new Action() {

            public void run() {
                if (selection instanceof IStructuredSelection) {
                    IStructuredSelection ss = (IStructuredSelection) selection;
                    if (ss.size() == 1) {
                        ILogEntry currentSelection = getLogEntry(ss);
                        IResource[] resources = { resource };
                        SvnWizardSwitchPage switchPage = new SvnWizardSwitchPage(resources, currentSelection.getRevision().getNumber());
                        SvnWizard wizard = new SvnWizard(switchPage);
                        SvnWizardDialog dialog = new SvnWizardDialog(getSite().getShell(), wizard);
                        wizard.setParentDialog(dialog);
                        if (dialog.open() == SvnWizardDialog.OK) {
                            SVNUrl[] svnUrls = switchPage.getUrls();
                            SVNRevision svnRevision = switchPage.getRevision();
                            SwitchOperation switchOperation = new SwitchOperation(getSite().getPage().getActivePart(), resources, svnUrls, svnRevision);
                            switchOperation.setDepth(switchPage.getDepth());
                            switchOperation.setSetDepth(switchPage.isSetDepth());
                            switchOperation.setIgnoreExternals(switchPage.isIgnoreExternals());
                            switchOperation.setForce(switchPage.isForce());
                            switchOperation.setIgnoreAncestry(switchPage.isIgnoreAncestry());
                            switchOperation.setConflictResolver(switchPage.getConflictResolver());
                            try {
                                switchOperation.run();
                            } catch (Exception e) {
                                MessageDialog.openError(getSite().getShell(), switchAction.getText(), e.getMessage());
                            }
                        }
                    }
                }
            }
        };
    }
    ISelection selection = getSelection();
    if (selection instanceof IStructuredSelection) {
        IStructuredSelection ss = (IStructuredSelection) selection;
        if (ss.size() == 1) {
            ILogEntry currentSelection = getLogEntry(ss);
            switchAction.setText(Policy.bind("HistoryView.switchToRevision", // $NON-NLS-1$ //$NON-NLS-2$
            "" + currentSelection.getRevision().getNumber()));
        }
    }
    switchAction.setImageDescriptor(SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_MENU_SWITCH));
    return switchAction;
}
Also used : CompareRemoteResourcesAction(org.tigris.subversion.subclipse.ui.actions.CompareRemoteResourcesAction) ExportRemoteFolderAction(org.tigris.subversion.subclipse.ui.actions.ExportRemoteFolderAction) ShowDifferencesAsUnifiedDiffAction(org.tigris.subversion.subclipse.ui.actions.ShowDifferencesAsUnifiedDiffAction) TextViewerAction(org.tigris.subversion.subclipse.ui.console.TextViewerAction) ShowAnnotationAction(org.tigris.subversion.subclipse.ui.actions.ShowAnnotationAction) ShowHistoryAction(org.tigris.subversion.subclipse.ui.actions.ShowHistoryAction) WorkspaceAction(org.tigris.subversion.subclipse.ui.actions.WorkspaceAction) IAction(org.eclipse.jface.action.IAction) OpenRemoteFileAction(org.tigris.subversion.subclipse.ui.actions.OpenRemoteFileAction) GenerateChangeLogAction(org.tigris.subversion.subclipse.ui.actions.GenerateChangeLogAction) Action(org.eclipse.jface.action.Action) ILogEntry(org.tigris.subversion.subclipse.core.history.ILogEntry) SvnWizardDialog(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog) SvnWizard(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizard) ISelection(org.eclipse.jface.viewers.ISelection) SvnWizardSwitchPage(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardSwitchPage) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) CoreException(org.eclipse.core.runtime.CoreException) SVNException(org.tigris.subversion.subclipse.core.SVNException) PartInitException(org.eclipse.ui.PartInitException) InvocationTargetException(java.lang.reflect.InvocationTargetException) TeamException(org.eclipse.team.core.TeamException) ParseException(java.text.ParseException) SwitchOperation(org.tigris.subversion.subclipse.ui.operations.SwitchOperation)

Example 2 with SwitchOperation

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

the class SwitchAction method execute.

protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
    if (action != null && !action.isEnabled()) {
        action.setEnabled(true);
    } else {
        IResource[] resources = getSelectedResources();
        // Use different wizard page name if multiple resources selected so that
        // page size and location will be saved and restored separately for
        // single selection switch and multiple selection switch.
        String pageName;
        if (resources.length > 1)
            pageName = "SwitchDialogWithConflictHandling.multiple";
        else
            // $NON-NLS-1$
            pageName = "SwitchDialogWithConflictHandling";
        SvnWizardSwitchPage switchPage = new SvnWizardSwitchPage(pageName, resources);
        SvnWizard wizard = new SvnWizard(switchPage);
        SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
        wizard.setParentDialog(dialog);
        if (dialog.open() == SvnWizardDialog.OK) {
            SVNUrl[] svnUrls = switchPage.getUrls();
            SVNRevision svnRevision = switchPage.getRevision();
            SwitchOperation switchOperation = new SwitchOperation(getTargetPart(), resources, svnUrls, svnRevision);
            switchOperation.setDepth(switchPage.getDepth());
            switchOperation.setSetDepth(switchPage.isSetDepth());
            switchOperation.setIgnoreExternals(switchPage.isIgnoreExternals());
            switchOperation.setForce(switchPage.isForce());
            switchOperation.setIgnoreAncestry(switchPage.isIgnoreAncestry());
            switchOperation.setCanRunAsJob(canRunAsJob);
            switchOperation.setConflictResolver(switchPage.getConflictResolver());
            switchOperation.run();
        }
    }
}
Also used : SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) SvnWizardDialog(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog) SvnWizard(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizard) SvnWizardSwitchPage(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardSwitchPage) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) IResource(org.eclipse.core.resources.IResource) SwitchOperation(org.tigris.subversion.subclipse.ui.operations.SwitchOperation)

Example 3 with SwitchOperation

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

the class ReplaceWithBranchTagAction method execute.

protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
    IResource[] resources = getSelectedResources();
    ReplaceWithBranchTagWizard wizard = new ReplaceWithBranchTagWizard(resources);
    WizardDialog dialog = new WizardDialog(getShell(), wizard);
    if (dialog.open() == WizardDialog.OK) {
        ReplaceWithBranchTagWizardMainPage mainPage = wizard.getMainPage();
        if (wizard.isReplaceContents()) {
            SVNUrl url = mainPage.getUrl();
            SVNRevision svnRevision = mainPage.getRevision();
            ReplaceWithRemoteOperation replaceOperation = new ReplaceWithRemoteOperation(getTargetPart(), resources[0], url, svnRevision);
            replaceOperation.run();
        } else {
            SvnWizardSwitchPage switchPage = wizard.getSwitchPage();
            SVNUrl[] svnUrls;
            SVNRevision svnRevision;
            if (mainPage == null) {
                svnUrls = switchPage.getUrls();
                svnRevision = switchPage.getRevision();
            } else {
                svnUrls = new SVNUrl[] { mainPage.getUrl() };
                svnRevision = mainPage.getRevision();
            }
            SwitchOperation switchOperation = new SwitchOperation(getTargetPart(), resources, svnUrls, svnRevision);
            switchOperation.setDepth(switchPage.getDepth());
            switchOperation.setSetDepth(switchPage.isSetDepth());
            switchOperation.setIgnoreExternals(switchPage.isIgnoreExternals());
            switchOperation.setForce(switchPage.isForce());
            switchOperation.setIgnoreAncestry(switchPage.isIgnoreAncestry());
            switchOperation.setCanRunAsJob(true);
            switchOperation.setConflictResolver(switchPage.getConflictResolver());
            switchOperation.run();
        }
    }
}
Also used : ReplaceWithBranchTagWizardMainPage(org.tigris.subversion.subclipse.ui.wizards.ReplaceWithBranchTagWizardMainPage) ReplaceWithBranchTagWizard(org.tigris.subversion.subclipse.ui.wizards.ReplaceWithBranchTagWizard) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) SvnWizardSwitchPage(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardSwitchPage) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) WizardDialog(org.eclipse.jface.wizard.WizardDialog) ReplaceWithRemoteOperation(org.tigris.subversion.subclipse.ui.operations.ReplaceWithRemoteOperation) IResource(org.eclipse.core.resources.IResource) SwitchOperation(org.tigris.subversion.subclipse.ui.operations.SwitchOperation)

Aggregations

SwitchOperation (org.tigris.subversion.subclipse.ui.operations.SwitchOperation)3 SvnWizardSwitchPage (org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardSwitchPage)3 SVNRevision (org.tigris.subversion.svnclientadapter.SVNRevision)3 IResource (org.eclipse.core.resources.IResource)2 SvnWizard (org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizard)2 SvnWizardDialog (org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog)2 SVNUrl (org.tigris.subversion.svnclientadapter.SVNUrl)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ParseException (java.text.ParseException)1 CoreException (org.eclipse.core.runtime.CoreException)1 Action (org.eclipse.jface.action.Action)1 IAction (org.eclipse.jface.action.IAction)1 ISelection (org.eclipse.jface.viewers.ISelection)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 TeamException (org.eclipse.team.core.TeamException)1 PartInitException (org.eclipse.ui.PartInitException)1 SVNException (org.tigris.subversion.subclipse.core.SVNException)1 ILogEntry (org.tigris.subversion.subclipse.core.history.ILogEntry)1 CompareRemoteResourcesAction (org.tigris.subversion.subclipse.ui.actions.CompareRemoteResourcesAction)1