Filter out core UiCommands from legacy PatchSet view

Don't send any core commands to the legacy patch set view. These are
currently handled in a different API and UI display code, most of
which I am trying to rewrite and delete. Assume for now that there
will be no new interesting core commands while we switch the view.

Change-Id: If129a413d673ac1eb20981f0e25a0c9382e71ff9
This commit is contained in:
Shawn Pearce 2013-07-12 11:03:37 -07:00
parent 9b4b36a458
commit 7e90035c09
2 changed files with 12 additions and 2 deletions

View File

@ -173,10 +173,10 @@ class PatchSetDetailFactory extends Handler<PatchSetDetail> {
} }
} }
detail.setCommands(UiCommands.sorted(UiCommands.from( detail.setCommands(UiCommands.sorted(UiCommands.plugins(UiCommands.from(
revisions, revisions,
new RevisionResource(new ChangeResource(control), patchSet), new RevisionResource(new ChangeResource(control), patchSet),
EnumSet.of(UiCommand.Place.PATCHSET_ACTION_PANEL)))); EnumSet.of(UiCommand.Place.PATCHSET_ACTION_PANEL)))));
return detail; return detail;
} }

View File

@ -60,6 +60,16 @@ public class UiCommands {
return s; return s;
} }
public static Iterable<UiCommandDetail> plugins(Iterable<UiCommandDetail> in) {
return Iterables.filter(in,
new Predicate<UiCommandDetail>() {
@Override
public boolean apply(UiCommandDetail input) {
return input.id.indexOf('~') > 0;
}
});
}
public static <R extends RestResource> Iterable<UiCommandDetail> from( public static <R extends RestResource> Iterable<UiCommandDetail> from(
ChildCollection<?, R> collection, ChildCollection<?, R> collection,
R resource, R resource,