|
@@ -1,80 +0,0 @@
|
1
|
|
-/*
|
2
|
|
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes,
|
3
|
|
- * Simon Mott
|
4
|
|
- *
|
5
|
|
- * Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
|
- * of this software and associated documentation files (the "Software"), to deal
|
7
|
|
- * in the Software without restriction, including without limitation the rights
|
8
|
|
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
|
- * copies of the Software, and to permit persons to whom the Software is
|
10
|
|
- * furnished to do so, subject to the following conditions:
|
11
|
|
- *
|
12
|
|
- * The above copyright notice and this permission notice shall be included in
|
13
|
|
- * all copies or substantial portions of the Software.
|
14
|
|
- *
|
15
|
|
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
|
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
|
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
|
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
|
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
|
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
|
- * SOFTWARE.
|
22
|
|
- */
|
23
|
|
-
|
24
|
|
-package com.dmdirc.commandparser.commands.global;
|
25
|
|
-
|
26
|
|
-import com.dmdirc.FrameContainer;
|
27
|
|
-import com.dmdirc.commandparser.BaseCommandInfo;
|
28
|
|
-import com.dmdirc.commandparser.CommandArguments;
|
29
|
|
-import com.dmdirc.commandparser.CommandInfo;
|
30
|
|
-import com.dmdirc.commandparser.CommandType;
|
31
|
|
-import com.dmdirc.commandparser.commands.Command;
|
32
|
|
-import com.dmdirc.commandparser.commands.IntelligentCommand;
|
33
|
|
-import com.dmdirc.commandparser.commands.context.CommandContext;
|
34
|
|
-import com.dmdirc.ui.input.AdditionalTabTargets;
|
35
|
|
-import com.dmdirc.ui.interfaces.InputWindow;
|
36
|
|
-
|
37
|
|
-/**
|
38
|
|
- * The input command allows you to maniplulate text in a windows inputField.
|
39
|
|
- *
|
40
|
|
- * @since 0.6.4
|
41
|
|
- */
|
42
|
|
-public class Input extends Command implements IntelligentCommand {
|
43
|
|
-
|
44
|
|
- /** A command info object for this command. */
|
45
|
|
- public static final CommandInfo INFO = new BaseCommandInfo("input",
|
46
|
|
- "input [--clear] <text to insert into inputfield> - Adds text to"
|
47
|
|
- + " the active window's input field",
|
48
|
|
- CommandType.TYPE_GLOBAL);
|
49
|
|
-
|
50
|
|
- /** {@inheritDoc} */
|
51
|
|
- @Override
|
52
|
|
- public void execute(final FrameContainer origin,
|
53
|
|
- final CommandArguments args, final CommandContext context) {
|
54
|
|
- if (args.getArguments().length == 0) {
|
55
|
|
- showUsage(origin, args.isSilent(), "input",
|
56
|
|
- "[--clear] <text to insert into inputfield");
|
57
|
|
- return;
|
58
|
|
- } else if (args.getArguments().length == 1
|
59
|
|
- && "--clear".equals(args.getArgumentsAsString(0))) {
|
60
|
|
- ((InputWindow) context.getSource()).getInputHandler()
|
61
|
|
- .clearInputField();
|
62
|
|
- } else {
|
63
|
|
- ((InputWindow) context.getSource()).getInputHandler()
|
64
|
|
- .addToInputField(args.getArgumentsAsString());
|
65
|
|
- }
|
66
|
|
- }
|
67
|
|
-
|
68
|
|
- /** {@inheritDoc} */
|
69
|
|
- @Override
|
70
|
|
- public AdditionalTabTargets getSuggestions(final int arg,
|
71
|
|
- final IntelligentCommandContext context) {
|
72
|
|
- final AdditionalTabTargets res = new AdditionalTabTargets();
|
73
|
|
-
|
74
|
|
- if (arg == 0) {
|
75
|
|
- res.add("--clear");
|
76
|
|
- }
|
77
|
|
- return res;
|
78
|
|
- }
|
79
|
|
-
|
80
|
|
-}
|