Example #1
0
        public static void AddHierarchyItem(this ErrorTask task)
        {
            IVsHierarchy hierarchyItem = null;
            IVsSolution  solution      = WebEssentialsPackage.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;
                }
            }
        }
Example #2
0
        public void AddHierarchyItem(ErrorTask task)
        {
            if (task == null || Connection == null || Connection.Project == null || string.IsNullOrEmpty(Connection.Project.FullName))
            {
                return;
            }

            IVsHierarchy HierarchyItem;
            IVsSolution  solution = WebEssentialsPackage.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 OpenFileInPreviewTab(string file)
        {
            IVsNewDocumentStateContext newDocumentStateContext = null;

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

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

                WebEssentialsPackage.DTE.ItemOperations.OpenFile(file);
            }
            finally
            {
                if (newDocumentStateContext != null)
                {
                    newDocumentStateContext.Restore();
                }
            }
        }
Example #4
0
        private static void GetSize()
        {
            try
            {
                IVsFontAndColorStorage storage = (IVsFontAndColorStorage)WebEssentialsPackage.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 { }
        }
Example #5
0
 public static IComponentModel GetComponentModel()
 {
     return((IComponentModel)WebEssentialsPackage.GetGlobalService(typeof(SComponentModel)));
 }
Example #6
0
 static ImageHelper()
 {
     _imageService = WebEssentialsPackage.GetGlobalService(typeof(SVsImageService)) as IVsImageService2;
 }