コード例 #1
0
ファイル: Setup.cs プロジェクト: feo-cz/netbeans-link-open
        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;
        }
コード例 #2
0
        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);
        }