Microsoft.VisualStudio.Project.FolderNode.ShowFileOrFolderAlreadExistsErrorMessage C# (CSharp) Method

ShowFileOrFolderAlreadExistsErrorMessage() protected method

Show error message if not in automation mode, otherwise throw exception
protected ShowFileOrFolderAlreadExistsErrorMessage ( string newPath ) : int
newPath string path of file or folder already existing on disk
return int
        protected virtual int ShowFileOrFolderAlreadExistsErrorMessage(string newPath)
        {
            //A file or folder with the name '{0}' already exists on disk at this location. Please choose another name.
            //If this file or folder does not appear in the Solution Explorer, then it is not currently part of your project. To view files which exist on disk, but are not in the project, select Show All Files from the Project menu.
            string errorMessage = (String.Format(CultureInfo.CurrentCulture, SR.GetString(SR.FileOrFolderAlreadyExists, CultureInfo.CurrentUICulture), newPath));
            if(!Utilities.IsInAutomationFunction(this.ProjectManager.Site))
            {
                string title = null;
                OLEMSGICON icon = OLEMSGICON.OLEMSGICON_CRITICAL;
                OLEMSGBUTTON buttons = OLEMSGBUTTON.OLEMSGBUTTON_OK;
                OLEMSGDEFBUTTON defaultButton = OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST;
                VsShellUtilities.ShowMessageBox(this.ProjectManager.Site, title, errorMessage, icon, buttons, defaultButton);
                return VSConstants.S_OK;
            }
            else
            {
                throw new InvalidOperationException(errorMessage);
            }
        }