コード例 #1
0
        public void AddTemplateReference(EnvDTE.Project currentProject, EnvDTE.Project selectedProject) {           
            // we need to compute a relative path for the template project
            Uri currentProjUri = new Uri(currentProject.FullName);
            Uri selectedProjUri = new Uri(selectedProject.FullName);
            string relativePath = currentProjUri.MakeRelativeUri(selectedProjUri).ToString();

            FileInfo selectedProjFile = new FileInfo(selectedProject.FullName);

            var curProjObj = ProjectRootElement.Open(currentProject.FullName);
            var item = curProjObj.AddItem("TemplateReference", selectedProjFile.Name, GetTemplateReferenceMetadata(relativePath));

            // Install the TemplateBuilder NuGet pkg into the target project
            
            InstallTemplateBuilderPackage(currentProject);

            // Add the SideWaffle Project Template files into the target project
            var dte2 = Package.GetGlobalService(typeof(DTE)) as DTE2;
            Solution2 solution = (Solution2)dte2.Solution;
            string itemPath = solution.GetProjectItemTemplate("SW-ProjectVSTemplateFile.csharp.zip", "CSharp");
            selectedProject.ProjectItems.AddFromTemplate(itemPath, "_project1.vstemplate");

            curProjObj.Save();

            // Reload the project
            ReloadProject(dte2, currentProject);
        }
コード例 #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Runs custom wizard logic when a project has finished generating.
        /// </summary>
        /// <param name="project">The project that finished generating.</param>
        /// ------------------------------------------------------------------------------------
        public void ProjectFinishedGenerating(EnvDTE.Project project)
        {
            if (project == null)
                return;

            // Go through all project items and remove *.vspscc and *.user file (it has to be in
            // the project so that it gets added and properly named by the wizard)
            RemoveItemFromProject(project, project.Name + ".csproj.vspscc");
            RemoveItemFromProject(project, project.Name + ".csproj.user");

            // The project may contain items for a test project - we need to remove those and
            // add it as a separate project! This can't be done using a multi-project template,
            // because we want the projects to be nested.
            ArrayList itemsToRemove = new ArrayList();
            foreach (ProjectItem item in project.ProjectItems)
            {
                if (item.Name.StartsWith(project.Name) && item.ProjectItems.Count > 0)
                    itemsToRemove.Add(item.Name);
            }
            foreach (string itemName in itemsToRemove)
                RemoveItemFromProject(project, itemName);
            if (itemsToRemove.Count > 0)
            {
                string newProject = Path.Combine(Path.GetDirectoryName(project.FileName),
                    Path.Combine(project.Name + "Tests", project.Name + "Tests.csproj"));
                // Rename the temporary bla.csprojX file to bla.csproj
                File.Move(newProject + "X", newProject);
                // Add the test project to the solution
                project.DTE.Solution.AddFromFile(newProject, false);
            }
        }
コード例 #3
0
        protected override bool TryGetItemByIndex(int index, out EnvDTE.CodeElement element)
        {
            var node = LookupNode();

            int currentIndex = 0;

            // Inherits statements
            var inheritsNodes = CodeModelService.GetInheritsNodes(node);
            var inheritsNodeCount = inheritsNodes.Count();
            if (index < currentIndex + inheritsNodeCount)
            {
                var child = inheritsNodes.ElementAt(index - currentIndex);
                element = FileCodeModel.CreateCodeElement<EnvDTE.CodeElement>(child);
                return true;
            }

            currentIndex += inheritsNodeCount;

            // Implements statements
            var implementsNodes = CodeModelService.GetImplementsNodes(node);
            var implementsNodeCount = implementsNodes.Count();
            if (index < currentIndex + implementsNodeCount)
            {
                var child = implementsNodes.ElementAt(index - currentIndex);
                element = FileCodeModel.CreateCodeElement<EnvDTE.CodeElement>(child);
                return true;
            }

            element = null;
            return false;
        }
