Ejemplo n.º 1
0
        public void OnInit()
        {
            _mainForm.AddAction("Buld", async() => await Build(_pluginModuleManager.GetSelectedPlugins()));

            var openToolStripMenuItem = new ToolStripMenuItem
            {
                Name = "openToolStripMenuItem",
                Size = new Size(100, 22),
                Text = "Open"
            };

            openToolStripMenuItem.Click += OpenToolStripMenuItemClick;

            _mainForm.fileToolStripMenuItem.DropDownItems.Add(openToolStripMenuItem);

            var lastOpenedFile = GetLastOpenedFile();

            if (lastOpenedFile != null)
            {
                OpenPomFile(lastOpenedFile.FullName);
            }

            var addPluginMenuItem = new ToolStripMenuItem
            {
                //Name = "addPluginMenuItem",
                Size = new Size(100, 22),
                Text = "Add Plugin"
            };

            addPluginMenuItem.Click += AddPluginMenuItemClick;

            _mainForm.fileToolStripMenuItem.DropDownItems.Add(addPluginMenuItem);

            var removePluginItem = new ToolStripMenuItem
            {
                Text = "Remove Plugin"
            };

            removePluginItem.Click += RemovePlugin;

            _mainForm.contextMenu.Items.Add(removePluginItem);
        }
Ejemplo n.º 2
0
        private string GetSelectedPluginPath()
        {
            var selectedPlugins = _plugins.GetSelectedPlugins();

            if (selectedPlugins.Any())
            {
                var plugin = selectedPlugins.First();
                return(plugin.PomPath);
            }

            return(null);
        }
Ejemplo n.º 3
0
        public void OnInit()
        {
            _pluginModuleManager.PluginsUpdated += (plugin) => FetchPluginModuleJiraState(plugin);

            _mainForm.AddAction("Do", BuildAndRestart);

            _mainForm.AddAction("Enable", EnablePlugins);
            _mainForm.AddAction("Disable", DisablePlugins);
            _mainForm.AddAction("Redeploy", BuildAndRedeploy);

            _mainForm.AddAction("Startup", async() =>
            {
                await _controller.Startup();
            });

            _mainForm.AddAction("Shutdown", async() =>
            {
                await _controller.Shutdown();
            });
            _mainForm.AddAction("Kill", async() =>
            {
                await _controller.Kill();
            });

            _mainForm.AddAction("Restart", async() =>
            {
                await _controller.Kill();
                await _controller.Startup();
            });

            _mainForm.AddAction("Logs", async() =>
            {
                await _controller.OpenLogsDir();
            });

            _mainForm.AddAction("Copy", () =>
            {
                CopyPluginsToJira(_pluginModuleManager.GetSelectedPlugins());
            });

            _mainForm.AddAction("Update", () =>
            {
                FetchPluginModuleJiraState(_pluginModuleManager.Plugins);
            });

            var servers = _config.GetProperties <JObject>("servers");

            if (servers != null)
            {
                var deployRemote = new ToolStripMenuItem
                {
                    Text = "Deploy to remote"
                };
                _mainForm.contextMenu.Items.Add(deployRemote);

                var serversMenu = new ToolStripMenuItem
                {
                    Text = "Copy and restart",
                    Name = "remoteServersMenu"
                };

                _mainForm.menuStrip1.Items.Add(serversMenu);

                foreach (var entry in servers)
                {
                    var remoteServer = entry.ToObject <RemoteServerEntry>();

                    var remoteServerReloadItem = new ToolStripMenuItem
                    {
                        Text = remoteServer.Title
                    };
                    remoteServerReloadItem.Click += (s, e) =>
                    {
                        var serverController = new JiraRemoteServerController(_logger, _utils, remoteServer);

                        BuildAndRestartRemoteServer(serverController);
                    };

                    serversMenu.DropDownItems.Add(remoteServerReloadItem);

                    var server = remoteServer.Title;

                    _logger.Log("Register remote server: " + server);

                    var openItem = new ToolStripMenuItem
                    {
                        Text = server
                    };

                    openItem.Click += (o, e) =>
                    {
                        var manager = new JiraManager(new JiraRestApiHelper(
                                                          server,
                                                          _config.GetProperty <string>("jira.user.key"),
                                                          _config.GetProperty <string>("jira.user.password")
                                                          ));

                        BuildAndRedeploy(manager);
                    };

                    deployRemote.DropDownItems.Add(openItem);
                }
            }


            FetchPluginModuleJiraState(_pluginModuleManager.Plugins);
        }