Codota Logo
CommandMenuItems
Code IndexAdd Codota to your IDE (free)

How to use
CommandMenuItems
in
chatty.gui.components.menus

Best Java code snippets using chatty.gui.components.menus.CommandMenuItems (Showing top 14 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Gson g =
  • Codota Iconnew Gson()
  • Codota IconGsonBuilder gsonBuilder;gsonBuilder.create()
  • Codota Iconnew GsonBuilder().create()
  • Smart code suggestions by Codota
}
origin: chatty/chatty

public static void setCommands(MenuType type, String data) {
  List<CommandMenuItem> parsed = parse(data);
  commands.put(type, parsed);
}

origin: chatty/chatty

public static List<CommandMenuItem> parse(String input) {
  List<CommandMenuItem> result = new LinkedList<>();
  if (input == null || input.isEmpty()) {
    return result;
  }
  String[] lines = input.split("\n");
  String submenuName = null;
  for (String line : lines) {
    CommandMenuItem submenu;
    CommandMenuItem separator;
    CommandMenuItem item;
    if ((submenu = parseSubmenu(line)) != null) {
      submenuName = submenu.getLabel();
      result.add(submenu);
    }
    else if ((separator = parseSeparator(line, submenuName)) != null) {
      result.add(separator);
    }
    else if ((item = parseCommand(line, submenuName)) != null) {
      result.add(item);
    }
    else {
      result.addAll(addCustomCommands(line, submenuName));
    }
  }
  return result;
}

origin: chatty/chatty

  String number = matcher.group(2);
  String factor = matcher.group(3);
  item = createTimeoutItem(number, factor, submenu, pos, key);
} else {
  String command = matcher.group(4);
  item = createItem(command, submenu, pos, key);
  result.add(makeItem(null, null, submenu, -1, null));
  sep = false;
origin: chatty/chatty

private static CommandMenuItem createTimeoutItem(String number, String factor, String subMenu, int pos, String key) {
  int time = Integer.parseInt(number);
  String label;
  if (!factor.isEmpty()) {
    time *= getFactor(factor);
    label = number + factor;
  } else {
    label = timeFormat(time);
  }
  String command = "/timeout $1 "+time+" $2-";
  return makeItem(label, command, subMenu, pos, key);
}
origin: chatty/chatty

public ChannelContextMenu(ContextMenuListener listener) {
  this.listener = listener;
  
  addItem("channelInfo", Language.getString("menubar.dialog.channelInfo"));
  addItem("channelAdmin", Language.getString("menubar.dialog.channelAdmin"));
  addSeparator();
  ContextMenuHelper.addStreamsOptions(this, 1, false);
  addSeparator();
  
  addItem("hostchannel", Language.getString("channelCm.hostChannel"), MISC_MENU);
  addSeparator(MISC_MENU);
  addItem("joinHostedChannel", Language.getString("channelCm.joinHosted"), MISC_MENU);
  addItem("copy", Language.getString("channelCm.copyStreamname"), MISC_MENU);
  addSeparator(MISC_MENU);
  addItem("chatRules", Language.getString("channelCm.dialog.chatRules"), MISC_MENU);
  addSeparator(MISC_MENU);
  addItem("follow", Language.getString("channelCm.follow"), MISC_MENU);
  addItem("unfollow", Language.getString("channelCm.unfollow"), MISC_MENU);
  addSeparator(MISC_MENU);
  addItem("srcOpen", Language.getString("channelCm.speedruncom"), MISC_MENU);
  
  addSeparator();
  addItem("closeChannel", Language.getString("channelCm.closeChannel"));
  
  CommandMenuItems.addCommands(CommandMenuItems.MenuType.CHANNEL, this);
}
origin: chatty/chatty

private static CommandMenuItem createItem(String command, String subMenu, int pos, String key) {
  String label = Helper.replaceUnderscoreWithSpace(command);
  return makeItem(label, "/"+command+" $1-", subMenu, pos, key);
}

origin: chatty/chatty

  m.addItem("unfollow", Language.getString("channelCm.unfollow"), miscSubmenu);
CommandMenuItems.addCommands(CommandMenuItems.MenuType.STREAMS, m);
origin: chatty/chatty

private static CommandMenuItem parseCommand(String line, String currentSubmenu) {
  Matcher m = PATTERN.matcher(line);
  if (!m.matches()) {
    return null;
  }
  
  String label = m.group(1).trim();
  int pos = m.group(2) == null ? -1 : Integer.parseInt(m.group(2));
  String key = m.group(3);
  String command = m.group(4).trim();
  //System.out.println("'"+label+"' '"+key+"' '"+command+"'");
  
  if (!label.startsWith(".")) {
    currentSubmenu = null;
  } else {
    label = label.substring(1).trim();
  }
  return makeItem(label, command, currentSubmenu, pos, key);
}

origin: chatty/chatty

public static void main(String[] args) {
  List<CommandMenuItem> items = parse("/slap\n"
      + "[Joshimuz]\n"
      + " FAQ=FAQ: http://blahblah\n"
      + "Message=/openUrl http://twitch.tv/inbox/compose?target=$$1");
  for (CommandMenuItem item : items) {
    System.out.println(item);
  }
  System.out.println(true || false && false);
}

origin: chatty/chatty

CommandMenuItems.addCommands(CommandMenuItems.MenuType.USER, this);
origin: chatty/chatty

  @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;
  }
};
origin: chatty/chatty

  noKeyLabels = true;
List<CommandMenuItem> items = CommandMenuItems.parse(setting);
for (CommandMenuItem item : items) {
  if (item.getCommand() == null) {
origin: chatty/chatty

@Test
public void testParse() {
  assertEquals(CommandMenuItems.parse(null), new ArrayList<>());
  assertEquals(CommandMenuItems.parse(""), new ArrayList<>());
  expected1.add(new CommandMenuItem("Uptime", CustomCommand.parse("Stream Uptime: $(streamuptime)"), null, -1, null));
  assertEquals(CommandMenuItems.parse(input1), expected1);
origin: chatty/chatty

addItem("", "(I hope you enjoy my abusing of a popup menu as an info list.)", readme);
int errorCount = 0;
List<CommandMenuItem> items = CommandMenuItems.parse(value);
for (CommandMenuItem item : items) {
  if (item.getCommand() != null && item.getCommand().getError() != null) {
chatty.gui.components.menusCommandMenuItems

Most used methods

  • parse
  • addCommands
  • addCustomCommands
  • createItem
  • createTimeoutItem
  • getFactor
  • makeItem
  • parseCommand
  • parseSeparator
  • parseSubmenu
  • setCommands
  • timeFormat
  • setCommands,
  • timeFormat

Popular in Java

  • Finding current android device location
  • setRequestProperty (URLConnection)
  • requestLocationUpdates (LocationManager)
  • addToBackStack (FragmentTransaction)
  • BufferedReader (java.io)
    Reads text from a character-input stream, buffering characters so as to provide for the efficient re
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • JFileChooser (javax.swing)
  • Option (scala)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now