コード例 #4
0
ファイル: MsJs.cs プロジェクト: Malediction/Spartan
        public override void OnAfterCreated(EnvDTE.DTE dteObject)
        {
            this.cboEvalTreatment.DataSource = System.Enum.GetNames(typeof(EvalTreatment));
            this.cboLocalRenaming.DataSource = System.Enum.GetNames(typeof(LocalRenaming));
            this.cboOutputMode.DataSource = System.Enum.GetNames(typeof(OutputMode));

            this.chkAllowEmbeddedAspNetBlocks.Checked = this.Settings.MsJsSettings.AllowEmbeddedAspNetBlocks;
            this.chkEvalLiteralExpressions.Checked = this.Settings.MsJsSettings.EvalLiteralExpressions;
            this.chkIgnoreConditionalCompilation.Checked = this.Settings.MsJsSettings.IgnoreConditionalCompilation;
            this.chkInlineSafeStrings.Checked = this.Settings.MsJsSettings.InlineSafeStrings;
            this.chkManualRenamesProperties.Checked = this.Settings.MsJsSettings.ManualRenamesProperties;
            this.chkMinifyCode.Checked = this.Settings.MsJsSettings.MinifyCode;
            this.chkPreserveFunctionNames.Checked = this.Settings.MsJsSettings.PreserveFunctionNames;
            this.chkRemoveFunctionExpressionNames.Checked = this.Settings.MsJsSettings.RemoveFunctionExpressionNames;
            this.chkCollapseToLiteral.Checked = this.Settings.MsJsSettings.CollapseToLiteral;
            this.chkCombineDuplicateLiterals.Checked = this.Settings.MsJsSettings.CombineDuplicateLiterals;
            this.cboEvalTreatment.Text = this.Settings.MsJsSettings.EvalTreatment.ToString();
            this.TxtIndentSize.Value = this.Settings.MsJsSettings.IndentSize;
            this.cboLocalRenaming.Text = this.Settings.MsJsSettings.LocalRenaming.ToString();
            this.txtLineBreakThreshold.Value = this.Settings.MsJsSettings.LineBreakThreshold;
            this.chkMacSafariQuirks.Checked = this.Settings.MsJsSettings.MacSafariQuirks;
            this.cboOutputMode.Text = this.Settings.MsJsSettings.OutputMode.ToString();
            this.chkRemoveUnneededCode.Checked = this.Settings.MsJsSettings.RemoveUnneededCode;
            this.chkStripDebugStatements.Checked = this.Settings.MsJsSettings.StripDebugStatements;
            this.chkStrictMode.Checked = this.Settings.MsJsSettings.StrictMode;
            this.chkTermSemicolons.Checked = this.Settings.MsJsSettings.TermSemicolons;
            this.chkPreserveImportantComments.Checked = this.Settings.MsJsSettings.PreserveImportantComments;
            this.chkReorderScopeDeclarations.Checked=this.Settings.MsJsSettings.ReorderScopeDeclarations;
        }
コード例 #5
0
        public void BindingWorkflow_DownloadQualityProfile_Success()
        {
            // Setup
            BindingWorkflow testSubject = this.CreateTestSubject();
            ConfigurableProgressController controller = new ConfigurableProgressController();
            var notifications = new ConfigurableProgressStepExecutionEvents();

            RuleSet ruleSet = TestRuleSetHelper.CreateTestRuleSetWithRuleIds(new[] { "Key1", "Key2" });
            var nugetPackages = new[] { new PackageName("myPackageId", new SemanticVersion("1.0.0")) };
            var additionalFiles = new[] { new AdditionalFile { FileName = "abc.xml", Content = new byte[] { 1, 2, 3 } } };
            RoslynExportProfile export = RoslynExportProfileHelper.CreateExport(ruleSet, nugetPackages, additionalFiles);

            var language = Language.VBNET;
            QualityProfile profile = this.ConfigureProfileExport(export, language);

            // Act
            testSubject.DownloadQualityProfile(controller, CancellationToken.None, notifications, new[] { language });

            // Verify
            RuleSetAssert.AreEqual(ruleSet, testSubject.Rulesets[language], "Unexpected rule set");
            Assert.AreSame(profile, testSubject.QualityProfiles[language]);
            VerifyNuGetPackgesDownloaded(nugetPackages, testSubject);
            this.outputWindowPane.AssertOutputStrings(0);
            controller.AssertNumberOfAbortRequests(0);
            notifications.AssertProgress(
                0.0,
                1.0,
                1.0);
            notifications.AssertProgressMessages(
                string.Format(CultureInfo.CurrentCulture, Strings.DownloadingQualityProfileProgressMessage, language.Name),
                string.Empty,
                Strings.QualityProfileDownloadedSuccessfulMessage);
        }
