Search in sources :

Example 1 with StashCreateUI

use of org.eclipse.egit.ui.internal.stash.StashCreateUI in project egit by eclipse.

the class StashesMenu method createStashChangesItem.

private static IContributionItem createStashChangesItem(final Repository repository) {
    Action action = new Action(UIText.StashesMenu_StashChangesActionText) {

        @Override
        public void run() {
            StashCreateUI stashCreateUI = new StashCreateUI(repository);
            Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
            stashCreateUI.createStash(shell);
        }

        @Override
        public boolean isEnabled() {
            return StashCreateHandler.isEnabled(repository);
        }
    };
    return new ActionContributionItem(action);
}
Also used : Action(org.eclipse.jface.action.Action) Shell(org.eclipse.swt.widgets.Shell) ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) StashCreateUI(org.eclipse.egit.ui.internal.stash.StashCreateUI)

Example 2 with StashCreateUI

use of org.eclipse.egit.ui.internal.stash.StashCreateUI in project egit by eclipse.

the class CleanupUncomittedChangesDialog method buttonPressed.

@Override
protected void buttonPressed(int buttonId) {
    switch(buttonId) {
        case IDialogConstants.PROCEED_ID:
            CommitUI commitUI = new CommitUI(getShell(), repository, new IResource[0], true);
            shouldContinue = commitUI.commit();
            break;
        case IDialogConstants.ABORT_ID:
            final ResetOperation operation = new ResetOperation(repository, Constants.HEAD, ResetType.HARD);
            String jobname = NLS.bind(UIText.ResetAction_reset, Constants.HEAD);
            JobUtil.scheduleUserWorkspaceJob(operation, jobname, JobFamilies.RESET);
            shouldContinue = true;
            break;
        case IDialogConstants.SKIP_ID:
            StashCreateUI stashCreateUI = new StashCreateUI(repository);
            shouldContinue = stashCreateUI.createStash(getShell());
            break;
        case IDialogConstants.CANCEL_ID:
        default:
            break;
    }
    super.buttonPressed(buttonId);
}
Also used : ResetOperation(org.eclipse.egit.core.op.ResetOperation) StashCreateUI(org.eclipse.egit.ui.internal.stash.StashCreateUI) CommitUI(org.eclipse.egit.ui.internal.commit.CommitUI)

Example 3 with StashCreateUI

use of org.eclipse.egit.ui.internal.stash.StashCreateUI in project egit by eclipse.

the class StashCreateHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    Repository repository = getRepository();
    if (repository == null)
        return null;
    StashCreateUI stashCreateUI = new StashCreateUI(repository);
    stashCreateUI.createStash(getShell(event));
    return null;
}
Also used : Repository(org.eclipse.jgit.lib.Repository) StashCreateUI(org.eclipse.egit.ui.internal.stash.StashCreateUI)

Aggregations

StashCreateUI (org.eclipse.egit.ui.internal.stash.StashCreateUI)3 ResetOperation (org.eclipse.egit.core.op.ResetOperation)1 CommitUI (org.eclipse.egit.ui.internal.commit.CommitUI)1 Action (org.eclipse.jface.action.Action)1 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)1 Repository (org.eclipse.jgit.lib.Repository)1 Shell (org.eclipse.swt.widgets.Shell)1