for (int i = 0; i < max; i++) {
final ExporterIf export = activeExporter[i];
AbstractAction action = null;
StringBuilder name = new StringBuilder();
final PluginTreeNode node = getNodeForExporter(export);
if(node.contains(program)) {
action = new AbstractAction() {
public void actionPerformed(ActionEvent e) {
node.removeProgram(program);
getRootNode().update();
if(getRootNode().contains(program,true)) {
program.mark(CalendarExportPlugin.getInstance());
}
}
};
name.append(mLocalizer.msg("contextMenuDeleteText","Remove marking for "));
action.putValue(Action.SMALL_ICON, TVBrowserIcons.delete(TVBrowserIcons.SIZE_SMALL));
}
else {
action = new AbstractAction() {
public void actionPerformed(ActionEvent evt) {
new Thread(new Runnable() {
public void run() {
Program[] programArr = {program};
if (export.exportPrograms(programArr, mSettings, mConfigs[0])) {
markProgram(program, export);
getRootNode().update();
}
}
}, "Export to calendar").start();
}
};
if (max == 1) {
name.append(mLocalizer.msg("contextMenuText", "Export to")).append(' ');
}
action.putValue(Action.SMALL_ICON, getExporterIcon(export));
}
name.append(activeExporter[i].getName());
action.putValue(Action.NAME, name.toString());
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());
}