コード例 #6
0
 public UpdateGeneratedCodeWizard(EnvDTE.DTE dte)
 {
     InitializeComponent();
     DataContext = this;
     _dte = dte;
     Loaded += (_, __) => Run().ConfigureAwait(true);
 }
コード例 #7
0
ファイル: DeanEdwardsPacker.cs プロジェクト: cbilson/chirpy
 public override void OnAfterCreated(EnvDTE.DTE dteObject)
 {
     this.cboPackerEncoding.DataSource = System.Enum.GetNames(typeof(Dean.Edwards.ECMAScriptPacker.PackerEncoding));
     this.cboPackerEncoding.Text = this.Settings.ChirpDeanEdwardsPackerEncoding.ToString();
     this.chkFastDecode.Checked = this.Settings.ChirpDeanEdwardsPackerFastDecode;
     this.chkSpecialChars.Checked = this.Settings.ChirpDeanEdwardsPackerSpecialChars;
 }
コード例 #8
0
        public static string TransformToJs(string fullFileName, string text, EnvDTE.ProjectItem projectItem)
        {
            string error = null;
            try
            {
               Settings settings = Settings.Instance(fullFileName);
               return CoffeeScript.compile(text, settings.CoffeeScriptOptions);
            }
            catch (Exception e)
            {
                Match match;
                if (TaskList.Instance != null && (match = regexError.Match(e.Message)).Success)
                {
                    TaskList.Instance.Add(
                        projectItem.ContainingProject,
                        Microsoft.VisualStudio.Shell.TaskErrorCategory.Error,
                        fullFileName,
                        match.Groups[2].Value.ToInt(1),
                        0,
                        match.Groups[1].Value);
                }
                else
                {
                    error = e.Message;
                }

                return null;
            }
        }
コード例 #9
0
        public AddTranslationDialog(EnvDTE.Project pro)
        {
            project = pro;
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            ShowInTaskbar = false;

            this.langLabel.Text = SR.GetString("AddTranslationDialog_Language");
            this.cancelButton.Text = SR.GetString(SR.Cancel);
            this.okButton.Text = SR.GetString(SR.OK);
            this.label1.Text = SR.GetString("AddTranslationDialog_FileName");
            this.Text = SR.GetString("AddTranslationDialog_Title");

            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;

            //if (SR.LanguageName == "ja")
            //{
            //    this.cancelButton.Location = new System.Drawing.Point(188, 72);
            //    this.cancelButton.Size = new System.Drawing.Size(84, 24);
            //    this.okButton.Location = new System.Drawing.Point(100, 72);
            //    this.okButton.Size = new System.Drawing.Size(84, 24);
            //}
            this.KeyPress += new KeyPressEventHandler(this.AddTranslationDialog_KeyPress);
        }
コード例 #10
0
ファイル: Restore.cs プロジェクト: AlexandrM/VSExpert
 public void Execute(EnvDTE.vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled)
 {
     if (FmMain.DoDialog("") == DialogResult.OK)
     {
         (IDE.ApplicationObject.ActiveDocument.Selection as TextSelection).Text = FmMain.Code;
     }
 }
