Search in sources :

Example 1 with InitDialog

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

the class InitHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    Shell activeShell = HandlerUtil.getActiveShell(event);
    final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event);
    if (gfRepo == null) {
        return null;
    }
    Repository repository = gfRepo.getRepository();
    if (!gfRepo.hasBranches()) {
        boolean createMaster = openQuestion(activeShell, UIText.InitHandler_emptyRepository, UIText.InitHandler_doYouWantToInitNow);
        if (!createMaster) {
            return null;
        }
        createInitialCommit(repository);
    }
    InitDialog dialog = new InitDialog(activeShell, gfRepo, getBranches(repository));
    if (dialog.open() != Window.OK) {
        return null;
    }
    InitOperation initOperation = new InitOperation(repository, dialog.getResult());
    JobUtil.scheduleUserWorkspaceJob(initOperation, UIText.InitHandler_initializing, JobFamilies.GITFLOW_FAMILY);
    return null;
}
Also used : Shell(org.eclipse.swt.widgets.Shell) GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) Repository(org.eclipse.jgit.lib.Repository) InitOperation(org.eclipse.egit.gitflow.op.InitOperation) GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) InitDialog(org.eclipse.egit.gitflow.ui.internal.dialogs.InitDialog)

Aggregations

GitFlowRepository (org.eclipse.egit.gitflow.GitFlowRepository)1 InitOperation (org.eclipse.egit.gitflow.op.InitOperation)1 InitDialog (org.eclipse.egit.gitflow.ui.internal.dialogs.InitDialog)1 Repository (org.eclipse.jgit.lib.Repository)1 Shell (org.eclipse.swt.widgets.Shell)1