@Override public String test(Window parent, Component component, int x, int y, String value) { StringBuilder errors = new StringBuilder(); List<CommandMenuItem> items = CommandMenuItems.parse(value); for (CommandMenuItem item : items) { if (item.getCommand() != null && item.getCommand().hasError()) { errors.append("<p style='font-family:monospaced;'>"); errors.append("Error in command '").append(item.getLabel()).append("': "); errors.append(formatCommandInfo(item.getCommand().getError())); errors.append("</p>"); } } String output = "No errors found."; if (errors.length() > 0) { output = errors.toString(); } GuiUtil.showNonModalMessage(parent, "Custom Commands", output, JOptionPane.INFORMATION_MESSAGE, true); return null; } };
if (item.getCommand() == null) { continue; button.setToolTipText(item.getCommand().toString()); commands.put(button, item.getCommand()); if (item.getCommand() != null && item.getCommand().getCommandName() != null) { String commandName = item.getCommand().getCommandName(); if (commandName.equalsIgnoreCase("modunmod")) { button.setVisible(false);
public JMenuItem addCommandItem(CommandMenuItem item) { if (item.getCommand() == null && item.getLabel() == null) { addSeparator(item.getPos(), item.getParent()); } else if (item.getCommand() == null) { JMenu menu = getSubmenu(item.getLabel(), item.getPos()); addKey(item, menu); } else { commands.put(item.getId(), item.getCommand()); JMenuItem mItem = addItem(item.getId(), item.getLabel(), item.getPos(), item.getParent(), null); addKey(item, mItem); } return null; }
List<CommandMenuItem> items = CommandMenuItems.parse(value); for (CommandMenuItem item : items) { if (item.getCommand() != null && item.getCommand().getError() != null) { String errorDescription = String.format( "<p style='font-family:monospaced;'>%s=Error: %s</p>", item.getLabel(), CommandSettings.formatCommandInfo(item.getCommand().getError())); errorsInfo = StringUtil.append(errorsInfo, "<br />", errorDescription); errorCount++;