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.0 KB
|
Rev | Line | |
---|
[434] | 1 | package de.ugoe.cs.quest.ui.commands;
|
---|
[235] | 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;
|
---|
[235] | 8 | import de.ugoe.cs.util.console.Command;
|
---|
| 9 |
|
---|
| 10 | /**
|
---|
| 11 | * <p>
|
---|
| 12 | * Command to start a time.
|
---|
| 13 | * </p>
|
---|
| 14 | *
|
---|
| 15 | * @author Steffen Herbold
|
---|
| 16 | * @version 1.0
|
---|
| 17 | */
|
---|
| 18 | public class CMDstartTimer implements Command {
|
---|
| 19 |
|
---|
| 20 | /*
|
---|
| 21 | * (non-Javadoc)
|
---|
| 22 | *
|
---|
| 23 | * @see de.ugoe.cs.util.console.Command#run(java.util.List)
|
---|
| 24 | */
|
---|
| 25 | @Override
|
---|
| 26 | public void run(List<Object> parameters) {
|
---|
| 27 | String timerName;
|
---|
| 28 | try {
|
---|
| 29 | timerName = (String) parameters.get(0);
|
---|
| 30 | } catch (Exception e) {
|
---|
| 31 | throw new InvalidParameterException();
|
---|
| 32 | }
|
---|
| 33 | Long time = System.currentTimeMillis();
|
---|
| 34 | if (GlobalDataContainer.getInstance().addData(timerName, time)) {
|
---|
[240] | 35 | CommandHelpers.dataOverwritten(timerName);
|
---|
[235] | 36 | }
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | /*
|
---|
| 40 | * (non-Javadoc)
|
---|
| 41 | *
|
---|
| 42 | * @see de.ugoe.cs.util.console.Command#help()
|
---|
| 43 | */
|
---|
| 44 | @Override
|
---|
[664] | 45 | public String help() {
|
---|
| 46 | return "startTimer <timerName>";
|
---|
[235] | 47 | }
|
---|
| 48 |
|
---|
| 49 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.