}
pathName = pathName + treePath.getPathComponent(i);
}
final String filterName = mLocalizer.msg("pluginFilter.name", "Plugin filter ({0})", pathName);
Action action = new AbstractAction(){
public void actionPerformed(ActionEvent e) {
Program[] programs = collectProgramsFromNode(node);
final ArrayList<Program> programList = new ArrayList<Program>();
if (programs != null) {
for (Program program : programs) {
programList.add(program);
}
if (programs.length > 0) {
ProgramFilter pluginFilter = new ProgramFilter() {
public boolean accept(Program prog) {
return programList.contains(prog);
}
public String getName() {
return filterName;
}
};
MainFrame.getInstance().setProgramFilter(pluginFilter);
}
else {
JOptionPane
.showMessageDialog(
UiUtilities.getBestDialogParent(MainFrame.getInstance()),
mLocalizer
.msg(
"pluginFilter.noPrograms",
"The plugin has marked no program, therefore your current filter will remain active."),
mLocalizer.msg("pluginFilter.noProgramsTitle",
"No programs marked"), JOptionPane.INFORMATION_MESSAGE);
}
}
}
};
action.putValue(Action.NAME, mLocalizer.msg("filter","Show only contained programs"));
JMenuItem item = new JMenuItem(action);
item.setFont(MenuUtil.CONTEXT_MENU_PLAINFONT);
item.setIcon(TVBrowserIcons.filter(TVBrowserIcons.SIZE_SMALL));
return item;