Search in sources :

Example 1 with ClosableWizardDialog

use of org.tigris.subversion.subclipse.ui.wizards.ClosableWizardDialog in project subclipse by subclipse.

the class BranchTagAction method run.

public void run() {
    BranchTagWizard wizard;
    final IResource resource = ((RevisionGraphEditorInput) editor.getEditorInput()).getResource();
    ISVNRemoteResource remoteResource = ((RevisionGraphEditorInput) editor.getEditorInput()).getRemoteResource();
    if (resource == null) {
        ISVNRemoteResource[] resources = { remoteResource };
        wizard = new BranchTagWizard(resources);
    } else {
        IResource[] resources = { resource };
        wizard = new BranchTagWizard(resources);
    }
    wizard.setRevisionNumber(node.getRevision());
    WizardDialog dialog = new ClosableWizardDialog(Display.getDefault().getActiveShell(), wizard);
    if (dialog.open() == WizardDialog.OK) {
        final SVNUrl sourceUrl = wizard.getUrl();
        final SVNUrl destinationUrl = wizard.getToUrl();
        final String message = wizard.getComment();
        final SVNRevision revision = wizard.getRevision();
        final boolean makeParents = wizard.isMakeParents();
        final SVNUrl[] sourceUrls = wizard.getUrls();
        final boolean createOnServer = wizard.isCreateOnServer();
        final Alias newAlias = wizard.getNewAlias();
        final boolean switchAfter = wizard.isSwitchAfterBranchTag();
        try {
            BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {

                public void run() {
                    ISVNClientAdapter client = null;
                    try {
                        if (resource == null) {
                            client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
                            client.copy(sourceUrl, destinationUrl, message, revision, makeParents);
                        } else {
                            IResource[] resources = { resource };
                            BranchTagOperation branchTagOperation = new BranchTagOperation(editor.getEditorSite().getPart(), resources, sourceUrls, destinationUrl, createOnServer, revision, message);
                            branchTagOperation.setMakeParents(makeParents);
                            branchTagOperation.setNewAlias(newAlias);
                            branchTagOperation.switchAfterTagBranchOperation(switchAfter);
                            branchTagOperation.run();
                        }
                    } catch (Exception e) {
                        MessageDialog.openError(Display.getDefault().getActiveShell(), Policy.bind("HistoryView.createTagFromRevision"), e.getMessage());
                    } finally {
                        SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
                    }
                }
            });
        } catch (Exception e) {
            MessageDialog.openError(Display.getDefault().getActiveShell(), Policy.bind("HistoryView.createTagFromRevision"), e.getMessage());
        }
    }
}
Also used : SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) RevisionGraphEditorInput(org.tigris.subversion.subclipse.graph.editors.RevisionGraphEditorInput) BranchTagWizard(org.tigris.subversion.subclipse.ui.wizards.BranchTagWizard) Alias(org.tigris.subversion.subclipse.core.history.Alias) BranchTagOperation(org.tigris.subversion.subclipse.ui.operations.BranchTagOperation) ClosableWizardDialog(org.tigris.subversion.subclipse.ui.wizards.ClosableWizardDialog) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) ClosableWizardDialog(org.tigris.subversion.subclipse.ui.wizards.ClosableWizardDialog) WizardDialog(org.eclipse.jface.wizard.WizardDialog) IResource(org.eclipse.core.resources.IResource) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 2 with ClosableWizardDialog

use of org.tigris.subversion.subclipse.ui.wizards.ClosableWizardDialog in project subclipse by subclipse.

the class MergeFileAssociationPreferencePage method addFileType.