コード例 #11
0
        /// <summary>
        /// Runs custom wizard logic when a project has finished generating
        /// </summary>
        void IWizard.ProjectFinishedGenerating(EnvDTE.Project project)
        {
            if (project != null) {
                if (project.Name == "SolutionItemsContainer") {
                    PerformSolutionInitialization(project);
                    MoveSolutionItemsToLib(project);
                }
                else if (project.Name == "ToolsSolutionItemsContainer") {
                    MoveSolutionItemsToToolsLib(project);
                }
                else if (project.Name == "CrudScaffolding") {
                    Project movedProject = MoveProjectTo("\\tools\\", project, "Code Generation");
                    ExcludeProjectFromBuildProcess(movedProject);
                }
                else if (project.Name == "CrudScaffoldingForEnterpriseApp") {
                    Project movedProject = MoveProjectTo("\\tools\\", project, "Code Generation");
                    ExcludeProjectFromBuildProcess(movedProject);
                }
                else if (project.Name == GetSolutionName() + ".Tests") {
                    MoveProjectTo("\\tests\\", project);
                }
                else if (project.Name == GetSolutionName() + ".Web.Controllers" ||
                    project.Name == GetSolutionName() + ".ApplicationServices" ||
                    project.Name == GetSolutionName() + ".Core" ||
                    project.Name == GetSolutionName() + ".Data" ||
                    project.Name == GetSolutionName() + ".Web") {
                    Project movedProject = MoveProjectTo("\\app\\", project);

                    // Give the solution time to release the lock on the project file
                    System.Threading.Thread.Sleep(MIN_TIME_FOR_PROJECT_TO_RELEASE_FILE_LOCK);

                    CaptureProjectGuidOf(movedProject);
                }
            }
        }
コード例 #12
0
        public FrmActivateMemoryContracts(EnvDTE.Projects projects, string contractsAssemblyPath)
        {
            InitializeComponent();

            this.projects = projects;
            this.contractsAssemblyPath = contractsAssemblyPath;
        }
コード例 #13
0
        private void OnBuildDone(EnvDTE.vsBuildScope Scope, EnvDTE.vsBuildAction Action)
        {
            // detach from the event
            buildEvents.OnBuildDone -= OnBuildDone;

            // rollback the properties changes
            Rollback();

            EnvDTE80.ErrorList errorList = ((EnvDTE80.DTE2)this.project.DTE).ToolWindows.ErrorList;
            // ShowResult if there is any WCF rule violation
            int ruleWarnings = RuleWarningsCount(errorList);
            if (ruleWarnings == 0)
            {
				Logger.Write(
					Resources.CodeAnalysisSuccess, string.Empty, TraceEventType.Information, 1);
            }
            else
            {
				Logger.Write(
					string.Format(CultureInfo.CurrentCulture, Resources.CodeAnalysisWarnings, ruleWarnings));
                // We may force the Show Warnings button to be ON so the user will always see any 
                // warning message from the result of the code analysis run.
                errorList.ShowWarnings = true;
            }
            this.project = null;
        }
コード例 #14
0
        public static void AddHierarchyItem(ErrorTask task, EnvDTE.Project project)
        {
            IVsHierarchy hierarchyItem = null;
            IVsSolution solution = BundlerMinifierPackage.GetGlobalService(typeof(SVsSolution)) as IVsSolution;

            if (solution != null && project != null)
            {
                int flag = -1;

                try
                {
                    flag = solution.GetProjectOfUniqueName(project.FullName, out hierarchyItem);
                }
                catch (COMException ex)
                {
                    if ((uint)ex.ErrorCode != DISP_E_MEMBERNOTFOUND)
                    {
                        throw;
                    }
                }

                if (0 == flag)
                {
                    task.HierarchyItem = hierarchyItem;
                }
            }
        }
コード例 #15
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="project">The EnvDTE.Project which is to be adapted</param>
        public Project(EnvDTE.Project project)
        {
            if (project == null) throw new ArgumentNullException("project");

            this._project = project;
            this.Name = project.FullName;
        }
コード例 #16
0
ファイル: ViewEngine.cs プロジェクト: cbilson/chirpy
        public override string Transform(string fullFileName, string text, EnvDTE.ProjectItem projectItem)
        {
            var tags = regexScripts.Matches(text).Cast<Match>().Reverse();

            foreach (var match in tags)
            {
                var tagName = match.Groups[1].Value;
                var attrs = match.Groups[2].Value;
                var code = match.Groups[3].Value;

                if (tagName.Is("script"))
                {
                    code = JsEngine.Minify(fullFileName, code, projectItem, Xml.MinifyType.Unspecified,string.Empty);
                }
                else if (tagName.Is("style"))
                {
                    int i = attrs.IndexOf("text/less", StringComparison.InvariantCultureIgnoreCase);
                    if (i > -1)
                    {
                        attrs = attrs.Substring(0, i) + "text/css" + attrs.Substring(i + "text/less".Length);
                        code = code.Replace("@@import", "@import"); // Razor views need the @ symbol to be escaped :/
                        code = LessEngine.TransformToCss(fullFileName, code, projectItem);
                        code = code.Replace("@import", "@@import"); // Now we have to re-escape it
                    }

                    code = CssEngine.Minify(fullFileName, code, projectItem, Xml.MinifyType.Unspecified);
                }

                text = text.Substring(0, match.Index)
                    + '<' + tagName + attrs + '>' + code + "</" + tagName + '>'
                    + text.Substring(match.Index + match.Length);
            }

            return text;
        }
