22 package com.realtime.crossfire.jxclient.gui.textinput;
28 import java.util.regex.Pattern;
29 import org.jetbrains.annotations.NotNull;
98 if (commandString.equals(
"-e")) {
101 if (commandString.startsWith(
"-e ")) {
114 public String
encode(@NotNull
final String command) {
115 return PATTERN_ENCODE.matcher(command).matches() ? command+
TRAILING_ESCAPE : command;
125 public String
decode(@NotNull
final String command) {
126 return command.endsWith(TRAILING_ESCAPE) ? command.substring(0, command.length()-TRAILING_ESCAPE.length()) : command;
static final Pattern PATTERN_ENCODE
Pattern matching lines that need a TRAILING_ESCAPE appended.
Utility class for string manipulation.
String decode(@NotNull final String command)
Decodes a key binding if necessary.
String encode(@NotNull final String command)
Encodes a key binding if necessary.
A GUICommand which executes a Crossfire command.
Manages macro expansion in command strings.
final CommandExecutor commandExecutor
The CommandExecutor instance to use.
static final String TRAILING_ESCAPE
Character appended to lines ending with whitespace.
GUICommand createCommandDecode(@NotNull final String encodedCommandString)
Creates a new GUICommand instance from string representation.
Interface that defines callback functions needed by commands.
final CommandCallback commandCallback
The CommandCallback to use.
Factory for creating GUICommand instances from string representation.
Factory for creating GUICommand instances from string representation.
GUICommandFactoryImpl(@NotNull final CommandCallback commandCallback, @NotNull final CommandExecutor commandExecutor, @NotNull final Macros macros)
Creates a new instance.
GUICommand createCommand(@NotNull final String commandString)
Creates a new GUICommand instance from string representation.
final Macros macros
The Macros instance to use.
static String trimLeading(@NotNull final CharSequence str)
Removes leading whitespace from a string.
A GUICommand which activates the command input field.