Crossfire JXClient, Trunk
src
gui
src
main
java
com
realtime
crossfire
jxclient
commands
ClearCommand.java
Go to the documentation of this file.
1
/*
2
* This file is part of JXClient, the Fullscreen Java Crossfire Client.
3
*
4
* JXClient is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
8
*
9
* JXClient is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with JXClient; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
*
18
* Copyright (C) 2005-2008 Yann Chachkoff
19
* Copyright (C) 2006-2017,2019-2023 Andreas Kirschbaum
20
* Copyright (C) 2010-2012,2014-2018,2020-2023 Nicolas Weeger
21
*/
22
23
package
com.realtime.crossfire.jxclient.commands;
24
25
import
com
.
realtime
.
crossfire
.
jxclient
.
gui
.
log
.
Buffer
;
26
import
com
.
realtime
.
crossfire
.
jxclient
.
gui
.
misc
.
JXCWindowRenderer
;
27
import
com
.
realtime
.
crossfire
.
jxclient
.
server
.
crossfire
.
CrossfireServerConnection
;
28
import
org.jetbrains.annotations.NotNull;
29
34
public
class
ClearCommand
extends
AbstractCommand
{
35
39
@NotNull
40
private
final
JXCWindowRenderer
windowRenderer
;
41
47
public
ClearCommand
(@NotNull
final
JXCWindowRenderer
windowRenderer
, @NotNull
final
CrossfireServerConnection
crossfireServerConnection
) {
48
super(
"clear"
,
crossfireServerConnection
);
49
this.windowRenderer =
windowRenderer
;
50
}
51
52
@Override
53
public
boolean
allArguments
() {
54
return
false
;
55
}
56
57
@Override
58
public
void
execute
(@NotNull
final
String args) {
59
if
(!args.isEmpty()) {
60
drawInfoError
(
"The clear command does not take arguments."
);
61
return
;
62
}
63
64
final
Buffer
buffer =
windowRenderer
.
getActiveMessageBuffer
();
65
if
(buffer ==
null
) {
66
drawInfoError
(
"No active text window."
);
67
return
;
68
}
69
70
buffer.
clear
();
71
}
72
73
@NotNull
74
@Override
75
public
String
getHelp
() {
76
//noinspection StringBufferReplaceableByString
77
final
StringBuilder sb =
new
StringBuilder();
78
sb.append(
"Clears the contents of the Messages window.\n"
);
79
sb.append(
"\n"
);
80
sb.append(
"Usage: clear\n"
);
81
sb.append(
"\n"
);
82
sb.append(
"Clear all text messages shown in the Messages window.\n"
);
83
return
sb.toString();
84
}
85
86
}
com.realtime.crossfire.jxclient
com.realtime.crossfire.jxclient.commands.ClearCommand.allArguments
boolean allArguments()
Definition:
ClearCommand.java:53
com.realtime.crossfire.jxclient.server
com.realtime.crossfire.jxclient.gui.log.Buffer.clear
void clear()
Definition:
Buffer.java:176
com.realtime.crossfire.jxclient.gui.log.Buffer
Definition:
Buffer.java:41
com.realtime.crossfire.jxclient.gui.misc.JXCWindowRenderer.getActiveMessageBuffer
Buffer getActiveMessageBuffer()
Definition:
JXCWindowRenderer.java:992
com.realtime.crossfire.jxclient.commands.AbstractCommand.crossfireServerConnection
final CrossfireServerConnection crossfireServerConnection
Definition:
AbstractCommand.java:45
com.realtime.crossfire.jxclient.gui.log
Definition:
Buffer.java:23
com.realtime.crossfire.jxclient.gui.misc.JXCWindowRenderer
Definition:
JXCWindowRenderer.java:87
com.realtime.crossfire.jxclient.commands.ClearCommand.execute
void execute(@NotNull final String args)
Definition:
ClearCommand.java:58
com.realtime.crossfire.jxclient.commands.AbstractCommand.drawInfoError
void drawInfoError(@NotNull final String message)
Definition:
AbstractCommand.java:69
com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection
Definition:
CrossfireServerConnection.java:37
com.realtime.crossfire.jxclient.gui
com.realtime.crossfire.jxclient.server.crossfire
Definition:
AbstractCrossfireServerConnection.java:23
com.realtime.crossfire
com.realtime.crossfire.jxclient.commands.ClearCommand.ClearCommand
ClearCommand(@NotNull final JXCWindowRenderer windowRenderer, @NotNull final CrossfireServerConnection crossfireServerConnection)
Definition:
ClearCommand.java:47
com.realtime
com.realtime.crossfire.jxclient.commands.ClearCommand
Definition:
ClearCommand.java:34
com
com.realtime.crossfire.jxclient.commands.ClearCommand.windowRenderer
final JXCWindowRenderer windowRenderer
Definition:
ClearCommand.java:40
com.realtime.crossfire.jxclient.commands.ClearCommand.getHelp
String getHelp()
Definition:
ClearCommand.java:75
com.realtime.crossfire.jxclient.commands.AbstractCommand
Definition:
AbstractCommand.java:33
com.realtime.crossfire.jxclient.gui.misc
Definition:
GUICheckBox.java:23
Generated by
1.8.17