home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 June / CHIPHEFT062001.ISO / browser / nc32lyc / comm.z / java40.jar / netscape / softupdate / WinRegItem.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-08-15  |  3.2 KB  |  107 lines

  1. package netscape.softupdate;
  2.  
  3. import java.text.MessageFormat;
  4.  
  5. final class WinRegItem extends InstallObject {
  6.    private WinReg reg;
  7.    private int rootkey;
  8.    private int command;
  9.    private String subkey;
  10.    private String name;
  11.    private Object value;
  12.  
  13.    WinRegItem(WinReg var1, int var2, int var3, String var4, String var5, Object var6) throws SoftUpdateException {
  14.       super(var1.softUpdate());
  15.       this.reg = var1;
  16.       this.command = var3;
  17.       this.rootkey = var2;
  18.       this.subkey = var4;
  19.       this.name = var5;
  20.       this.value = var6;
  21.    }
  22.  
  23.    protected void Complete() throws SoftUpdateException {
  24.       switch (this.command) {
  25.          case 1:
  26.             this.reg.finalCreateKey(this.rootkey, this.subkey, this.name);
  27.             return;
  28.          case 2:
  29.             this.reg.finalDeleteKey(this.rootkey, this.subkey);
  30.             return;
  31.          case 3:
  32.             this.reg.finalDeleteValue(this.rootkey, this.subkey, this.name);
  33.             return;
  34.          case 4:
  35.             this.reg.finalSetValueString(this.rootkey, this.subkey, this.name, (String)this.value);
  36.             return;
  37.          case 5:
  38.             this.reg.finalSetValue(this.rootkey, this.subkey, this.name, (WinRegValue)this.value);
  39.             return;
  40.          default:
  41.             throw new SoftUpdateException("WinRegItem", -208);
  42.       }
  43.    }
  44.  
  45.    float GetInstallOrder() {
  46.       return 3.0F;
  47.    }
  48.  
  49.    public String toString() {
  50.       switch (this.command) {
  51.          case 1:
  52.             Object[] var5 = new Object[]{this.keystr(this.rootkey, this.subkey, (String)null)};
  53.             return MessageFormat.format(Strings.getString("winreg.addkey"), var5);
  54.          case 2:
  55.             Object[] var4 = new Object[]{this.keystr(this.rootkey, this.subkey, (String)null)};
  56.             return MessageFormat.format(Strings.getString("winreg.delkey"), var4);
  57.          case 3:
  58.             Object[] var3 = new Object[]{this.keystr(this.rootkey, this.subkey, this.name)};
  59.             return MessageFormat.format(Strings.getString("winreg.delval"), var3);
  60.          case 4:
  61.             Object[] var2 = new Object[]{this.keystr(this.rootkey, this.subkey, this.name)};
  62.             return MessageFormat.format(Strings.getString("winreg.storeval"), var2);
  63.          case 5:
  64.             Object[] var1 = new Object[]{this.keystr(this.rootkey, this.subkey, this.name)};
  65.             return MessageFormat.format(Strings.getString("winreg.storeval"), var1);
  66.          default:
  67.             return "?WinReg? " + this.keystr(this.rootkey, this.subkey, this.name);
  68.       }
  69.    }
  70.  
  71.    private String keystr(int var1, String var2, String var3) {
  72.       String var4;
  73.       switch (var1) {
  74.          case Integer.MIN_VALUE:
  75.             var4 = "\\HKEY_CLASSES_ROOT\\";
  76.             break;
  77.          case -2147483647:
  78.             var4 = "\\HKEY_CURRENT_USER\\";
  79.             break;
  80.          case -2147483646:
  81.             var4 = "\\HKEY_LOCAL_MACHINE\\";
  82.             break;
  83.          case -2147483645:
  84.             var4 = "\\HKEY_USERS\\";
  85.             break;
  86.          default:
  87.             var4 = "\\#" + var1 + "\\";
  88.       }
  89.  
  90.       return var3 == null ? var4 + var2 : var4 + var2 + " [" + var3 + "]";
  91.    }
  92.  
  93.    protected void Abort() {
  94.    }
  95.  
  96.    protected void Prepare() throws SoftUpdateException {
  97.    }
  98.  
  99.    protected boolean CanUninstall() {
  100.       return false;
  101.    }
  102.  
  103.    protected boolean RegisterPackageNode() {
  104.       return true;
  105.    }
  106. }
  107.