コード例 #17
0
ファイル: CodeInterface.cs プロジェクト: Rickinio/roslyn
 public EnvDTE.CodeFunction AddFunction(string name, EnvDTE.vsCMFunction kind, object type, object position, EnvDTE.vsCMAccess access)
 {
     return FileCodeModel.EnsureEditor(() =>
     {
         return FileCodeModel.AddFunction(LookupNode(), name, kind, type, position, access);
     });
 }
コード例 #18
0
        // http://social.msdn.microsoft.com/Forums/vstudio/en-US/36adcd56-5698-43ca-bcba-4527daabb2e3/finding-the-startup-project-in-a-complicated-solution
        public static EnvDTE.Project GetSubProject(EnvDTE.Project project, string uniqueName)
        {
            EnvDTE.Project ret = null;

            if (project != null)
            {
                if (project.UniqueName == uniqueName)
                {
                    ret = project;
                }
                else if (project.Kind == vsProjectKindSolutionItems)
                {
                    // Solution folder
                    foreach (EnvDTE.ProjectItem projectItem in project.ProjectItems)
                    {
                        ret = GetSubProject(projectItem.SubProject, uniqueName);

                        if (ret != null)
                            break;
                    }
                }
            }

            return ret;
        }
コード例 #19
0
ファイル: YuiJs.cs プロジェクト: cbilson/chirpy
 public override void OnAfterCreated(EnvDTE.DTE dteObject)
 {
     chkDisableOptimizations.Checked = this.Settings.YuiJsSettings.DisableOptimizations;
     chkIsObfuscateJavascript.Checked = this.Settings.YuiJsSettings.IsObfuscateJavascript;
     txtLineBreakPosition.Value = this.Settings.YuiJsSettings.LineBreakPosition;
     chkPreserveAllSemiColons.Checked = this.Settings.YuiJsSettings.PreserveAllSemiColons;
 }
コード例 #20
0
ファイル: VsHelper.cs プロジェクト: Bubesz/meta-cs
        public static IVsHierarchy ToHierarchy(EnvDTE.Project project)
        {
            if (project == null) throw new ArgumentNullException("project");

            string uniqueName = project.UniqueName;
            IVsSolution solution = (IVsSolution)Package.GetGlobalService(typeof(SVsSolution));

            IVsHierarchy hierarchy;

            solution.GetProjectOfUniqueName(uniqueName, out hierarchy);

            return hierarchy;
            /*if (project == null) throw new ArgumentNullException("project"); string projectGuid = null;        // DTE does not expose the project GUID that exists at in the msbuild project file.        // Cannot use MSBuild object model because it uses a static instance of the Engine,         // and using the Project will cause it to be unloaded from the engine when the         // GC collects the variable that we declare.       
            using (XmlReader projectReader = XmlReader.Create(project.FileName))
            {
                projectReader.MoveToContent();
                object nodeName = projectReader.NameTable.Add("ProjectGuid");
                while (projectReader.Read())
                {
                    if (Object.Equals(projectReader.LocalName, nodeName))
                    {
                        projectGuid = (String)projectReader.ReadElementContentAsString(); break;
                    }
                }
            }
            Debug.Assert(!String.IsNullOrEmpty(projectGuid));
            IServiceProvider serviceProvider = new ServiceProvider(project.DTE as Microsoft.VisualStudio.OLE.Interop.IServiceProvider); return VsShellUtilities.GetHierarchy(serviceProvider, new Guid(projectGuid));*/
        }
