コード例 #1
0
        protected override void DoWork()
        {
            this.WorkingDirectory            = VSSolutionUtils.GetSolutionPath(this.ApplicationObject.Solution);
            ApplicationObject.StatusBar.Text = "AndroMDA: Generation Progress";
            try
            {
                base.DoWork();
            }
            catch (System.ComponentModel.Win32Exception we)
            {
                if (we.Message == "The system cannot find the file specified")
                {
                    throw new MavenProxyKnownException("Error: The java executable could not be found to run maven.\nError: Please check your java installation and ensure that the JAVA_HOME variable is set correctly\n");
                }
                else
                {
                    throw;
                }
            }

            VSExternalToolEventArgs args = this.EventArguments as VSExternalToolEventArgs;

            if (args.ExitCode != 0)
            {
                args.ExitStatus = ToolExitStatus.Error;
            }
        }
コード例 #2
0
        void m_mavenProxy_Completed(object sender, EventArgs e)
        {
            VSExternalToolEventArgs args = e as VSExternalToolEventArgs;
            bool restartBuild            = m_restartBuild;

            RestartBuild = false;
            switch (args.ExitStatus)
            {
            case VSExternalToolProxy.ToolExitStatus.Success:
                MavenLastRunDateTime = DateTime.Now;
                m_applicationObject.StatusBar.Text = "AndroMDA: Generation successful.";
                m_applicationObject.StatusBar.Highlight(false);
                RefreshGeneratedFiles();
                if (restartBuild)
                {
                    m_applicationObject.ExecuteCommand("Build.BuildSolution", string.Empty);
                }
                break;

            case VSExternalToolProxy.ToolExitStatus.Error:
                m_applicationObject.StatusBar.Text = "AndroMDA: Generation failed";
                if (m_mavenProxy.Status == MavenProxy.MavenStatus.UnsatisfiedDependency &&
                    (m_addInSettings.MavenUseOfflineMode || (m_addInSettings.MavenUseCustomCommandLine && m_addInSettings.MavenCustomCommandLine.ToLower().Contains("-o")))
                    )
                {
                    if (System.Windows.Forms.MessageBox.Show("It appears that AndroMDA is missing one or more packages it needs to run.  Would you like to download the missing files?", "AndroMDA Generate Failed", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question, System.Windows.Forms.MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
                    {
                        // Rerun maven without the -o option
                        RunMaven(true);
                    }
                }
                break;
            }
        }
コード例 #3
0
        protected override void AfterExecution()
        {
            VSExternalToolEventArgs args = (VSExternalToolEventArgs)this.EventArguments;

            foreach (string line in OutputLines)
            {
                if (line.Contains("does not exist or no valid version could be found") ||
                    line.Contains("required artifacts are missing") ||
                    line.Contains("required artifact is missing") ||
                    line.Contains("not found in repository") ||
                    line.Contains("Failed to resolve artifact"))
                {
                    m_mavenStatus = MavenStatus.UnsatisfiedDependency;
                }
                if (args.ExitStatus != ToolExitStatus.Error && line.Contains("[ERROR]"))
                {
                    args.ExitStatus = ToolExitStatus.Error;
                }
            }
        }
コード例 #4
0
        protected override void DoWork()
        {
            using (Process toolProcess = new Process())
            {
                // Set up process info.
                System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo();
                m_psi.FileName               = m_executablePath;
                m_psi.Arguments              = m_commandLine;
                m_psi.WorkingDirectory       = m_workingDirectory;
                m_psi.CreateNoWindow         = true;
                m_psi.UseShellExecute        = false;
                m_psi.RedirectStandardOutput = true;
                m_psi.RedirectStandardError  = true;

                toolProcess.EnableRaisingEvents = true;
                toolProcess.ErrorDataReceived  += new DataReceivedEventHandler(toolProcess_ErrorDataReceived);
                toolProcess.OutputDataReceived += new DataReceivedEventHandler(toolProcess_OutputDataReceived);

                // Associate process info with the process.
                toolProcess.StartInfo = m_psi;

                VSExternalToolEventArgs eventArguments = new VSExternalToolEventArgs();
                this.EventArguments = eventArguments;

                if (!toolProcess.Start())
                {
                    throw new Exception("External tool failed to start");
                }

                toolProcess.BeginOutputReadLine();
                toolProcess.BeginErrorReadLine();

                try
                {
                    m_applicationObject.MainWindow.SetFocus();

                    while (!toolProcess.WaitForExit(250) && !CancelRequested)
                    {
                    }


                    if (!CancelRequested)
                    {
                        eventArguments.ExitCode   = toolProcess.ExitCode;
                        eventArguments.ExitStatus = ToolExitStatus.Success;
                    }
                    else
                    {
                        toolProcess.Kill();
                        eventArguments.ExitStatus = ToolExitStatus.Canceled;
                        AcknowledgeCancel();
                    }
                }
                catch (Exception e)
                {
                    if (toolProcess != null && !toolProcess.HasExited)
                    {
                        toolProcess.Kill();
                    }
                    eventArguments.ExitStatus = ToolExitStatus.Error;
                    throw (e);
                }
                finally
                {
                    if (toolProcess != null)
                    {
                        toolProcess.Close();
                    }
                }
            }
        }
コード例 #5
0
        protected override void DoWork()
        {
            using (Process toolProcess = new Process())
            {
                // Set up process info.
                System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo();
                m_psi.FileName = m_executablePath;
                m_psi.Arguments = m_commandLine;
                m_psi.WorkingDirectory = m_workingDirectory;
                m_psi.CreateNoWindow = true;
                m_psi.UseShellExecute = false;
                m_psi.RedirectStandardOutput = true;
                m_psi.RedirectStandardError = true;

                toolProcess.EnableRaisingEvents = true;
                toolProcess.ErrorDataReceived += new DataReceivedEventHandler(toolProcess_ErrorDataReceived);
                toolProcess.OutputDataReceived += new DataReceivedEventHandler(toolProcess_OutputDataReceived);

                // Associate process info with the process.
                toolProcess.StartInfo = m_psi;

                VSExternalToolEventArgs eventArguments = new VSExternalToolEventArgs();
                this.EventArguments = eventArguments;

                if (!toolProcess.Start())
                {
                    throw new Exception("External tool failed to start");
                }

                toolProcess.BeginOutputReadLine();
                toolProcess.BeginErrorReadLine();

                try
                {
                    m_applicationObject.MainWindow.SetFocus();

                    while (!toolProcess.WaitForExit(250) && !CancelRequested)
                    {
                    }

                    if (!CancelRequested)
                    {
                        eventArguments.ExitCode = toolProcess.ExitCode;
                        eventArguments.ExitStatus = ToolExitStatus.Success;
                    }
                    else
                    {
                        toolProcess.Kill();
                        eventArguments.ExitStatus = ToolExitStatus.Canceled;
                        AcknowledgeCancel();
                    }
                }
                catch (Exception e)
                {
                    if (toolProcess != null && !toolProcess.HasExited)
                    {
                        toolProcess.Kill();
                    }
                    eventArguments.ExitStatus = ToolExitStatus.Error;
                    throw (e);
                }
                finally
                {
                    if (toolProcess != null)
                    {
                        toolProcess.Close();
                    }
                }
            }
        }