Exemplo n.º 1
0
  public void put(MessageBundle messageBundle) {
    if (messageBundle != null) {
      TextItem textItem = messageBundle.getTextItem();

      if (!this.languageCode.equals(textItem.getLanguageCode())
          || !this.countryCode.equals(textItem.getCountryCode())) {
        throw new IllegalArgumentException("Language- and/or Country-Code mismatch");
      }

      this.messages.put(messageBundle.getTextKey(), textItem.getContent());
    }
  }
Exemplo n.º 2
0
  @Override
  public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    String name = cmd.getName();
    if (!commandMap.containsKey(name)) {
      // That command doesn't belong to us
      return true;
    }

    SearchResult result = searchCommand(name, args);
    if (result == null || result.container == null) {
      sender.sendMessage(messageBundle.getMessage("message-unknown-command"));
      return true;
    }

    CommandContainer command = result.container;
    int deepness = result.deepness;

    // Cut the args to be suitable to the sub-command-deepness
    String[] cutArgs = new String[args.length - deepness];
    System.arraycopy(args, deepness, cutArgs, 0, args.length - deepness);

    CommandContext context = new CommandContext(cutArgs, command, sender);
    command.execute(
        context, messageBundle, permissionChecker, this.args.toArray(new Object[this.args.size()]));
    return true;
  }
Exemplo n.º 3
0
 public ErrorDialog(Dialog owner, String caption, String message) {
   super(owner, caption, JOptionPane.ERROR_MESSAGE, OK_BUTTON);
   setTitle(MessageBundle.get("dialog.error.title"));
   setCaption(caption);
   setMessage(message);
 }
 protected MessageBundleInvocationHandler(final MessageBundle messageBundle) {
   this(messageBundle != null ? messageBundle.projectCode() : null);
 }