コード例 #21
0
ファイル: VsHelper.cs プロジェクト: Bubesz/meta-cs
 public static EnvDTE.ProjectItem FindProjectItem(EnvDTE.ProjectItems items, string file)
 {
     string atom = file.Substring(0, file.IndexOf("\\") + 1);
     foreach (EnvDTE.ProjectItem item in items)
     {
         //if ( item
         //if (item.ProjectItems.Count > 0)
         if (atom.StartsWith(item.Name))
         {
             // then step in
             EnvDTE.ProjectItem ritem = FindProjectItem(item.ProjectItems, file.Substring(file.IndexOf("\\") + 1));
             if (ritem != null)
                 return ritem;
         }
         if (Regex.IsMatch(item.Name, file))
         {
             return item;
         }
         if (item.ProjectItems.Count > 0)
         {
             EnvDTE.ProjectItem ritem = FindProjectItem(item.ProjectItems, file.Substring(file.IndexOf("\\") + 1));
             if (ritem != null)
                 return ritem;
         }
     }
     return null;
 }
コード例 #22
0
        private bool GetActiveProject(out EnvDTE.Project project, out FrameworkName frameworkName)
        {
            project = null;
            frameworkName = null;

            IntPtr hierarchyPointer = IntPtr.Zero;
            IntPtr selectionContainerPointer = IntPtr.Zero;

            try
            {
                uint itemid;
                IVsMultiItemSelect multiItemSelect;

                Marshal.ThrowExceptionForHR(
                    _monitorSelection.GetCurrentSelection(
                        out hierarchyPointer,
                        out itemid,
                        out multiItemSelect,
                        out selectionContainerPointer));

                if (itemid != (uint)VSConstants.VSITEMID.Root)
                {
                    return false;
                }

                var hierarchy = Marshal.GetObjectForIUnknown(hierarchyPointer) as IVsHierarchy;
                if (hierarchy == null)
                {
                    return false;
                }

                object extensibilityObject;
                object targetFrameworkVersion;
                object targetFrameworkMonikerObject;
                Marshal.ThrowExceptionForHR(
                    hierarchy.GetProperty((uint)VSConstants.VSITEMID.Root, (int)__VSHPROPID.VSHPROPID_ExtObject, out extensibilityObject));
                Marshal.ThrowExceptionForHR(
                    hierarchy.GetProperty((uint)VSConstants.VSITEMID.Root, (int)__VSHPROPID3.VSHPROPID_TargetFrameworkVersion, out targetFrameworkVersion));
                Marshal.ThrowExceptionForHR(
                    hierarchy.GetProperty((uint)VSConstants.VSITEMID.Root, (int)__VSHPROPID4.VSHPROPID_TargetFrameworkMoniker, out targetFrameworkMonikerObject));

                string targetFrameworkMoniker = targetFrameworkMonikerObject as string;
                frameworkName = new System.Runtime.Versioning.FrameworkName(targetFrameworkMoniker);

                project = extensibilityObject as EnvDTE.Project;
                return true;
            }
            finally
            {
                if (hierarchyPointer != IntPtr.Zero)
                {
                    Marshal.Release(hierarchyPointer);
                }

                if (selectionContainerPointer != IntPtr.Zero)
                {
                    Marshal.Release(selectionContainerPointer);
                }
            }
        }
コード例 #23
0
 void _windowEvents_WindowActivated(EnvDTE.Window GotFocus, EnvDTE.Window LostFocus) {
     if(IsInDebugLayout()) {
         _scheduler.Stop();
     } else {
         _scheduler.Start();
     }
 }
コード例 #24
0
 public void FireOnBuildDone(EnvDTE.vsBuildScope scope, EnvDTE.vsBuildAction action)
 {
     if (OnBuildDone != null)
     {
         OnBuildDone(scope, action);
     }
 }
