Exemple #1
0
        private void updateStatus()
        {
            string netbeansPath = this.textBoxNetbeansPath.Text != "" ? this.textBoxNetbeansPath.Text : NetbeansDetector.detectNetbeansPath();

            this.textBoxNetbeansPath.Text = netbeansPath;

            string currentHandler = NetbeansCallbackInstaller.getCurrentHandler();

            this.labelStatus.Text = currentHandler != null ? "installed" : "not installed";

            if (currentHandler != null &&
                currentHandler != NetbeansCallbackInstaller.getValidHandlerValue(netbeansPath))
            {
                this.labelStatus.Text += ", but is different";
            }

            this.buttonInstall.Enabled = true;
        }
        public static string installHandler(string netbeansPath)
        {
            if (!File.Exists(netbeansPath))
            {
                return("Invalid path: " + netbeansPath);
            }
            try
            {
                RegistryKey netbeansMainKey = Registry.ClassesRoot.CreateSubKey("netbeans");
                netbeansMainKey.SetValue("URL Protocol", "URL:Netbeans Protocol");

                RegistryKey netbeansKey = Registry.ClassesRoot.CreateSubKey("netbeans\\shell\\open\\command");
                netbeansKey.SetValue(null, NetbeansCallbackInstaller.getValidHandlerValue(netbeansPath));

                RegistryKey netbeansIconKey = Registry.ClassesRoot.CreateSubKey("netbeans\\DefaultIcon");
                netbeansIconKey.SetValue(null, "\"" + netbeansPath + ",1\"");
            }
            catch (Exception exc)
            {
                return(exc.Message);
            }
            return(null);
        }