public static void AddHierarchyItem(this ErrorTask task)
        {
            IVsHierarchy hierarchyItem = null;
            IVsSolution  solution      = EditorExtensionsPackage.GetGlobalService <IVsSolution>(typeof(SVsSolution));
            Project      project       = ProjectHelpers.GetActiveProject();

            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;
                }
            }
        }
        public void AddHierarchyItem(ErrorTask task)
        {
            IVsHierarchy HierarchyItem;
            IVsSolution  solution = EditorExtensionsPackage.GetGlobalService <IVsSolution>(typeof(SVsSolution));

            if (solution != null)
            {
                int flag = solution.GetProjectOfUniqueName(_connection.Project.FullName, out HierarchyItem);

                if (0 == flag)
                {
                    task.HierarchyItem = HierarchyItem;
                }
            }
        }
Example #3
0
        public static void AddHierarchyItem(this ErrorTask task)
        {
            IVsHierarchy HierarchyItem;
            IVsSolution  solution = EditorExtensionsPackage.GetGlobalService <IVsSolution>(typeof(SVsSolution));
            Project      project  = ProjectHelpers.GetActiveProject();

            if (solution != null && project != null)
            {
                int flag = solution.GetProjectOfUniqueName(project.FullName, out HierarchyItem);

                if (0 == flag)
                {
                    task.HierarchyItem = HierarchyItem;
                }
            }
        }
Example #4
0
        public void AddHierarchyItem(ErrorTask task)
        {
            if (task == null || Connection == null || Connection.Project == null || string.IsNullOrEmpty(Connection.Project.FullName))
            {
                return;
            }

            IVsHierarchy HierarchyItem;
            IVsSolution  solution = EditorExtensionsPackage.GetGlobalService <IVsSolution>(typeof(SVsSolution));

            if (solution != null)
            {
                int flag = solution.GetProjectOfUniqueName(Connection.Project.FullName, out HierarchyItem);

                if (0 == flag)
                {
                    task.HierarchyItem = HierarchyItem;
                }
            }
        }
Example #5
0
        public static void OpenFileInPreviewTab(string file)
        {
            IVsNewDocumentStateContext newDocumentStateContext = null;

            try
            {
                IVsUIShellOpenDocument3 openDoc3 = EditorExtensionsPackage.GetGlobalService <SVsUIShellOpenDocument>() as IVsUIShellOpenDocument3;

                Guid reason = VSConstants.NewDocumentStateReason.Navigation;
                newDocumentStateContext = openDoc3.SetNewDocumentState((uint)__VSNEWDOCUMENTSTATE.NDS_Provisional, ref reason);

                EditorExtensionsPackage.DTE.ItemOperations.OpenFile(file);
            }
            finally
            {
                if (newDocumentStateContext != null)
                {
                    newDocumentStateContext.Restore();
                }
            }
        }
        private static void GetSize()
        {
            try
            {
                IVsFontAndColorStorage storage = (IVsFontAndColorStorage)EditorExtensionsPackage.GetGlobalService(typeof(IVsFontAndColorStorage));
                var guid = new Guid("A27B4E24-A735-4d1d-B8E7-9716E1E3D8E0");
                if (storage != null && storage.OpenCategory(ref guid, (uint)(__FCSTORAGEFLAGS.FCSF_READONLY | __FCSTORAGEFLAGS.FCSF_LOADDEFAULTS)) == VS.VSConstants.S_OK)
                {
                    LOGFONTW[] Fnt  = new LOGFONTW[] { new LOGFONTW() };
                    FontInfo[] Info = new FontInfo[] { new FontInfo() };
                    storage.GetFont(Fnt, Info);
                    _fontSize = (int)Info[0].wPointSize;
                }

                if (storage != null && storage.OpenCategory(ref guid, (uint)(__FCSTORAGEFLAGS.FCSF_NOAUTOCOLORS | __FCSTORAGEFLAGS.FCSF_LOADDEFAULTS)) == VS.VSConstants.S_OK)
                {
                    var info = new ColorableItemInfo[1];
                    storage.GetItem("Plain Text", info);
                    _backgroundColor = ConvertFromWin32Color((int)info[0].crBackground);
                }
            }
            catch { }
        }
 public static IComponentModel GetComponentModel()
 {
     return((IComponentModel)EditorExtensionsPackage.GetGlobalService(typeof(SComponentModel)));
 }