Search in sources :

Example 1 with AbortRebaseCommand

use of org.eclipse.egit.ui.internal.commands.shared.AbortRebaseCommand in project egit by eclipse.

the class StagingView method rebaseAbort.

/**
 * Abort rebase command in progress
 */
protected void rebaseAbort() {
    AbortRebaseCommand abortCommand = new AbortRebaseCommand();
    executeRebaseOperation(abortCommand);
}
Also used : AbortRebaseCommand(org.eclipse.egit.ui.internal.commands.shared.AbortRebaseCommand)

Example 2 with AbortRebaseCommand

use of org.eclipse.egit.ui.internal.commands.shared.AbortRebaseCommand in project egit by eclipse.

the class RebaseResultDialog method buttonPressed.

@Override
protected void buttonPressed(int buttonId) {
    // store the preference to hide these dialogs
    if (toggleButton != null)
        Activator.getDefault().getPreferenceStore().setValue(UIPreferences.SHOW_REBASE_CONFIRM, !toggleButton.getSelection());
    if (buttonId == IDialogConstants.OK_ID) {
        if (result.getStatus() != Status.STOPPED) {
            super.buttonPressed(buttonId);
            return;
        }
        if (startMergeButton.getSelection()) {
            super.buttonPressed(buttonId);
            // open the merge tool
            IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
            for (IProject project : projects) {
                RepositoryMapping mapping = RepositoryMapping.getMapping(project);
                if (mapping != null && mapping.getRepository().equals(repo)) {
                    try {
                        // make sure to refresh before opening the merge
                        // tool
                        project.refreshLocal(IResource.DEPTH_INFINITE, null);
                    } catch (CoreException e) {
                        Activator.handleError(e.getMessage(), e, false);
                    }
                }
            }
            List<IPath> locationList = new ArrayList<>();
            IPath repoWorkdirPath = new Path(repo.getWorkTree().getPath());
            for (String repoPath : conflictPaths) {
                IPath location = repoWorkdirPath.append(repoPath);
                locationList.add(location);
            }
            IPath[] locations = locationList.toArray(new IPath[locationList.size()]);
            int mergeMode = Activator.getDefault().getPreferenceStore().getInt(UIPreferences.MERGE_MODE);
            CompareEditorInput input;
            if (mergeMode == 0) {
                MergeModeDialog dlg = new MergeModeDialog(getParentShell());
                if (dlg.open() != Window.OK)
                    return;
                input = new GitMergeEditorInput(dlg.useWorkspace(), locations);
            } else {
                boolean useWorkspace = mergeMode == 1;
                input = new GitMergeEditorInput(useWorkspace, locations);
            }
            CompareUI.openCompareEditor(input);
            return;
        } else if (skipCommitButton.getSelection()) {
            // skip the rebase
            SkipRebaseCommand skipCommand = new SkipRebaseCommand();
            execute(skipCommand);
        } else if (abortRebaseButton.getSelection()) {
            // abort the rebase
            AbortRebaseCommand abortCommand = new AbortRebaseCommand();
            execute(abortCommand);
        } else if (doNothingButton.getSelection()) {
        // nothing
        }
    }
    super.buttonPressed(buttonId);
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) GitMergeEditorInput(org.eclipse.egit.ui.internal.merge.GitMergeEditorInput) IPath(org.eclipse.core.runtime.IPath) ArrayList(java.util.ArrayList) IProject(org.eclipse.core.resources.IProject) AbortRebaseCommand(org.eclipse.egit.ui.internal.commands.shared.AbortRebaseCommand) CompareEditorInput(org.eclipse.compare.CompareEditorInput) CoreException(org.eclipse.core.runtime.CoreException) RepositoryMapping(org.eclipse.egit.core.project.RepositoryMapping) MergeModeDialog(org.eclipse.egit.ui.internal.merge.MergeModeDialog) SkipRebaseCommand(org.eclipse.egit.ui.internal.commands.shared.SkipRebaseCommand)

Example 3 with AbortRebaseCommand

use of org.eclipse.egit.ui.internal.commands.shared.AbortRebaseCommand in project egit by eclipse.

the class RebaseInteractiveView method createCommandToolBar.

