[icedtea-web] RFC: extend "itweb-settings reset" to accept "all"

Deepak Bhole dbhole at redhat.com
Mon Feb 28 13:54:40 PST 2011


* Omair Majid <omajid at redhat.com> [2011-02-28 16:32]:
> Hi,
> 
> The attached patch makes "itweb-settings reset all" reset the entire
> configuration.
> 
> Okay to commit?
> 

I think we should have a GUI button for reset all, rather than a
command-line switch. If a GUI button already exists, we don't need a CL
switch.

Cheers,
Deepak

> Cheers,
> Omair

> diff -r 54077eaf4670 netx/net/sourceforge/jnlp/controlpanel/CommandLine.java
> --- a/netx/net/sourceforge/jnlp/controlpanel/CommandLine.java	Mon Feb 28 14:30:39 2011 -0500
> +++ b/netx/net/sourceforge/jnlp/controlpanel/CommandLine.java	Mon Feb 28 16:27:06 2011 -0500
> @@ -244,7 +244,7 @@
>       */
>      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 @@
>  
>          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();




More information about the distro-pkg-dev mailing list