Search in sources :

Example 1 with ResetTargetSelectionDialog

use of org.eclipse.egit.ui.internal.dialogs.ResetTargetSelectionDialog in project egit by eclipse.

the class ResetActionHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    final Repository repository = getRepository(true, event);
    if (repository == null)
        return null;
    if (!repository.getRepositoryState().canResetHead()) {
        MessageDialog.openError(getShell(event), UIText.ResetAction_errorResettingHead, NLS.bind(UIText.ResetAction_repositoryState, repository.getRepositoryState().getDescription()));
        return null;
    }
    ResetTargetSelectionDialog branchSelectionDialog = new ResetTargetSelectionDialog(getShell(event), repository);
    if (branchSelectionDialog.open() == IDialogConstants.OK_ID) {
        final String refName = branchSelectionDialog.getRefName();
        final ResetType type = branchSelectionDialog.getResetType();
        String jobname = NLS.bind(UIText.ResetAction_reset, refName);
        final ResetOperation operation = new ResetOperation(repository, refName, type);
        JobUtil.scheduleUserWorkspaceJob(operation, jobname, JobFamilies.RESET);
    }
    return null;
}
Also used : ResetOperation(org.eclipse.egit.core.op.ResetOperation) Repository(org.eclipse.jgit.lib.Repository) ResetTargetSelectionDialog(org.eclipse.egit.ui.internal.dialogs.ResetTargetSelectionDialog) ResetType(org.eclipse.jgit.api.ResetCommand.ResetType)

Aggregations

ResetOperation (org.eclipse.egit.core.op.ResetOperation)1 ResetTargetSelectionDialog (org.eclipse.egit.ui.internal.dialogs.ResetTargetSelectionDialog)1 ResetType (org.eclipse.jgit.api.ResetCommand.ResetType)1 Repository (org.eclipse.jgit.lib.Repository)1