aboutsummaryrefslogtreecommitdiffstats
path: root/netx
diff options
context:
space:
mode:
authorOmair Majid <[email protected]>2011-02-28 17:29:31 -0500
committerOmair Majid <[email protected]>2011-02-28 17:29:31 -0500
commitb20853d58e1a9c593bce6dea7718c2924143054c (patch)
tree139e7ac38ee2bb568f4a39bb501ab13b4de673c8 /netx
parent786236c12331acd61c4e8d6ba4d94b277911187a (diff)
Handle 'reset all' as an itweb-settings command
2011-02-28 Omair Majid <[email protected]> * netx/net/sourceforge/jnlp/controlpanel/CommandLine.java (printResetHelp): Indicate that "all" is a valid argument. (handleResetCommand): Deal with "all" instead of a property name by reseting all properties.
Diffstat (limited to 'netx')
-rw-r--r--netx/net/sourceforge/jnlp/controlpanel/CommandLine.java20
1 files changed, 16 insertions, 4 deletions
diff --git a/netx/net/sourceforge/jnlp/controlpanel/CommandLine.java b/netx/net/sourceforge/jnlp/controlpanel/CommandLine.java
index 0e4f1d0..8eb5fb7 100644
--- a/netx/net/sourceforge/jnlp/controlpanel/CommandLine.java
+++ b/netx/net/sourceforge/jnlp/controlpanel/CommandLine.java
@@ -244,7 +244,7 @@ public class CommandLine {
*/
public void printResetHelp() {
System.out.println(R("Usage"));
- System.out.println(" " + PROGRAM_NAME + " reset property-name");
+ System.out.println(" " + PROGRAM_NAME + " reset [all|property-name]");
System.out.println(R("CLResetDescription"));
}
@@ -268,14 +268,26 @@ public class CommandLine {
String key = args.get(0);
+ boolean resetAll = false;
+ if (key.equals("all")) {
+ resetAll = true;
+ }
+
Map<String, Setting<String>> all = config.getRaw();
- if (!all.containsKey(key)) {
+ if (!resetAll && !all.containsKey(key)) {
System.out.println(R("CLUnknownProperty", key));
return ERROR;
}
- Setting<String> setting = all.get(key);
- setting.setValue(setting.getDefaultValue());
+ if (resetAll) {
+ for (String aKey: all.keySet()) {
+ Setting<String> setting = all.get(aKey);
+ setting.setValue(setting.getDefaultValue());
+ }
+ } else {
+ Setting<String> setting = all.get(key);
+ setting.setValue(setting.getDefaultValue());
+ }
try {
config.save();