actions[i] = action;
}
if (actions.length == 1) {
return new ActionMenu(actions[0]);
}
return new ActionMenu(menuLabel, menuIcon, actions);
} else {
ActionMenu[] exporters = new ActionMenu[activeExporter.length];
for (int i = 0; i < exporters.length; i++) {
Action[] actions = new Action[mConfigs.length];
for (int j = 0; j < actions.length; j++) {
final ExporterIf export = activeExporter[i];
final int count = j;
final PluginTreeNode node = getNodeForExporter(export);
if(node.contains(program)) {
actions[j] = new AbstractAction() {
public void actionPerformed(ActionEvent e) {
node.removeProgram(program);
getRootNode().update();
if(getRootNode().contains(program,true)) {
program.mark(CalendarExportPlugin.getInstance());
}
}
};
actions[j].putValue(Action.NAME, new StringBuilder(mLocalizer.msg("contextMenuDeleteText","Remove marking for ")).append(mConfigs[j].getName()).toString());
actions[j].putValue(Action.SMALL_ICON, TVBrowserIcons.delete(TVBrowserIcons.SIZE_SMALL));
}
else {
actions[j] = new AbstractAction() {
public void actionPerformed(final ActionEvent e) {
new Thread(new Runnable() {
public void run() {
Program[] programArr = {program};
if (export.exportPrograms(programArr, mSettings, mConfigs[count])) {
markProgram(program, export);
getRootNode().update();
}
}
}, "Export to calendar").start();
}
};
actions[j].putValue(Action.NAME, mConfigs[j].getName());
}
}
exporters[i] = new ActionMenu(activeExporter[i].getName(), menuIcon, actions);
}
return new ActionMenu(menuLabel, menuIcon, exporters);
}
}