Exemple #1
0
 int IVsSccControlNewSolution.AddNewSolutionToSourceControl()
 {
     try
     {
         OnAddNewSolutionToSourceControl(EventArgs.Empty);
         return(VSErr.S_OK);
     }
     catch (Exception e)
     {
         return(VSErr.GetHRForException(e));
     }
 }
Exemple #2
0
 int IVsSccControlNewSolution.GetDisplayStringForAction(out string pbstrActionName)
 {
     try
     {
         pbstrActionName = GetDisplayStringForAddNewSolutionToSourceControl();
         return(VSErr.S_OK);
     }
     catch (Exception e)
     {
         pbstrActionName = null;
         return(VSErr.GetHRForException(e));
     }
 }
Exemple #3
0
        int IVsSccProvider.SetInactive()
        {
            try
            {
                SetActive(false);
            }
            catch (Exception e)
            {
                return(VSErr.GetHRForException(e));
            }

            return(VSErr.S_OK);
        }
Exemple #4
0
        [CLSCompliant(false)] // Implements 2 interfaces
        public int RegisterSccProject(IVsSccProject2 pscp2Project, string pszSccProjectName, string pszSccAuxPath, string pszSccLocalPath, string pszProvider)
        {
            try
            {
                SccProjectData data;
                ProjectMap.EnsureSccProject(pscp2Project, out data);

                OnRegisterSccProject(data, pszProvider);
                return(VSErr.S_OK);
            }
            catch (Exception e)
            {
                return(VSErr.GetHRForException(e));
            }
        }
Exemple #5
0
        int IVsSccProvider.SetInactive()
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            try
            {
                SetActive(false);
            }
            catch (Exception e)
            {
                return(VSErr.GetHRForException(e));
            }

            return(VSErr.S_OK);
        }
Exemple #6
0
        int IVsSccManagerTooltip.GetGlyphTipText(IVsHierarchy phierHierarchy, uint itemidNode, out string pbstrTooltipText)
        {
            if (phierHierarchy == null)
            {
                pbstrTooltipText = null;
                return(VSErr.E_INVALIDARG);
            }

            try
            {
                pbstrTooltipText = GetGlyphTipText(new SccHierarchy(phierHierarchy), itemidNode);

                return(VSErr.S_OK);
            }
            catch (Exception e)
            {
                pbstrTooltipText = null;
                return(VSErr.GetHRForException(e));
            }
        }
Exemple #7
0
        [CLSCompliant(false)] // Implements 2 interfaces
        public int UnregisterSccProject(IVsSccProject2 pscp2Project)
        {
            try
            {
                SccProjectData data;

                // Don't use Ensure here, as this function is commonly called *after*
                // the project is closed (during disposing)

                if (ProjectMap.TryGetSccProject(pscp2Project, out data))
                {
                    OnUnregisterSccProject(data);
                }

                return(VSErr.S_OK);
            }
            catch (Exception e)
            {
                return(VSErr.GetHRForException(e));
            }
        }
        [CLSCompliant(false)] // Implements 2 interfaces
        public int GetSccGlyph(int cFiles, string[] rgpszFullPaths, VsStateIcon[] rgsiGlyphs, uint[] rgdwSccStatus)
        {
            try
            {
                if (rgpszFullPaths == null || rgsiGlyphs == null)
                {
                    return(VSErr.E_POINTER); // Documented as impossible
                }
                if (!IsActive)
                {
                    for (int i = 0; i < cFiles; i++)
                    {
                        if (rgsiGlyphs != null)
                        {
                            rgsiGlyphs[i] = VsStateIcon.STATEICON_NOSTATEICON;
                        }
                        if (rgdwSccStatus != null)
                        {
                            rgdwSccStatus[i] = (uint)SccStatus.SCC_STATUS_NOTCONTROLLED;
                        }
                    }
                    return(VSErr.S_OK);
                }

                for (int i = 0; i < cFiles; i++)
                {
                    string file = rgpszFullPaths[i];
                    if (!IsSafeSccPath(file))
                    {
                        rgsiGlyphs[i] = VsStateIcon.STATEICON_BLANK;
                        if (rgdwSccStatus != null)
                        {
                            rgdwSccStatus[i] = (uint)SccStatus.SCC_STATUS_NOTCONTROLLED;
                        }
                        continue;
                    }

                    AnkhGlyph glyph = GetPathGlyph(file);

                    if (rgsiGlyphs != null)
                    {
                        VsStateIcon icon = (VsStateIcon)glyph;

                        if (icon == VsStateIcon.STATEICON_BLANK || icon == VsStateIcon.STATEICON_NOSTATEICON)
                        {
                            rgsiGlyphs[i] = icon;
                        }
                        else
                        {
                            rgsiGlyphs[i] = (VsStateIcon)((int)icon + _glyphOffset);
                        }
                    }

                    if (rgdwSccStatus != null)
                    {
                        // This will make VS use the right texts on refactor, replace, etc.
                        rgdwSccStatus[i] = GlyphToStatus(glyph);
                    }
                }

                return(VSErr.S_OK);
            }
            catch (Exception e)
            {
                return(VSErr.GetHRForException(e));
            }
        }