示例#1
0
        static void Main()
        {
            if (Environment.GetCommandLineArgs().Length > 1)
            {
                string[] args = Environment.GetCommandLineArgs();
                if (args[1] == "install")
                {
                    // redirect console output to parent process;
                    // must be before any calls to Console.WriteLine()
                    AttachConsole(ATTACH_PARENT_PROCESS);

                    bool silentInstall = args.Length > 2 && args[2] == "silent";

                    string netbeansPath = NetbeansDetector.detectNetbeansPath();
                    if (netbeansPath == null)
                    {
                        if (!silentInstall)
                        {
                            Console.WriteLine("Error, cannot find netbeans");
                        }
                        Application.Exit();
                        return;
                    }

                    string error = NetbeansCallbackInstaller.installHandler(netbeansPath);
                    if (error != null)
                    {
                        if (!silentInstall)
                        {
                            Console.WriteLine("Error installing handler:" + error);
                        }
                    }
                    else
                    {
                        if (!silentInstall)
                        {
                            Console.WriteLine("Handler installed succesfully");
                        }
                    }
                    Application.Exit();
                    return;
                }

                CallbackHandler.processCallback();
                Application.Exit();
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Setup());
        }
 public static string detectNetbeansPath()
 {
     string[] dirsToScan =
     {
         Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
         Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)
     };
     foreach (string dir in dirsToScan)
     {
         string result = NetbeansDetector.detectNetbeansUnder(dir);
         if (result != null)
         {
             return(result);
         }
     }
     return(null);
 }
示例#3
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;
        }