00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 package com.realtime.crossfire.jxclient.gui.textinput;
00023
00024 import com.realtime.crossfire.jxclient.gui.commandlist.GUICommand;
00025 import com.realtime.crossfire.jxclient.gui.commandlist.GUICommand2;
00026 import com.realtime.crossfire.jxclient.settings.Macros;
00027 import org.jetbrains.annotations.NotNull;
00028
00033 public class ActivateCommandInputCommand implements GUICommand2 {
00034
00038 @NotNull
00039 private final CommandCallback commandCallback;
00040
00044 @NotNull
00045 private final String commandText;
00046
00050 @NotNull
00051 private final Macros macros;
00052
00059 public ActivateCommandInputCommand(@NotNull final String commandText, @NotNull final CommandCallback commandCallback, @NotNull final Macros macros) {
00060 this.commandText = commandText;
00061 this.commandCallback = commandCallback;
00062 this.macros = macros;
00063 }
00064
00068 @Override
00069 public boolean canExecute() {
00070 return true;
00071 }
00072
00076 @Override
00077 public void execute() {
00078 commandCallback.activateCommandInput(macros.expandMacros(commandText));
00079 }
00080
00084 @NotNull
00085 @Override
00086 public String getCommandString() {
00087 return commandText.length() > 0 ? "-e "+commandText : "-e";
00088 }
00089
00090 }