private void createCommandToolBar(Form theForm, FormToolkit toolkit) {
    headComposite = new Composite(theForm.getHead(), SWT.NONE);
    theForm.setHeadClient(headComposite);
    GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).margins(0, 0).applyTo(headComposite);
    ToolBar toolBar = new ToolBar(headComposite, SWT.FLAT);
    GridDataFactory.fillDefaults().grab(false, false).applyTo(toolBar);
    toolkit.adapt(toolBar);
    toolkit.paintBordersFor(toolBar);
    toolBar.setBackground(null);
    startItem = new ToolItem(toolBar, SWT.NONE);
    startItem.setImage(UIIcons.getImage(resources, UIIcons.REBASE_PROCESS_STEPS));
    startItem.addSelectionListener(new RebaseCommandItemSelectionListener(new ProcessStepsRebaseCommand()));
    startItem.setEnabled(false);
    startItem.setText(UIText.InteractiveRebaseView_startItem_text);
    continueItem = new ToolItem(toolBar, SWT.NONE);
    continueItem.setImage(UIIcons.getImage(resources, UIIcons.REBASE_CONTINUE));
    continueItem.addSelectionListener(new RebaseCommandItemSelectionListener(new ContinueRebaseCommand()));
    continueItem.setEnabled(false);
    continueItem.setText(UIText.InteractiveRebaseView_continueItem_text);
    skipItem = new ToolItem(toolBar, SWT.NONE);
    skipItem.setImage(UIIcons.getImage(resources, UIIcons.REBASE_SKIP));
    skipItem.addSelectionListener(new RebaseCommandItemSelectionListener(new SkipRebaseCommand()));
    skipItem.setText(UIText.InteractiveRebaseView_skipItem_text);
    skipItem.setEnabled(false);
    abortItem = new ToolItem(toolBar, SWT.NONE);
    abortItem.setImage(UIIcons.getImage(resources, UIIcons.REBASE_ABORT));
    abortItem.addSelectionListener(new RebaseCommandItemSelectionListener(new AbortRebaseCommand()));
    abortItem.setText(UIText.InteractiveRebaseView_abortItem_text);
    abortItem.setEnabled(false);
    createSeparator(toolBar);
    refreshItem = new ToolItem(toolBar, SWT.NONE);
    refreshItem.setImage(UIIcons.getImage(resources, UIIcons.ELCL16_REFRESH));
    refreshItem.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            refresh();
        }
    });
    refreshItem.setText(UIText.InteractiveRebaseView_refreshItem_text);
    toolBar.pack();
}
Also used : AbortRebaseCommand(org.eclipse.egit.ui.internal.commands.shared.AbortRebaseCommand) Composite(org.eclipse.swt.widgets.Composite) ProcessStepsRebaseCommand(org.eclipse.egit.ui.internal.commands.shared.ProcessStepsRebaseCommand) ContinueRebaseCommand(org.eclipse.egit.ui.internal.commands.shared.ContinueRebaseCommand) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ToolBar(org.eclipse.swt.widgets.ToolBar) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SkipRebaseCommand(org.eclipse.egit.ui.internal.commands.shared.SkipRebaseCommand) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 4 with AbortRebaseCommand

use of org.eclipse.egit.ui.internal.commands.shared.AbortRebaseCommand in project egit by eclipse.

the class RebaseAction method getMenu.

@Override
public Menu getMenu(Control parent) {
    Menu menu = new Menu(parent);
    Repository repo = getRepository();
    boolean rebaseing = isInRebasingState(repo);
    boolean canContinue = rebaseing && canContinue(repo);
    addMenuItem(menu, UIText.RebasePulldownAction_Continue, rebaseContinue, new ContinueRebaseCommand(), canContinue);
    addMenuItem(menu, UIText.RebasePulldownAction_Skip, rebaseSkip, new SkipRebaseCommand(), rebaseing);
    addMenuItem(menu, UIText.RebasePulldownAction_Abort, rebaseAbort, new AbortRebaseCommand(), rebaseing);
    return menu;
}
Also used : AbortRebaseCommand(org.eclipse.egit.ui.internal.commands.shared.AbortRebaseCommand) Repository(org.eclipse.jgit.lib.Repository) ContinueRebaseCommand(org.eclipse.egit.ui.internal.commands.shared.ContinueRebaseCommand) Menu(org.eclipse.swt.widgets.Menu) SkipRebaseCommand(org.eclipse.egit.ui.internal.commands.shared.SkipRebaseCommand)

Aggregations

AbortRebaseCommand (org.eclipse.egit.ui.internal.commands.shared.AbortRebaseCommand)4 SkipRebaseCommand (org.eclipse.egit.ui.internal.commands.shared.SkipRebaseCommand)3 ContinueRebaseCommand (org.eclipse.egit.ui.internal.commands.shared.ContinueRebaseCommand)2 ArrayList (java.util.ArrayList)1 CompareEditorInput (org.eclipse.compare.CompareEditorInput)1 IProject (org.eclipse.core.resources.IProject)1 CoreException (org.eclipse.core.runtime.CoreException)1 IPath (org.eclipse.core.runtime.IPath)1 Path (org.eclipse.core.runtime.Path)1 RepositoryMapping (org.eclipse.egit.core.project.RepositoryMapping)1 ProcessStepsRebaseCommand (org.eclipse.egit.ui.internal.commands.shared.ProcessStepsRebaseCommand)1 GitMergeEditorInput (org.eclipse.egit.ui.internal.merge.GitMergeEditorInput)1 MergeModeDialog (org.eclipse.egit.ui.internal.merge.MergeModeDialog)1 Repository (org.eclipse.jgit.lib.Repository)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Composite (org.eclipse.swt.widgets.Composite)1 Menu (org.eclipse.swt.widgets.Menu)1 ToolBar (org.eclipse.swt.widgets.ToolBar)1 ToolItem (org.eclipse.swt.widgets.ToolItem)1