private void addFileType() {
    NewMergeFileAssociationWizard wizard = new NewMergeFileAssociationWizard(mergeFileAssociations);
    WizardDialog dialog = new ClosableWizardDialog(Display.getCurrent().getActiveShell(), wizard);
    if (dialog.open() == WizardDialog.CANCEL)
        return;
    associationsUpdated = true;
    ArrayList associationsList = new ArrayList();
    for (int i = 0; i < mergeFileAssociations.length; i++) associationsList.add(mergeFileAssociations[i]);
    associationsList.add(wizard.getMergeFileAssociation());
    mergeFileAssociations = new MergeFileAssociation[associationsList.size()];
    associationsList.toArray(mergeFileAssociations);
    Arrays.sort(mergeFileAssociations);
    viewer.refresh();
}
Also used : ArrayList(java.util.ArrayList) ClosableWizardDialog(org.tigris.subversion.subclipse.ui.wizards.ClosableWizardDialog) WizardDialog(org.eclipse.jface.wizard.WizardDialog) ClosableWizardDialog(org.tigris.subversion.subclipse.ui.wizards.ClosableWizardDialog)

Example 3 with ClosableWizardDialog

use of org.tigris.subversion.subclipse.ui.wizards.ClosableWizardDialog in project subclipse by subclipse.

the class CheckoutAsAction method execute.

/*
   * @see IActionDelegate#run(IAction)
   */
public void execute(IAction action) throws InvocationTargetException, InterruptedException {
    if (!WorkspacePathValidator.validateWorkspacePath())
        return;
    final ISVNRemoteFolder[] folders = getSelectedRemoteFolders();
    CheckoutWizard wizard = new CheckoutWizard(folders);
    WizardDialog dialog = new ClosableWizardDialog(shell, wizard);
    dialog.open();
}
Also used : ClosableWizardDialog(org.tigris.subversion.subclipse.ui.wizards.ClosableWizardDialog) ISVNRemoteFolder(org.tigris.subversion.subclipse.core.ISVNRemoteFolder) WizardDialog(org.eclipse.jface.wizard.WizardDialog) ClosableWizardDialog(org.tigris.subversion.subclipse.ui.wizards.ClosableWizardDialog) CheckoutWizard(org.tigris.subversion.subclipse.ui.wizards.CheckoutWizard)

Example 4 with ClosableWizardDialog

use of org.tigris.subversion.subclipse.ui.wizards.ClosableWizardDialog in project subclipse by subclipse.

the class NewRepositoryAction method run.

/**
 * @see IActionDelegate#run(IAction)
 */
public void run(IAction action) {
    if (!WorkspacePathValidator.validateWorkspacePath())
        return;
    NewLocationWizard wizard = new NewLocationWizard();
    WizardDialog dialog = new ClosableWizardDialog(shell, wizard);
    dialog.open();
}
Also used : ClosableWizardDialog(org.tigris.subversion.subclipse.ui.wizards.ClosableWizardDialog) NewLocationWizard(org.tigris.subversion.subclipse.ui.wizards.NewLocationWizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog) ClosableWizardDialog(org.tigris.subversion.subclipse.ui.wizards.ClosableWizardDialog)

Example 5 with ClosableWizardDialog

use of org.tigris.subversion.subclipse.ui.wizards.ClosableWizardDialog in project subclipse by subclipse.

the class RepositoriesView method contributeActions.

/**
 * Contribute actions to the view
 */
