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)));
}
}
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());
}
}
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)));
}
}
}
Aggregations