Last change
on this file since 664 was
664,
checked in by sherbold, 12 years ago
|
- modified Command.help(): the help now returns a string with its usage instead of writing directly to the console
- modified listCommands: now writes the help string of each command instead of just the name; this way, the parameters are displayed directly
- moved listCommands from quest-ui-core to java-utils
|
-
Property svn:mime-type set to
text/plain
|
File size:
1.2 KB
|
Rev | Line | |
---|
[434] | 1 | package de.ugoe.cs.quest.ui.commands;
|
---|
[245] | 2 |
|
---|
| 3 | import java.security.InvalidParameterException;
|
---|
| 4 | import java.util.List;
|
---|
| 5 |
|
---|
[432] | 6 | import de.ugoe.cs.quest.CommandHelpers;
|
---|
[434] | 7 | import de.ugoe.cs.quest.ui.GlobalDataContainer;
|
---|
[245] | 8 | import de.ugoe.cs.util.console.Command;
|
---|
| 9 | import de.ugoe.cs.util.console.FileOutputListener;
|
---|
| 10 |
|
---|
| 11 | /**
|
---|
| 12 | * <p>
|
---|
| 13 | * Command to start a {@link FileOutputListener}.
|
---|
| 14 | * </p>
|
---|
| 15 | *
|
---|
| 16 | * @author Steffen Herbold
|
---|
| 17 | * @version 1.0
|
---|
| 18 | */
|
---|
| 19 | public class CMDstartFileListener implements Command {
|
---|
| 20 |
|
---|
| 21 | /*
|
---|
| 22 | * (non-Javadoc)
|
---|
| 23 | *
|
---|
| 24 | * @see de.ugoe.cs.util.console.Command#run(java.util.List)
|
---|
| 25 | */
|
---|
| 26 | @Override
|
---|
| 27 | public void run(List<Object> parameters) {
|
---|
| 28 | String filename;
|
---|
| 29 | try {
|
---|
| 30 | filename = (String) parameters.get(0);
|
---|
| 31 | } catch (Exception e) {
|
---|
| 32 | throw new InvalidParameterException();
|
---|
| 33 | }
|
---|
| 34 |
|
---|
| 35 | FileOutputListener listener = new FileOutputListener(filename);
|
---|
| 36 | listener.start();
|
---|
| 37 | if (GlobalDataContainer.getInstance().addData(filename, listener)) {
|
---|
| 38 | CommandHelpers.dataOverwritten(filename);
|
---|
| 39 | }
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | /*
|
---|
| 43 | * (non-Javadoc)
|
---|
| 44 | *
|
---|
| 45 | * @see de.ugoe.cs.util.console.Command#help()
|
---|
| 46 | */
|
---|
| 47 | @Override
|
---|
[664] | 48 | public String help() {
|
---|
| 49 | return "startFileListener <filename>";
|
---|
[245] | 50 | }
|
---|
| 51 |
|
---|
| 52 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.