use of org.eclipse.egit.gitflow.ui.internal.dialogs.FinishFeatureDialog in project egit by eclipse.
the class FeatureFinishHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event);
if (gfRepo == null) {
return error(UIText.Handlers_noGitflowRepositoryFound);
}
final String featureBranch;
Repository repo = gfRepo.getRepository();
try {
featureBranch = repo.getBranch();
} catch (IOException e) {
return error(e.getMessage(), e);
}
Shell activeShell = HandlerUtil.getActiveShell(event);
FinishFeatureDialog dialog = new FinishFeatureDialog(activeShell, featureBranch);
if (dialog.open() != Window.OK) {
return null;
}
final boolean squash = dialog.isSquash();
boolean keepBranch = dialog.isKeepBranch();
try {
try {
if (squash && !UIRepositoryUtils.handleUncommittedFiles(repo, activeShell))
return null;
} catch (GitAPIException e) {
Activator.logError(e.getMessage(), e);
return null;
}
final FeatureFinishOperation operation = new FeatureFinishOperation(gfRepo);
operation.setSquash(squash);
operation.setKeepBranch(keepBranch);
JobUtil.scheduleUserWorkspaceJob(operation, UIText.FeatureFinishHandler_finishingFeature, JobFamilies.GITFLOW_FAMILY, new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent jobChangeEvent) {
if (jobChangeEvent.getResult().isOK()) {
postMerge(gfRepo, featureBranch, squash, operation.getMergeResult());
}
}
});
} catch (WrongGitFlowStateException | CoreException | IOException | OperationCanceledException e) {
return error(e.getMessage(), e);
}
return null;
}
Aggregations