Search in sources :

Example 1 with ReleaseStartFromCommitHandler

use of org.eclipse.egit.gitflow.ui.internal.actions.ReleaseStartFromCommitHandler in project egit by eclipse.

the class DynamicHistoryMenu method fill.

@Override
public void fill(Menu menu, int index) {
    GitFlowRepository gfRepo = getRepository();
    if (gfRepo == null) {
        return;
    }
    RevCommit selectedCommit = getSelectedCommit();
    if (selectedCommit == null) {
        return;
    }
    String startCommitSha1 = selectedCommit.getName();
    Shell activeShell = getActiveShell();
    ReleaseStartFromCommitHandler listener = new ReleaseStartFromCommitHandler(gfRepo, startCommitSha1, activeShell);
    MenuItem menuItem = new MenuItem(menu, SWT.PUSH, index);
    menuItem.setText(NLS.bind(UIText.DynamicHistoryMenu_startGitflowReleaseFrom, abbreviate(selectedCommit)));
    menuItem.addSelectionListener(listener);
    boolean isEnabled = false;
    try {
        isEnabled = gfRepo.isOnDevelop(selectedCommit);
    } catch (IOException e) {
        Activator.getDefault().getLog().log(error(e.getMessage(), e));
    }
    menuItem.setEnabled(isEnabled);
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ReleaseStartFromCommitHandler(org.eclipse.egit.gitflow.ui.internal.actions.ReleaseStartFromCommitHandler) MenuItem(org.eclipse.swt.widgets.MenuItem) IOException(java.io.IOException) GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) RevCommit(org.eclipse.jgit.revwalk.RevCommit)

Aggregations

IOException (java.io.IOException)1 GitFlowRepository (org.eclipse.egit.gitflow.GitFlowRepository)1 ReleaseStartFromCommitHandler (org.eclipse.egit.gitflow.ui.internal.actions.ReleaseStartFromCommitHandler)1 RevCommit (org.eclipse.jgit.revwalk.RevCommit)1 MenuItem (org.eclipse.swt.widgets.MenuItem)1 Shell (org.eclipse.swt.widgets.Shell)1