protected void contributeActions() {
    final Shell shell = getShell();
    // Create actions
    // New Repository (popup)
    newAction = new Action(// $NON-NLS-1$
    Policy.bind("RepositoriesView.new"), SVNUIPlugin.getPlugin().getImageDescriptor(// $NON-NLS-1$
    ISVNUIConstants.IMG_NEWLOCATION)) {

        public void run() {
            if (!WorkspacePathValidator.validateWorkspacePath())
                return;
            NewLocationWizard wizard = new NewLocationWizard();
            WizardDialog dialog = new ClosableWizardDialog(shell, wizard);
            dialog.open();
        }
    };
    PlatformUI.getWorkbench().getHelpSystem().setHelp(newAction, IHelpContextIds.NEW_REPOSITORY_LOCATION_ACTION);
    // Properties
    propertiesAction = new PropertyDialogAction(new SameShellProvider(shell), getViewer());
    getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.PROPERTIES.getId(), propertiesAction);
    IStructuredSelection selection = (IStructuredSelection) getViewer().getSelection();
    if (selection.size() == 1 && selection.getFirstElement() instanceof ISVNRepositoryLocation) {
        propertiesAction.setEnabled(true);
    } else {
        propertiesAction.setEnabled(false);
    }
    getViewer().addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection ss = (IStructuredSelection) event.getSelection();
            boolean enabled = ss.size() == 1 && ss.getFirstElement() instanceof ISVNRepositoryLocation;
            propertiesAction.setEnabled(enabled);
        }
    });
    // Remove Root
    removeRootAction = new RemoveRootAction(treeViewer.getControl().getShell());
    removeRootAction.selectionChanged((IStructuredSelection) null);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(removeRootAction, IHelpContextIds.REMOVE_REPOSITORY_LOCATION_ACTION);
    IActionBars bars = getViewSite().getActionBars();
    bars.setGlobalActionHandler(ActionFactory.DELETE.getId(), removeRootAction);
    // Refresh action (toolbar)
    SVNUIPlugin plugin = SVNUIPlugin.getPlugin();
    refreshAction = new Action(Policy.bind("RepositoriesView.refresh"), SVNUIPlugin.getPlugin().getImageDescriptor(// $NON-NLS-1$
    ISVNUIConstants.IMG_REFRESH_ENABLED)) {

        public void run() {
            refreshViewer(null, true);
        }
    };
    // $NON-NLS-1$
    refreshAction.setToolTipText(Policy.bind("RepositoriesView.refreshTooltip"));
    refreshAction.setDisabledImageDescriptor(plugin.getImageDescriptor(ISVNUIConstants.IMG_REFRESH_DISABLED));
    refreshAction.setHoverImageDescriptor(plugin.getImageDescriptor(ISVNUIConstants.IMG_REFRESH));
    getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.REFRESH.getId(), refreshAction);
    refreshPopupAction = new Action(Policy.bind("RepositoriesView.refreshPopup"), SVNUIPlugin.getPlugin().getImageDescriptor(// $NON-NLS-1$
    ISVNUIConstants.IMG_REFRESH)) {

        public void run() {
            refreshViewerNode();
        }
    };
    // Collapse action
    collapseAllAction = new Action(Policy.bind("RepositoriesView.collapseAll"), SVNUIPlugin.getPlugin().getImageDescriptor(// $NON-NLS-1$
    ISVNUIConstants.IMG_COLLAPSE_ALL_ENABLED)) {

        public void run() {
            collapseAll();
        }
    };
    collapseAllAction.setToolTipText(// $NON-NLS-1$
    Policy.bind("RepositoriesView.collapseAllTooltip"));
    collapseAllAction.setHoverImageDescriptor(plugin.getImageDescriptor(ISVNUIConstants.IMG_COLLAPSE_ALL));
    // Create the popup menu
    MenuManager menuMgr = new MenuManager();
    Tree tree = treeViewer.getTree();
    Menu menu = menuMgr.createContextMenu(tree);
    menuMgr.addMenuListener(new IMenuListener() {

        public void menuAboutToShow(IMenuManager manager) {
            addWorkbenchActions(manager);
        }
    });
    menuMgr.setRemoveAllWhenShown(true);
    tree.setMenu(menu);
    getSite().registerContextMenu(menuMgr, treeViewer);
    // Create the local tool bar
    IToolBarManager tbm = bars.getToolBarManager();
    drillPart.addNavigationActions(tbm);
    tbm.add(refreshAction);
    tbm.add(new Separator());
    tbm.add(collapseAllAction);
    tbm.update(false);
    // Create the open action for double clicks
    openAction = new OpenRemoteFileAction();
    bars.updateActionBars();
    IActionBars actionBars = getViewSite().getActionBars();
    IMenuManager actionBarsMenu = actionBars.getMenuManager();
    Action newRepositoryAction = new // $NON-NLS-1$
    Action(// $NON-NLS-1$
    Policy.bind("RepositoriesView.newRepository")) {

        public void run() {
            SvnWizardNewRepositoryPage newRepositoryPage = new SvnWizardNewRepositoryPage();
            SvnWizard wizard = new SvnWizard(newRepositoryPage);
            SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
            if (dialog.open() == SvnWizardDialog.OK)
                refreshViewer(null, false);
        }
    };
    actionBarsMenu.add(newRepositoryAction);
}
Also used : OpenRemoteFileAction(org.tigris.subversion.subclipse.ui.actions.OpenRemoteFileAction) PropertyDialogAction(org.eclipse.ui.dialogs.PropertyDialogAction) SVNAction(org.tigris.subversion.subclipse.ui.actions.SVNAction) Action(org.eclipse.jface.action.Action) SvnWizardDialog(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog) SvnWizard(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizard) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) NewLocationWizard(org.tigris.subversion.subclipse.ui.wizards.NewLocationWizard) PropertyDialogAction(org.eclipse.ui.dialogs.PropertyDialogAction) Shell(org.eclipse.swt.widgets.Shell) ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) Tree(org.eclipse.swt.widgets.Tree) OpenRemoteFileAction(org.tigris.subversion.subclipse.ui.actions.OpenRemoteFileAction) SvnWizardNewRepositoryPage(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardNewRepositoryPage) ClosableWizardDialog(org.tigris.subversion.subclipse.ui.wizards.ClosableWizardDialog) Menu(org.eclipse.swt.widgets.Menu) IActionBars(org.eclipse.ui.IActionBars) SameShellProvider(org.eclipse.jface.window.SameShellProvider) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) IMenuListener(org.eclipse.jface.action.IMenuListener) SVNUIPlugin(org.tigris.subversion.subclipse.ui.SVNUIPlugin) IToolBarManager(org.eclipse.jface.action.IToolBarManager) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) WizardDialog(org.eclipse.jface.wizard.WizardDialog) ClosableWizardDialog(org.tigris.subversion.subclipse.ui.wizards.ClosableWizardDialog) SvnWizardDialog(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog) Separator(org.eclipse.jface.action.Separator)