コード例 #25
0
        private static bool ShouldExpand(EnvDTE.UIHierarchyItem item, CollapseOptions options)
        {
            var solution = item.Object as EnvDTE.Solution;
            if (solution != null)
            {
                // Solution
                return false;
            }

            var project = item.Object as EnvDTE.Project;
            if (project != null)
            {
                if (((EnvDTE.Project)item.Object).Kind != EnvDTE80.ProjectKinds.vsProjectKindSolutionFolder)
                {
                    // Project
                    return (options & CollapseOptions.IncludeProjects) == CollapseOptions.IncludeProjects;
                }
                else
                {
                    // Solution Folder
                    return (options & CollapseOptions.IncludeSolutionFolders) == CollapseOptions.IncludeSolutionFolders;
                }
            }

            //var projectItem = item.Object as EnvDTE.ProjectItem;
            //if ((((projectItem != null) && (((EnvDTE.ProjectItem)item.Object).Object is EnvDTE.Project))
            //        && (((EnvDTE.Project)((EnvDTE.ProjectItem)item.Object).Object).Kind != EnvDTE80.ProjectKinds.vsProjectKindSolutionFolder)))
            //{
            //    // Project item
            //    return true;
            //}

            // Project folders or items
            return true;
        }
コード例 #26
0
 public void FireOnBuildBegin(EnvDTE.vsBuildScope scope, EnvDTE.vsBuildAction action)
 {
     if (OnBuildBegin != null)
     {
         OnBuildBegin(scope, action);
     }
 }
コード例 #27
0
        private static ICollection<VsHierarchyItem> GetExpandedProjectHierarchyItems(EnvDTE.Project project)
        {
            VsHierarchyItem projectHierarchyItem = GetHierarchyItemForProject(project);
            IVsUIHierarchyWindow solutionExplorerWindow = GetSolutionExplorerHierarchyWindow();

            if (solutionExplorerWindow == null)
            {
                // If the solution explorer is collapsed since opening VS, this value is null. In such a case, simply exit early.
                return new VsHierarchyItem[0];
            }

            var expandedItems = new List<VsHierarchyItem>();

            // processCallback return values: 
            //     0   continue, 
            //     1   don't recurse into, 
            //    -1   stop
            projectHierarchyItem.WalkDepthFirst(
                fVisible: true, 
                processCallback:
                            (VsHierarchyItem vsItem, object callerObject, out object newCallerObject) =>
                            {
                                newCallerObject = null;
                                if (IsVsHierarchyItemExpanded(vsItem, solutionExplorerWindow))
                                {
                                    expandedItems.Add(vsItem);
                                }
                                return 0;
                            },
                callerObject: null);

            return expandedItems;
        }
コード例 #28
0
ファイル: SolutionProjects.cs プロジェクト: halllo/MTSS12
 private static void AddProjectsRecursive(this List<EnvDTE.Project> list, EnvDTE.Project subProject)
 {
     if (subProject.Kind == ProjectKinds.vsProjectKindSolutionFolder)
         list.AddRange(GetSolutionFolderProjects(subProject));
     else
         list.Add(subProject);
 }
コード例 #29
0
        private static IEnumerable<EnvDTE.ProjectItem> GetSiblings(EnvDTE.ProjectItem item)
        {
            EnvDTE.ProjectItem folder = item.Collection.Parent as EnvDTE.ProjectItem;
            List<EnvDTE.ProjectItem> items = new List<EnvDTE.ProjectItem>();

            while (folder != null)
            {
              if (!folder.Kind.Equals(VSConstants.ItemTypeGuid.PhysicalFolder_string, System.StringComparison.OrdinalIgnoreCase))
              {
                folder = folder.Collection.Parent as EnvDTE.ProjectItem;
              }
              else
              {
                break;
              }
            }

            if (folder != null)
            {
              items.AddRange(folder.ProjectItems.Cast<EnvDTE.ProjectItem>());
            }
            else if (item.ContainingProject != null && item.ContainingProject.ProjectItems != null)
            {
              items.AddRange(item.ContainingProject.ProjectItems.Cast<EnvDTE.ProjectItem>());
            }

            return items.Where(i => i.Kind.Equals(VSConstants.ItemTypeGuid.PhysicalFile_string, System.StringComparison.OrdinalIgnoreCase));
        }
コード例 #30
-1
ファイル: CodeInterface.cs プロジェクト: Rickinio/roslyn
 public EnvDTE.CodeProperty AddProperty(string getterName, string putterName, object type, object position, EnvDTE.vsCMAccess access, object location)
 {
     return FileCodeModel.EnsureEditor(() =>
     {
         return FileCodeModel.AddProperty(LookupNode(), getterName, putterName, type, position, access);
     });
 }