public void OpenLog() { mOutputWin = mApplication.ToolWindows.OutputWindow; try { mPane = mOutputWin.OutputWindowPanes.Item("C++ Helper Output"); } catch (Exception) { mPane = mOutputWin.OutputWindowPanes.Add("C++ Helper Output"); } }
public DriverUI(DTE dte, Window outputWindow, OutputWindowPane pane) { _dte = dte; _outputWindow = outputWindow; _pane = pane; _buttonTag = Guid.NewGuid().ToString(); // http://stackoverflow.com/questions/12049362/programmatically-add-add-in-button-to-the-standard-toolbar // add a toolbar button to the standard toolbar var bar = ((CommandBars)_dte.CommandBars)["Standard"]; if (bar != null) { var control = (CommandBarButton)bar.Controls.Add(MsoControlType.msoControlButton, Type.Missing, Type.Missing, Type.Missing, true); control.Style = MsoButtonStyle.msoButtonIcon; control.TooltipText = BarButtonControlCaption; control.Caption = BarButtonControlCaption; control.Tag = _buttonTag; control.BeginGroup = true; control.Click += (CommandBarButton ctrl, ref bool d) => { _outputWindow.Visible = true; pane.Activate(); }; } else { Log.W("failed to add command button, no Standard command bar"); } updateUI(); }
/// <summary> /// Constructor /// </summary> /// <param name="dte">Instance of DTE to get the Output Window and Status Bar from</param> /// public CompilerStatus(EventBus eventBus) { _EventBus = eventBus; _DTE = _EventBus.DTE; _OutputWindow = _DTE.ToolWindows.OutputWindow.OutputWindowPanes.Item("Build"); _StatusBar = _DTE.StatusBar; }
public static bool Schedule(OutputWindowPane output, string executable, string commandline, string workingdir, OnDone callback, object callbackArg, int timeout) { CommandThread cmd = new CommandThread(); cmd.output = output; cmd.executable = executable; cmd.commandline = commandline; cmd.workingdir = workingdir; cmd.callback = callback; cmd.callbackArg = callbackArg; cmd.timeout = timeout; try { m_queueLock.WaitOne(); m_commandQueue.Enqueue(cmd); } finally { m_queueLock.ReleaseMutex(); } m_startEvent.Release(); Log.Debug("Scheduled {0} {1}\n", cmd.executable, cmd.commandline); return true; }
public override void OnCommand(DTE2 application, OutputWindowPane pane) { if (application.SelectedItems.Count == 0) { OnExecute(null, null, pane); } foreach (SelectedItem sel in application.SelectedItems) { if (m_executeForFileItems && sel.ProjectItem != null && m_fileItemGUID == sel.ProjectItem.Kind) { //The try catch block belowe fixed issue 57: //http://github.com/spdr870/gitextensions/issues/#issue/57 try { OnExecute(sel, sel.ProjectItem.get_FileNames(0), pane); } catch (ArgumentException) { if (sel.ProjectItem.FileCount > 0) { OnExecute(sel, sel.ProjectItem.get_FileNames(1), pane); } else { throw; } } } else if (m_executeForProjectItems && sel.Project != null) OnExecute(sel, sel.Project.FullName, pane); } }
public static bool Build(Project pProj, OutputWindowPane pPane, string pTarget, NameValueCollection pParams) { Microsoft.Build.BuildEngine.Engine buildEngine = new Microsoft.Build.BuildEngine.Engine(); BuildExecutor executor = new BuildExecutor(pPane); RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\.NETFramework", false); if (key == null) { throw new Exception("Failed to determine .NET Framework install root - no .NETFramework key"); } string installRoot = key.GetValue("InstallRoot") as string; if (installRoot == null) { throw new Exception("Failed to determine .NET Framework install root - no InstallRoot value"); } key.Close(); buildEngine.BinPath = Path.Combine(installRoot, string.Format("v{0}.{1}.{2}", Environment.Version.Major, Environment.Version.Minor, Environment.Version.Build)); buildEngine.RegisterLogger(executor); executor.Verbosity = LoggerVerbosity.Normal; BuildPropertyGroup properties = new BuildPropertyGroup(); foreach (string propKey in pParams.Keys) { string val = pParams[propKey]; properties.SetProperty(propKey, val, true); } return buildEngine.BuildProjectFile(pProj.FileName, new string[]{pTarget}, properties); }
public override void analyze(List<ConfiguredFiles> allConfiguredFiles, OutputWindowPane outputWindow, bool analysisOnSavedFile) { if (!allConfiguredFiles.Any()) return; List<string> cppheckargs = new List<string>(); foreach (var configuredFiles in allConfiguredFiles) cppheckargs.Add(getCPPCheckArgs(configuredFiles, analysisOnSavedFile, allConfiguredFiles.Count > 1, createNewTempFileName())); string analyzerPath = Properties.Settings.Default.CPPcheckPath; while (!File.Exists(analyzerPath)) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "cppcheck executable|cppcheck.exe"; if (dialog.ShowDialog() != DialogResult.OK) return; analyzerPath = dialog.FileName; } Properties.Settings.Default.CPPcheckPath = analyzerPath; Properties.Settings.Default.Save(); run(analyzerPath, cppheckargs, outputWindow); }
public FindJar(DTE2 _applicationObject, Project prj, OutputWindowPane outWin) { this._applicationObject = _applicationObject; this.prj = prj; this.dg = outWin; this.alJars = new ArrayList(); }
public BackgroundBuild2(DTE dte, OutputWindowPane pane) { _dte = dte; _pane = pane; _mainThread = SynchronizationContext.Current; BuildManager = new BuildManager(); }
public override void OnExecute(SelectedItem item, string fileName, OutputWindowPane pane) { const string saveAllCommandName = "File.SaveAll"; item.DTE.ExecuteCommand(saveAllCommandName, string.Empty); RunGitEx("commit", fileName); }
private void ExecuteOnSolutionItem(SelectedItem solutionItem, DTE2 application, OutputWindowPane pane) { if (solutionItem.ProjectItem != null && IsTargetSupported(GetProjectItemTarget(solutionItem.ProjectItem))) { //Unfortunaly FileNames[1] is not supported by .net 3.5 OnExecute(solutionItem, solutionItem.ProjectItem.get_FileNames(1), pane); return; } if (solutionItem.Project != null && IsTargetSupported(CommandTarget.Project)) { OnExecute(solutionItem, solutionItem.Project.FullName, pane); return; } if (application.Solution.IsOpen && IsTargetSupported(CommandTarget.Solution)) { OnExecute(solutionItem, application.Solution.FullName, pane); return; } if (IsTargetSupported(CommandTarget.Empty)) { OnExecute(solutionItem, null, pane); return; } MessageBox.Show("You need to select a file or project to use this function.", "Git Extensions", MessageBoxButtons.OK, MessageBoxIcon.Information); }
protected override void Initialize() { Debug.WriteLine ("Entering Initialize() of: {0}", this); base.Initialize(); _dte = (DTE)GetService(typeof(DTE)); _events = _dte.Events; _documentEvents = _events.DocumentEvents; _documentEvents.DocumentSaved += DocumentEvents_DocumentSaved; var window = _dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput); var outputWindow = (OutputWindow)window.Object; _outputPane = outputWindow.OutputWindowPanes .Cast<OutputWindowPane>() .FirstOrDefault(p => p.Name == "AutoRunCustomTool") ?? outputWindow.OutputWindowPanes.Add("AutoRunCustomTool"); _errorListProvider = new ErrorListProvider(this) { ProviderName = "AutoRunCustomTool", ProviderGuid = Guid.NewGuid() }; RegisterExtenderProvider(); }
public OutputWindowLogger(DTE2 _applicationObject, string _eventSource, LogLevel level) { try { // Create an output pane for this package Window window = _applicationObject.Windows.Item(Constants.vsWindowKindOutput); OutputWindow outputWindow = (OutputWindow)window.Object; outputWindowPane = null; for (int i = 1; i <= outputWindow.OutputWindowPanes.Count; ++i) // index starts from 1! { if (outputWindow.OutputWindowPanes.Item(i).Name.Equals(_eventSource, StringComparison.CurrentCultureIgnoreCase)) { outputWindowPane = outputWindow.OutputWindowPanes.Item(i); break; } } if (outputWindowPane == null) outputWindowPane = outputWindow.OutputWindowPanes.Add(_eventSource); } catch { // Swallow it, never let errors in logging stop the add in } logLevel = level; }
protected override void OnExecute(SelectedItem item, string fileName, OutputWindowPane pane) { if (!string.IsNullOrEmpty(fileName) && Path.GetInvalidPathChars().Any(fileName.Contains)) fileName = ""; var directoryName = Path.GetDirectoryName(fileName); RunGitEx("clone", directoryName); }
public void OnImportsSatisfied() { if (outputWindowPane == null) lock (@lock) if (outputWindowPane == null) outputWindowPane = SetupOutputWindow(); }
/// <summary> /// Implements the OnConnection method of the IDTExtensibility2 interface. /// Receives notification that the Add-in is being loaded. /// </summary> /// <param name="application">Root object of the host application.</param> /// <param name="connectMode"> /// Describes how the Add-in is being loaded (e.g. command line or UI). This is unused since /// the add-in functions the same regardless of how it was loaded. /// </param> /// <param name="addInInst">Object representing this Add-in.</param> /// <param name="custom">Unused, but could contain host specific data for the add-in.</param> /// <seealso class='IDTExtensibility2' /> public void OnConnection( object application, ext_ConnectMode connectMode, object addInInst, ref Array custom) { dte_ = (DTE2)application; debuggerEvents_ = dte_.Events.DebuggerEvents; debuggerEvents_.OnEnterDesignMode += DebuggerOnEnterDesignMode; debuggerEvents_.OnEnterRunMode += DebuggerOnEnterRunMode; commandEvents_ = dte_.Events.CommandEvents; commandEvents_.AfterExecute += CommandEventsAfterExecute; try { webServerOutputPane_ = dte_.ToolWindows.OutputWindow.OutputWindowPanes.Item( Strings.WebServerOutputWindowTitle); } catch (ArgumentException) { // This exception is expected if the window pane hasn't been created yet. webServerOutputPane_ = dte_.ToolWindows.OutputWindow.OutputWindowPanes.Add( Strings.WebServerOutputWindowTitle); } }
public override void OnExecute(SelectedItem item, string fileName, OutputWindowPane pane) { string message = "You are about to revert the file '" + fileName + "'. Do you want to do this?"; if (MessageBox.Show(message, "Revert File?", MessageBoxButtons.YesNo) == DialogResult.Yes) { P4Operations.RevertFile(pane, fileName); } }
public Plugin(DTE2 application, AddIn addIn, string panelName, string connectPath) { // TODO: This can be figured out from traversing the assembly and locating the Connect class... m_connectPath = connectPath; m_application = application; m_addIn = addIn; m_outputPane = AquireOutputPane(application, panelName); }
private void CreateOutputPane() { _outputPane = _outputPanes.Add("IvyVisual"); if (_outputPane != null) { _outputPane.Activate(); } }
public override void analyze(string dir, OutputWindowPane outputWindow) { List<string> cppheckargs = new List<string> { getCPPCheckArgs(dir) }; analyze(cppheckargs, outputWindow); }
/// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary> /// <param term='application'>Root object of the host application.</param> /// <param term='connectMode'>Describes how the Add-in is being loaded.</param> /// <param term='addInInst'>Object representing this Add-in.</param> /// <seealso class='IDTExtensibility2' /> public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom) { _applicationObject = (DTE2)application; _addInInstance = (AddIn)addInInst; _debug = _applicationObject.ToolWindows.OutputWindow.OutputWindowPanes.Add("Solution Settings Loader"); Output("loaded..."); _applicationObject.Events.SolutionEvents.Opened += SolutionEvents_Opened; Output("listening for solution load..."); }
public FeedbackManager(string name, OutputWindowPane outputPane) { if (name == null) throw new ArgumentNullException("name"); if (outputPane == null) throw new ArgumentNullException("outputPane"); _messagePrefix = name + " reporting:\n"; _outputPane = outputPane; }
public override void TestSuiteStarted() { dte.ToolWindows.OutputWindow.Parent.Activate(); dte.ToolWindows.ErrorList.Parent.Activate(); dte.ToolWindows.OutputWindow.Parent.SetFocus(); testPane = GetOutputPane("Test"); testPane.Activate(); testPane.Clear(); SetStatusBarMessage("Testing Started"); }
/// <summary> /// Constructs the WebServer, starts the web server process. /// </summary> /// <param name="outputWindowPane">Existing output pane to send web server output to.</param> /// <param name="properties">PropertyManager that is set to a valid project/platform.</param> public WebServer(OutputWindowPane outputWindowPane, PropertyManager properties) { if (outputWindowPane == null) { throw new ArgumentNullException("outputWindowPane"); } if (properties == null) { throw new ArgumentNullException("properties"); } webServerOutputPane_ = outputWindowPane; // Read port from properties, if invalid port then set to default value. int webServerPort; if (!int.TryParse(properties.WebServerPort, out webServerPort)) { webServerPort = DefaultWebServerPort; } string webServerExecutable = "python.exe"; string httpd = Path.Combine(properties.SDKRootDirectory, "examples", "httpd.py"); if (!File.Exists(httpd)) httpd = Path.Combine(properties.SDKRootDirectory, "tools", "httpd.py"); string webServerArguments = httpd + " --no_dir_check " + webServerPort; webServerOutputPane_.Clear(); webServerOutputPane_.OutputString(Strings.WebServerStartMessage + "\n"); webServerOutputPane_.Activate(); // Start the web server process. try { webServer_ = new System.Diagnostics.Process(); webServer_.StartInfo.CreateNoWindow = true; webServer_.StartInfo.UseShellExecute = false; webServer_.StartInfo.RedirectStandardOutput = true; webServer_.StartInfo.RedirectStandardError = true; webServer_.StartInfo.FileName = webServerExecutable; webServer_.StartInfo.Arguments = webServerArguments; webServer_.StartInfo.WorkingDirectory = properties.ProjectDirectory; webServer_.OutputDataReceived += WebServerMessageReceive; webServer_.ErrorDataReceived += WebServerMessageReceive; webServer_.Start(); webServer_.BeginOutputReadLine(); webServer_.BeginErrorReadLine(); } catch (Exception e) { webServerOutputPane_.OutputString(Strings.WebServerStartFail + "\n"); webServerOutputPane_.OutputString("Exception: " + e.Message + "\n"); } }
public override void analyze(List<ConfiguredFiles> allConfiguredFiles, OutputWindowPane outputWindow, bool analysisOnSavedFile) { if (!allConfiguredFiles.Any()) return; List<string> cppheckargs = new List<string>(); foreach (var configuredFiles in allConfiguredFiles) cppheckargs.Add(getCPPCheckArgs(configuredFiles, analysisOnSavedFile, allConfiguredFiles.Count > 1, createNewTempFileName())); analyze(cppheckargs, outputWindow); }
private Logger() { var dte = Utility.GetService<DTE, DTE2>(); var outputPanes = dte.ToolWindows.OutputWindow.OutputWindowPanes; _loggerPane = ( from outputPane in outputPanes.OfType<OutputWindowPane>() where string.Equals(outputPane.Name, PaneName, StringComparison.Ordinal) select outputPane ).FirstOrDefault() ?? outputPanes.Add(PaneName); }
public override void OnCommand(EnvDTE80.DTE2 application, OutputWindowPane pane) { ThreadPool.QueueUserWorkItem( o => { string file = GitCommands.RunGitExWait("searchfile", application.Solution.FullName); if (file == null || string.IsNullOrEmpty(file.Trim())) return; application.ExecuteCommand("File.OpenFile", file); }); }
protected void run(string analyzerExePath, List<string> arguments, OutputWindowPane outputPane) { _outputPane = outputPane; _allArguments = arguments; abortThreadIfAny(); MainToolWindow.Instance.clear(); _thread = new System.Threading.Thread(() => analyzerThreadFunc(analyzerExePath)); _thread.Name = "cppcheck"; _thread.Start(); }
/// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary> /// <param name="application">Root object of the host application.</param> /// <param name='connectMode'>Describes how the Add-in is being loaded.</param> /// <param name='addInInst'>Object representing this Add-in.</param> /// <param name='custom'>Array of parameters that are host application specific.</param> /// <seealso class='IDTExtensibility2' /> public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom) { _applicationObject = (DTE2)application; _addInInstance = (AddIn)addInInst; _outputWindowPane = _applicationObject.ToolWindows.OutputWindow.OutputWindowPanes.Add("SmartBackspace"); _outputWindowPane.OutputString("SmartBackspace loaded" + Environment.NewLine); _textDocumentKeyPressEvents = ((Events2)_applicationObject.Events).get_TextDocumentKeyPressEvents(null); _textDocumentKeyPressEvents.BeforeKeyPress += _OnTextDocumentBeforeKeyPress; }
public override void OnExecute(SelectedItem item, string fileName, OutputWindowPane pane) { string dirname = Path.GetDirectoryName(fileName); if (mMainLine) { Config options = (Config)Plugin.Options; fileName = P4Operations.RemapToMain(fileName, options.MainLinePath); } P4Operations.RevisionGraph(pane, dirname, fileName); }
private void onPaneClearing(OutputWindowPane pane) { resetPrevCountLines(pane.Guid); dataList.Clear(); }
private static void LogToOutputWindow(object message) { ThreadHelper.Generic.BeginInvoke(() => OutputWindowPane?.OutputString(message + Environment.NewLine)); }
bool TryCompileSingleFile() { DTE DTE = UnrealVSPackage.Instance.DTE; // Activate the output window Window Window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput); Window.Activate(); OutputWindow OutputWindow = Window.Object as OutputWindow; // Try to find the 'Build' window OutputWindowPane BuildOutputPane = null; foreach (OutputWindowPane Pane in OutputWindow.OutputWindowPanes) { if (Pane.Guid.ToUpperInvariant() == "{1BD8A850-02D1-11D1-BEE7-00A0C913D1F8}") { BuildOutputPane = Pane; break; } } if (BuildOutputPane == null) { return(false); } // If there's already a build in progress, offer to cancel it if (ChildProcess != null && !ChildProcess.HasExited) { if (MessageBox.Show("Cancel current compile?", "Compile in progress", MessageBoxButtons.YesNo) == DialogResult.Yes) { KillChildProcess(); BuildOutputPane.OutputString("1> Build cancelled.\r\n"); } return(true); } // Check we've got a file open if (DTE.ActiveDocument == null) { return(false); } // Grab the current startup project IVsHierarchy ProjectHierarchy; UnrealVSPackage.Instance.SolutionBuildManager.get_StartupProject(out ProjectHierarchy); if (ProjectHierarchy == null) { return(false); } Project StartupProject = Utils.HierarchyObjectToProject(ProjectHierarchy); if (StartupProject == null) { return(false); } Microsoft.VisualStudio.VCProjectEngine.VCProject VCStartupProject = StartupProject.Object as Microsoft.VisualStudio.VCProjectEngine.VCProject; if (VCStartupProject == null) { return(false); } // Get the active configuration for the startup project Configuration ActiveConfiguration = StartupProject.ConfigurationManager.ActiveConfiguration; string ActiveConfigurationName = String.Format("{0}|{1}", ActiveConfiguration.ConfigurationName, ActiveConfiguration.PlatformName); Microsoft.VisualStudio.VCProjectEngine.VCConfiguration ActiveVCConfiguration = VCStartupProject.Configurations.Item(ActiveConfigurationName); if (ActiveVCConfiguration == null) { return(false); } // Get the NMake settings for this configuration Microsoft.VisualStudio.VCProjectEngine.VCNMakeTool ActiveNMakeTool = ActiveVCConfiguration.Tools.Item("VCNMakeTool"); if (ActiveNMakeTool == null) { return(false); } // Save all the open documents DTE.ExecuteCommand("File.SaveAll"); // Check it's a cpp file string FileToCompile = DTE.ActiveDocument.FullName; if (!FileToCompile.EndsWith(".c", StringComparison.InvariantCultureIgnoreCase) && !FileToCompile.EndsWith(".cpp", StringComparison.InvariantCultureIgnoreCase)) { MessageBox.Show("Invalid file extension for single-file compile.", "Invalid Extension", MessageBoxButtons.OK); return(true); } // If there's already a build in progress, don't let another one start if (DTE.Solution.SolutionBuild.BuildState == vsBuildState.vsBuildStateInProgress) { if (MessageBox.Show("Cancel current compile?", "Compile in progress", MessageBoxButtons.YesNo) == DialogResult.Yes) { DTE.ExecuteCommand("Build.Cancel"); } return(true); } // Make sure any existing build is stopped KillChildProcess(); // Set up the output pane BuildOutputPane.Activate(); BuildOutputPane.Clear(); BuildOutputPane.OutputString(String.Format("1>------ Build started: Project: {0}, Configuration: {1} {2} ------\r\n", StartupProject.Name, ActiveConfiguration.ConfigurationName, ActiveConfiguration.PlatformName)); BuildOutputPane.OutputString(String.Format("1> Compiling {0}\r\n", FileToCompile)); // Set up event handlers DTE.Events.BuildEvents.OnBuildBegin += BuildEvents_OnBuildBegin; // Create a delegate for handling output messages DataReceivedEventHandler OutputHandler = (Sender, Args) => { if (Args.Data != null) { BuildOutputPane.OutputString("1> " + Args.Data + "\r\n"); } }; // Spawn the new process ChildProcess = new System.Diagnostics.Process(); ChildProcess.StartInfo.FileName = Path.Combine(Environment.SystemDirectory, "cmd.exe"); ChildProcess.StartInfo.Arguments = String.Format("/C {0} -singlefile=\"{1}\"", ActiveNMakeTool.BuildCommandLine, FileToCompile); ChildProcess.StartInfo.WorkingDirectory = Path.GetDirectoryName(StartupProject.FullName); ChildProcess.StartInfo.UseShellExecute = false; ChildProcess.StartInfo.RedirectStandardOutput = true; ChildProcess.StartInfo.RedirectStandardError = true; ChildProcess.StartInfo.CreateNoWindow = true; ChildProcess.OutputDataReceived += OutputHandler; ChildProcess.ErrorDataReceived += OutputHandler; ChildProcess.Start(); ChildProcess.BeginOutputReadLine(); ChildProcess.BeginErrorReadLine(); return(true); }
public override void analyze(List <SourceFile> filesToAnalyze, OutputWindowPane outputWindow, bool is64bitConfiguration, bool isDebugConfiguration, bool analysisOnSavedFile) { if (!filesToAnalyze.Any()) { return; } Debug.Assert(_numCores > 0); String cppheckargs = Properties.Settings.Default.DefaultArguments; if (Properties.Settings.Default.SeveritiesString.Length != 0) { cppheckargs += " --enable=" + Properties.Settings.Default.SeveritiesString; } HashSet <string> suppressions = new HashSet <string>(Properties.Settings.Default.SuppressionsString.Split(',')); suppressions.Add("unmatchedSuppression"); HashSet <string> skippedFilesMask = new HashSet <string>(); HashSet <string> skippedIncludeMask = new HashSet <string>(); SuppressionsInfo unitedSuppressionsInfo = readSuppressions(ICodeAnalyzer.SuppressionStorage.Global); unitedSuppressionsInfo.UnionWith(readSuppressions(ICodeAnalyzer.SuppressionStorage.Solution)); // Creating the list of all different project locations (no duplicates) HashSet <string> projectPaths = new HashSet <string>(); // enforce uniqueness on the list of project paths foreach (var file in filesToAnalyze) { projectPaths.Add(file.BaseProjectPath); } Debug.Assert(projectPaths.Count == 1); _projectBasePath = projectPaths.First(); _projectName = filesToAnalyze[0].ProjectName; // Creating the list of all different suppressions (no duplicates) foreach (var path in projectPaths) { unitedSuppressionsInfo.UnionWith(readSuppressions(SuppressionStorage.Project, path, filesToAnalyze[0].ProjectName)); } cppheckargs += (" --relative-paths=\"" + filesToAnalyze[0].BaseProjectPath + "\""); cppheckargs += (" -j " + _numCores.ToString()); if (Properties.Settings.Default.InconclusiveChecksEnabled) { cppheckargs += " --inconclusive "; } suppressions.UnionWith(unitedSuppressionsInfo.SuppressionLines); foreach (string suppression in suppressions) { if (!String.IsNullOrWhiteSpace(suppression)) { cppheckargs += (" --suppress=" + suppression); } } // We only add include paths once, and then specify a set of files to check HashSet <string> includePaths = new HashSet <string>(); foreach (var file in filesToAnalyze) { if (!matchMasksList(file.FilePath, unitedSuppressionsInfo.SkippedFilesMask)) { includePaths.UnionWith(file.IncludePaths); } } includePaths.Add(filesToAnalyze[0].BaseProjectPath); // Fix for #60 foreach (string path in includePaths) { if (!matchMasksList(path, unitedSuppressionsInfo.SkippedIncludesMask)) { String includeArgument = " -I\"" + path + "\""; cppheckargs = cppheckargs + " " + includeArgument; } } foreach (SourceFile file in filesToAnalyze) { if (!matchMasksList(file.FileName, unitedSuppressionsInfo.SkippedFilesMask)) { cppheckargs += " \"" + file.FilePath + "\""; } } if ((analysisOnSavedFile && Properties.Settings.Default.FileOnlyCheckCurrentConfig) || (!analysisOnSavedFile && Properties.Settings.Default.ProjectOnlyCheckCurrentConfig)) // Only checking current macros configuration (for speed) { cppheckargs = cppheckargs.Replace("--force", ""); // Creating the list of all different macros (no duplicates) HashSet <string> macros = new HashSet <string>(); macros.Add("__cplusplus=199711L"); // At least in VS2012, this is still 199711L // Assuming all files passed here are from the same project / same toolset, which should be true, so peeking the first file for global settings switch (filesToAnalyze[0].vcCompilerVersion) { case SourceFile.VCCompilerVersion.vc2003: macros.Add("_MSC_VER=1310"); break; case SourceFile.VCCompilerVersion.vc2005: macros.Add("_MSC_VER=1400"); break; case SourceFile.VCCompilerVersion.vc2008: macros.Add("_MSC_VER=1500"); break; case SourceFile.VCCompilerVersion.vc2010: macros.Add("_MSC_VER=1600"); break; case SourceFile.VCCompilerVersion.vc2012: macros.Add("_MSC_VER=1700"); break; case SourceFile.VCCompilerVersion.vc2013: macros.Add("_MSC_VER=1800"); break; case SourceFile.VCCompilerVersion.vcFuture: macros.Add("_MSC_VER=1900"); break; } foreach (var file in filesToAnalyze) { macros.UnionWith(file.Macros); } macros.Add("WIN32"); macros.Add("_WIN32"); if (is64bitConfiguration) { macros.Add("_M_X64"); macros.Add("_WIN64"); } else { macros.Add("_M_IX86"); } if (isDebugConfiguration) { macros.Add("_DEBUG"); } foreach (string macro in macros) { if (!String.IsNullOrEmpty(macro) && !macro.Contains(" ") /* macros with spaces are invalid in VS */) { String macroArgument = " -D" + macro; cppheckargs += macroArgument; } } HashSet <string> macrosToUndefine = new HashSet <string>(); foreach (var file in filesToAnalyze) { macrosToUndefine.UnionWith(file.MacrosToUndefine); } foreach (string macro in macrosToUndefine) { if (!String.IsNullOrEmpty(macro) && !macro.Contains(" ") /* macros with spaces are invalid in VS */) { String macroUndefArgument = " -U" + macro; cppheckargs += macroUndefArgument; } } } else if (!cppheckargs.Contains("--force")) { cppheckargs += " --force"; } string analyzerPath = Properties.Settings.Default.CPPcheckPath; while (!File.Exists(analyzerPath)) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "cppcheck executable|cppcheck.exe"; if (dialog.ShowDialog() != DialogResult.OK) { return; } analyzerPath = dialog.FileName; } Properties.Settings.Default.CPPcheckPath = analyzerPath; Properties.Settings.Default.Save(); run(analyzerPath, cppheckargs, outputWindow); }
abstract public void OnCommand(DTE2 application, OutputWindowPane pane);
public static void reportException(this OutputWindowPane pane, Exception e) { pane.OutputString($"---------- BuildOnSave CRASHED, please report to https://www.github.com/pragmatrix/BuildOnSave/issues\n"); pane.OutputString(e.ToString()); }
public static void OutputWindowWriteFormat(string outputWindowName, string formatString) { OutputWindowPane outPane = GetOutputWindowPane(outputWindowName, true); outPane.OutputString(formatString); }
/// <summary> /// This function is the callback used to execute the command when the menu item is clicked. /// See the constructor to see how the menu item is associated with this function using /// OleMenuCommandService service and MenuCommand class. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event args.</param> private void MenuItemCallback(object sender, EventArgs e) { DTE dte = (DTE)this.ServiceProvider.GetService(typeof(DTE)); Window window = dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput); OutputWindow outputWindow = (OutputWindow)window.Object; OutputWindowPane owp = null; foreach (OutputWindowPane opane in outputWindow.OutputWindowPanes) { if (string.Equals(CMPANE, opane.Name, StringComparison.InvariantCultureIgnoreCase)) { owp = opane; break; } } owp = owp ?? outputWindow.OutputWindowPanes.Add(CMPANE); owp?.Activate(); owp?.Clear(); string slnDir = Path.GetDirectoryName(dte.Solution.FileName); string slnName = Path.GetFileNameWithoutExtension(dte.Solution.FullName); List <ProjInfo> projs = new List <ProjInfo>(); { EConfType eConfigurationType = EConfType.Unknown; foreach (BuildDependency dep in dte.Solution.SolutionBuild.BuildDependencies) { string pname = dep.Project.Name; string pdir = Path.GetDirectoryName(dep.Project.FileName); string ptype = dep.Project.Kind; if (CMPROJS.Contains(pname)) { continue; } ProjInfo pInf = new ProjInfo { Name = pname, Directory = pdir }; projs.Add(pInf); owp?.OutputString($"Project: {pname} ({ptype}) @ {pdir}\n"); var depp = dep.RequiredProjects as System.Collections.IEnumerable; foreach (Project rp in depp) { if (CMPROJS.Contains(rp.Name)) { continue; } pInf.ProjDependencyNames.Add(rp.Name); owp?.OutputString($"\tDep: {rp.Name}\n"); } Configuration cfg = dep.Project.ConfigurationManager.ActiveConfiguration; foreach (Property prop in cfg.Properties) { if (string.Equals("ConfigurationType", prop.Name, StringComparison.InvariantCultureIgnoreCase)) { eConfigurationType = (EConfType)Enum.Parse(typeof(EConfType), prop.Value.ToString()); pInf.ProjType = eConfigurationType; owp?.OutputString($"\tProp: {prop.Name} = {prop.Value} ({eConfigurationType})\n"); } } } } this.CreateSolutionCMakeList(slnName, slnDir, projs.Select(s => s.Name)); this.CreateProjectsCMakeLists(slnDir, projs); }
public static void WriteLine(this OutputWindowPane pane, string text) { pane.OutputString(text + '\n'); }
protected override void OnExecute(SelectedItem item, string fileName, OutputWindowPane pane) { RunGitEx("remotes", fileName); }
private void runSavedFileAnalysis(SourceFile file, Configuration currentConfig, OutputWindowPane outputPane) { Debug.Assert(currentConfig != null); var configuredFiles = new ConfiguredFiles(); configuredFiles.Files = new List <SourceFile> { file }; configuredFiles.Configuration = currentConfig; runAnalysis(new List <ConfiguredFiles> { configuredFiles }, outputPane, true); }
private void runSavedFileAnalysis(SourceFile file, Configuration currentConfig, OutputWindowPane outputPane) { var list = new List <SourceFile>(); list.Add(file); runAnalysis(list, currentConfig, outputPane, true); }
private void runAnalysis(List <SourceFile> files, Configuration currentConfig, OutputWindowPane outputPane, bool analysisOnSavedFile) { Debug.Assert(outputPane != null); Debug.Assert(currentConfig != null); outputPane.Clear(); var currentConfigName = currentConfig.ConfigurationName; foreach (var analyzer in _analyzers) { analyzer.analyze(files, outputPane, currentConfigName.Contains("64"), currentConfigName.ToLower().Contains("debug"), analysisOnSavedFile); } }
public OutputWindowHelper(_DTE dte) { _dte = dte; _pane = GetOutputWindow("Output"); }
public static void OutputErrorLine(this OutputWindowPane pane, string str) { string date = DateTime.Now.ToString(); pane.OutputString(date + " [ERROR]\t" + str + Environment.NewLine); }
string ReadTest(OutputWindowPane pane) { return(pane.Read().Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries) .LastOrDefault(x => x.StartsWith(PluginManager.RESHARPER_TEST))); }
protected override void OnExecute(SelectedItem item, string fileName, OutputWindowPane pane) { throw new System.NotImplementedException(); }
public override void OnExecute(SelectedItem item, string fileName, OutputWindowPane pane) { RunGitEx("commit", fileName); }
public VisualStudioLogHandler(OutputWindowPane pane) { mPane = pane; }
public static void OutputLine(this OutputWindowPane owp, string message) { owp.OutputString(message); owp.OutputString(Environment.NewLine); }
public static void OutputWindowWrite(string outputWindowName, string msg) { OutputWindowPane outPane = GetOutputWindowPane(outputWindowName, true); outPane.OutputString(msg); }
public override void OnExecute(SelectedItem item, string fileName, OutputWindowPane pane) { P4Operations.DiffFile(pane, fileName); }
protected abstract void OnExecute(SelectedItem item, string fileName, OutputWindowPane pane);
public static IOsbideEvent FromCommand(string commandName, DTE2 dte) { IOsbideEvent oEvent = null; //debugging events if (debugCommands.Contains(commandName)) { DebugActions action = (DebugActions)debugCommands.IndexOf(commandName); DebugEvent debug = new DebugEvent(); debug.SolutionName = dte.Solution.FullName; debug.EventDate = DateTime.UtcNow; //sometimes document name can be null try { debug.DocumentName = dte.ActiveDocument.Name; } catch (Exception) { debug.DocumentName = dte.Solution.FullName; } //add line number if applicable if (action == DebugActions.StepInto || action == DebugActions.StepOut || action == DebugActions.StepOver ) { //line number can be null if there is no document open try { TextSelection debugSelection = dte.ActiveDocument.Selection; debugSelection.SelectLine(); int lineNumber = debugSelection.CurrentLine; debug.LineNumber = lineNumber; debug.DebugOutput = debugSelection.Text; } catch (Exception) { debug.LineNumber = 0; } } //kind of reappropriating this for our current use. Consider refactoring. debug.ExecutionAction = (int)action; //throw the content of the output window into the event if we just stopped debugging if (action == DebugActions.StopDebugging) { OutputWindowPane debugWindow = dte.ToolWindows.OutputWindow.OutputWindowPanes.Item("Debug"); if (debugWindow != null) { TextDocument text = debugWindow.TextDocument; TextSelection selection = text.Selection; selection.StartOfDocument(); selection.EndOfDocument(true); debug.DebugOutput = selection.Text; selection.EndOfDocument(); } } oEvent = debug; } else if (cutCopyPasteCommands.Contains(commandName)) { CutCopyPasteEvent ccp = new CutCopyPasteEvent(); ccp.SolutionName = dte.Solution.FullName; ccp.EventDate = DateTime.UtcNow; ccp.EventAction = cutCopyPasteCommands.IndexOf(commandName); ccp.Content = Clipboard.GetText(); //sometimes document name can be null try { ccp.DocumentName = dte.ActiveDocument.Name; } catch (Exception) { ccp.DocumentName = dte.Solution.FullName; } oEvent = ccp; } return(oEvent); }
/// <summary> /// Remove pane by name of item. /// </summary> /// <param name="name"></param> public void deleteByName(string name) { OutputWindowPane pane = getByName(name, false); deleteByGuid(new Guid(pane.Guid)); }
private void Execute(object sender, EventArgs e) { ThreadHelper.ThrowIfNotOnUIThread(); bool isUserLogedIn = Authnticator.isUserLogedIn(); if (!isUserLogedIn) { Login login = new Login(); login.Show(); } else { bool isExceptionThrown = ExceptionFinder.isExceptionThrown(); if (!isExceptionThrown) { ErrorService errorService = new ErrorService(); ErrorListProvider errorListProvider = new ErrorListProvider(errorService); IEnumerable <IVsTaskItem> list = VsShellUtilities.GetErrorListItems(errorService); int numberOfErrors = 0; List <string> errorMessages = new List <string>(); errorMessages.Clear(); foreach (var item in list) { string errortext; item.get_Text(out errortext); errorMessages.Add(errortext); numberOfErrors++; } if (numberOfErrors == 0) { MessageBox.Show("Everything is OK... You are good to Go."); } else { foreach (var item in errorMessages) { MessageBox.Show(item); } } } else if (isExceptionThrown) { DTE2 dte = Package.GetGlobalService(typeof(DTE)) as DTE2; string filename = dte.FileName; Solution solution = dte.Solution; string fileName = dte.ActiveDocument.FullName; EnvExtractor envExtractor = new EnvExtractor(); string extionName = envExtractor.detectEnvironoment(fileName); EnvironomentSpecifier environomentSpecifier = new EnvironomentSpecifier(); string envName = environomentSpecifier.getEnvNameByFileExtensionName(extionName); OutputWindowPane outputWindowPane = dte.ToolWindows.OutputWindow.OutputWindowPanes.Item("Debug"); outputWindowPane.TextDocument.Selection.SmartFormat(); outputWindowPane.TextDocument.Selection.SelectAll(); string newText = outputWindowPane.TextDocument.Selection.Text; string[] buildOrder = newText.Split('\n'); int index = 0; int count = 0; foreach (var item in buildOrder) { if (item.Contains("An unhandled")) { index = count; } count++; } exceptionString = buildOrder[index + 1]; // process new output in newText exceptionString = exceptionString + " in " + envName; //MessageBox.Show(exceptionString); Home errorDisplay = new Home(exceptionString); errorDisplay.ShowDialog(); } } }
public abstract void analyze(List <ConfiguredFiles> configuredFiles, OutputWindowPane outputPane, bool analysisOnSavedFile);
protected void onPaneUpdated(OutputWindowPane pane) { if (pane == null || pane.Guid == null) { return; } TextDocument textD; try { textD = pane.TextDocument; } catch (System.Runtime.InteropServices.COMException ex) { Log.Debug("notifyRaw: COMException - '{0}'", ex.Message); return; } int countLines = textD.EndPoint.Line; if (countLines <= 1 || countLines - getPrevCountLines(pane.Guid) < 1) { return; } if (!dataList.ContainsKey(pane.Guid)) { dataList[pane.Guid] = new ConcurrentQueue <string>(); } EditPoint point = textD.StartPoint.CreateEditPoint(); // text between Start (inclusive) and ExclusiveEnd (exclusive) dataList[pane.Guid].Enqueue(point.GetLines(getPrevCountLines(pane.Guid), countLines)); // e.g. first line: 1, 2 setPrevCountLines(countLines, pane.Guid); //TODO: fix me. Prevent Duplicate Data / bug with OutputWindowPane if (tUpdated == null || tUpdated.ThreadState == ThreadState.Unstarted || tUpdated.ThreadState == ThreadState.Stopped) { tUpdated = new System.Threading.Thread(() => { if (pane == null) { return; } try { notifyRaw(pane.Guid, pane.Name); } catch (Exception ex) { Log.Debug("notifyRaw: failed '{0}'", ex.Message); } }); try { tUpdated.Start(); } catch (Exception ex) { // ThreadStateException, OutOfMemoryException Log.Debug("notifyRaw: can't start '{0}'", ex.Message); } } }
protected override void OnExecute(SelectedItem item, string fileName, OutputWindowPane pane) { RunGitEx("checkoutbranch", fileName); }