Source:
public UiAction.Description getDescription(RevisionResource resource) { PatchSet.Id current = resource.getChange().currentPatchSetId(); String topic = resource.getChange().getTopic(); boolean visible = !resource.getPatchSet().isDraft() && resource.getChange().getStatus().isOpen() && resource.getPatchSet().getId().equals(current) && resource.getControl().canSubmit(); if (!visible) { return new UiAction.Description() .setLabel("") .setTitle("") .setVisible(false); } if (submitWholeTopic && !Strings.isNullOrEmpty(topic)) { List<ChangeData> changesByTopic = null; try { changesByTopic = queryProvider.get().byTopicOpen(topic); } catch (OrmException e) { throw new OrmRuntimeException(e); } Map<String, String> params = ImmutableMap.of( "topicSize", String.valueOf(changesByTopic.size())); String topicProblems = areChangesSubmittable(changesByTopic, resource.getUser()); if (!Strings.isNullOrEmpty(topicProblems)) { return new UiAction.Description() .setLabel(topicProblems) .setTitle(Strings.emptyToNull( submitTopicTooltip.replace(params))) .setVisible(true) .setEnabled(false); } else { return new UiAction.Description() .setLabel(submitTopicLabel) .setTitle(Strings.emptyToNull( submitTopicTooltip.replace(params))) .setVisible(true) .setEnabled(true); } } else { RevId revId = resource.getPatchSet().getRevision(); Map<String, String> params = ImmutableMap.of( "patchSet", String.valueOf(resource.getPatchSet().getPatchSetId()), "branch", resource.getChange().getDest().getShortName(), "commit", ObjectId.fromString(revId.get()).abbreviate(7).name()); return new UiAction.Description() .setLabel(label) .setTitle(Strings.emptyToNull(titlePattern.replace(params))) .setVisible(true); } }

Target:
public UiAction.Description getDescription(RevisionResource resource) { PatchSet.Id current = resource.getChange().currentPatchSetId(); String topic = resource.getChange().getTopic(); boolean visible = !resource.getPatchSet().isDraft() && resource.getChange().getStatus().isOpen() && resource.getPatchSet().getId().equals(current) && resource.getControl().canSubmit(); if (!visible) { return new UiAction.Description() .setLabel("") .setTitle("") .setVisible(false); } if (submitWholeTopic && !Strings.isNullOrEmpty(topic)) { List<ChangeData> changesByTopic = null; try { changesByTopic = queryProvider.get().byTopicOpen(topic); } catch (OrmException e) { throw new OrmRuntimeException(e); } Map<String, String> params = ImmutableMap.of( "topicSize", String.valueOf(changesByTopic.size())); String topicProblems = areChangesSubmittable(changesByTopic, resource.getUser()); if (!Strings.isNullOrEmpty(topicProblems)) { return new UiAction.Description() .setLabel(submitTopicLabel) .setTitle(topicProblems) .setVisible(true) .setEnabled(false); } else { return new UiAction.Description() .setLabel(submitTopicLabel) .setTitle(Strings.emptyToNull( submitTopicTooltip.replace(params))) .setVisible(true) .setEnabled(true); } } else { RevId revId = resource.getPatchSet().getRevision(); Map<String, String> params = ImmutableMap.of( "patchSet", String.valueOf(resource.getPatchSet().getPatchSetId()), "branch", resource.getChange().getDest().getShortName(), "commit", ObjectId.fromString(revId.get()).abbreviate(7).name()); return new UiAction.Description() .setLabel(label) .setTitle(Strings.emptyToNull(titlePattern.replace(params))) .setVisible(true); } }