Search in sources :

Example 1 with ActionButton

use of com.google.gerrit.client.actions.ActionButton in project gerrit by GerritCodeReview.

the class Actions method reloadRevisionActions.

void reloadRevisionActions(NativeMap<ActionInfo> actions) {
    if (!Gerrit.isSignedIn()) {
        return;
    }
    boolean canSubmit = actions.containsKey("submit");
    if (canSubmit) {
        ActionInfo action = actions.get("submit");
        submit.setTitle(action.title());
        submit.setEnabled(action.enabled());
        submit.setHTML(new SafeHtmlBuilder().openDiv().append(action.label()).closeDiv());
        submit.setEnabled(action.enabled());
    }
    submit.setVisible(canSubmit);
    a2b(actions, "cherrypick", cherrypick);
    a2b(actions, "rebase", rebase);
    // The rebase button on change screen is always enabled.
    // It is the "Rebase" button in the RebaseDialog that might be disabled.
    rebaseParentNotCurrent = rebase.isEnabled();
    if (rebase.isVisible()) {
        rebase.setEnabled(true);
    }
    RevisionInfo revInfo = changeInfo.revision(revision);
    for (String id : filterNonCore(actions)) {
        add(new ActionButton(changeInfo, revInfo, actions.get(id)));
    }
}
Also used : ActionButton(com.google.gerrit.client.actions.ActionButton) RevisionInfo(com.google.gerrit.client.info.ChangeInfo.RevisionInfo) ActionInfo(com.google.gerrit.client.info.ActionInfo) SafeHtmlBuilder(com.google.gwtexpui.safehtml.client.SafeHtmlBuilder)

Example 2 with ActionButton

use of com.google.gerrit.client.actions.ActionButton in project gerrit by GerritCodeReview.

the class ProjectInfoScreen method initProjectActions.

private void initProjectActions(ConfigInfo info) {
    actionsGrid.clear(true);
    actionsGrid.removeAllRows();
    boolean showCreateChange = Gerrit.isSignedIn();
    NativeMap<ActionInfo> actions = info.actions();
    if (actions == null) {
        actions = NativeMap.create().cast();
    }
    if (actions.isEmpty() && !showCreateChange) {
        return;
    }
    actions.copyKeysIntoChildren("id");
    actionsGrid.addHeader(new SmallHeading(AdminConstants.I.headingProjectCommands()));
    FlowPanel actionsPanel = new FlowPanel();
    actionsPanel.setStyleName(Gerrit.RESOURCES.css().projectActions());
    actionsPanel.setVisible(true);
    actionsGrid.add(AdminConstants.I.headingCommands(), actionsPanel);
    for (String id : actions.keySet()) {
        actionsPanel.add(new ActionButton(getProjectKey(), actions.get(id)));
    }
    // HEAD. This would have to happen on the server side.
    if (showCreateChange) {
        actionsPanel.add(createChangeAction());
    }
    if (isOwner && configVisible) {
        actionsPanel.add(createEditConfigAction());
    }
}
Also used : SmallHeading(com.google.gerrit.client.ui.SmallHeading) ActionButton(com.google.gerrit.client.actions.ActionButton) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) ActionInfo(com.google.gerrit.client.info.ActionInfo)

Example 3 with ActionButton

use of com.google.gerrit.client.actions.ActionButton in project gerrit by GerritCodeReview.

the class Actions method initChangeActions.

private void initChangeActions(ChangeInfo info, boolean hasUser) {
    NativeMap<ActionInfo> actions = info.hasActions() ? info.actions() : NativeMap.<ActionInfo>create();
    actions.copyKeysIntoChildren("id");
    if (hasUser) {
        a2b(actions, "abandon", abandon);
        a2b(actions, "/", deleteChange);
        a2b(actions, "restore", restore);
        a2b(actions, "revert", revert);
        a2b(actions, "followup", followUp);
        if (info.isPrivate()) {
            a2b(actions, "private", unmarkPrivate);
        } else {
            a2b(actions, "private", markPrivate);
        }
        for (String id : filterNonCore(actions)) {
            add(new ActionButton(info, actions.get(id)));
        }
    }
}
Also used : ActionButton(com.google.gerrit.client.actions.ActionButton) ActionInfo(com.google.gerrit.client.info.ActionInfo)

Aggregations

ActionButton (com.google.gerrit.client.actions.ActionButton)3 ActionInfo (com.google.gerrit.client.info.ActionInfo)3 RevisionInfo (com.google.gerrit.client.info.ChangeInfo.RevisionInfo)1 SmallHeading (com.google.gerrit.client.ui.SmallHeading)1 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)1 SafeHtmlBuilder (com.google.gwtexpui.safehtml.client.SafeHtmlBuilder)1