public override void BuildChildNodes(ITreeBuilder builder, object dataObject) { CppProject p = dataObject as CppProject; if (p == null) { return; } foreach (ProjectFilterItem filter in p.Filters) { builder.AddChild(filter); } }
/// <summary> /// Initializes a new instance of the <see cref="GenerateCompileDatabase"/> class. /// Adds our command handlers for menu (commands must exist in the command table file) /// </summary> /// <param name="package">Owner package, not null.</param> /// <param name="commandService">Command service to add command to, not null.</param> private GenerateCompileDatabase(AsyncPackage package, OleMenuCommandService commandService) { this.package = package ?? throw new ArgumentNullException(nameof(package)); commandService = commandService ?? throw new ArgumentNullException(nameof(commandService)); var menuCommandID = new CommandID(CommandSet, CommandId); var menuItem = new OleMenuCommand(this.Execute, menuCommandID); menuItem.BeforeQueryStatus += new EventHandler(OnBeforeQueryStatus); commandService.AddCommand(menuItem); var dteService = package.GetService <EnvDTE.DTE, EnvDTE.DTE>(); m_cppSupport = new CppProject(dteService); }
/// <summary> /// Initializes a new instance of the <see cref="RunTidy"/> class. /// Adds our command handlers for menu (commands must exist in the command table file) /// </summary> /// <param name="package">Owner package, not null.</param> /// <param name="commandService">Command service to add command to, not null.</param> private RunTidy(AsyncPackage package, OleMenuCommandService commandService, IMessageGenerator errorService) { this.package = package ?? throw new ArgumentNullException(nameof(package)); commandService = commandService ?? throw new ArgumentNullException(nameof(commandService)); m_output = new ExtensionOutput(package, "CLang Output", ExtensionOutput.DefaultOutputWindowGuid); var menuCommandID = new CommandID(CommandSet, CommandId); menuItem = new OleMenuCommand(this.Execute, menuCommandID); menuItem.BeforeQueryStatus += new EventHandler(OnBeforeQueryStatus); commandService.AddCommand(menuItem); m_errorService = errorService; var dteService = package.GetService <EnvDTE.DTE, EnvDTE.DTE>(); m_cppSupport = new CppProject(dteService); }
private void ReadProjects(string file) { if (String.IsNullOrEmpty(file)) { throw new ArgumentException("file"); } string folder = System.IO.Path.GetDirectoryName(file); var cSharpProjects = new Dictionary <string, CSharpProject>(); var cppProjects = new Dictionary <string, CppProject>(); foreach (string line in File.ReadAllLines(file)) { if (line.StartsWith("Project(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}")) { string[] items = line.Split(','); string projectName = items[0].Split('=')[1].Trim().Trim('"'); string projectPath = PathHelpers.Combine(folder, items[1].Trim().Trim('"')); if (projectPath.StartsWith("..")) { projectPath = System.IO.Path.Combine(Path, projectPath); } try { cSharpProjects.Add(projectName, CSharpProject.Parse(new FileInfo(projectPath))); } catch (Exception ex) { Trace.TraceError("parsing '" + file + "' : " + projectName + ": " + ex.Message + " (" + projectPath + ")"); cSharpProjects.Add(projectName, new CSharpProject(new FileInfo(projectPath))); } } else if (line.StartsWith("Microsoft Visual Studio Solution File")) { int start = line.IndexOf("Format Version"); if (start > 0) { Version = line.Substring(start + "Format Version".Length + 1); } } else if (line.StartsWith("Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}")) { string[] items = line.Split(','); string projectName = items[0].Split('=')[1].Trim().Trim('"'); string projectPath = PathHelpers.Combine(folder, items[1].Trim().Trim('"')); if (projectPath.StartsWith("..")) { projectPath = System.IO.Path.Combine(Path, projectPath); } try { cppProjects.Add(projectName, CppProject.Parse(new FileInfo(projectPath))); } catch (Exception ex) { Trace.TraceError("parsing '" + file + "' : " + projectName + ": " + ex.Message + " (" + projectPath + ")"); cppProjects.Add(projectName, new CppProject(new FileInfo(projectPath))); } } else { //Trace.TraceInformation("skipping line: '" + line + "'"); } } CSharpProjects = cSharpProjects; CppProjects = cppProjects; }
public CollectProjectFilesVisitor(ExtensionOutput output, CppProject project) { m_output = output; m_project = project; }