Aggregations

WizardDialog (org.eclipse.jface.wizard.WizardDialog)11 ClosableWizardDialog (org.tigris.subversion.subclipse.ui.wizards.ClosableWizardDialog)11 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 BranchTagWizard (org.tigris.subversion.subclipse.ui.wizards.BranchTagWizard)3 SvnWizardDialog (org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog)3 ISVNClientAdapter (org.tigris.subversion.svnclientadapter.ISVNClientAdapter)3 SVNRevision (org.tigris.subversion.svnclientadapter.SVNRevision)3 SVNUrl (org.tigris.subversion.svnclientadapter.SVNUrl)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 ParseException (java.text.ParseException)2 IWorkspaceRunnable (org.eclipse.core.resources.IWorkspaceRunnable)2 CoreException (org.eclipse.core.runtime.CoreException)2 Action (org.eclipse.jface.action.Action)2 ISelection (org.eclipse.jface.viewers.ISelection)2 TeamException (org.eclipse.team.core.TeamException)2 PartInitException (org.eclipse.ui.PartInitException)2 ISVNRemoteFolder (org.tigris.subversion.subclipse.core.ISVNRemoteFolder)2 ISVNRemoteResource (org.tigris.subversion.subclipse.core.ISVNRemoteResource)2 ISVNRepositoryLocation (org.tigris.subversion.subclipse.core.ISVNRepositoryLocation)2 SVNException (org.tigris.subversion.subclipse.core.SVNException)2