Example #1
0
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void MenuItemCallback(object sender, EventArgs e)
        {
            var selectedItemPaths = _solutionSelectionService.GetSelectedItemsPaths();

            var allPaths = _innerPathFinder.GetAllInnerPaths(selectedItemPaths);

            if (!allPaths.Any())
            {
                return;
            }

            var basePath = GetSolutionPath(allPaths[0]);

            allPaths.ToList().ForEach(f => FixNamespace(f, basePath));
        }
Example #2
0
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void MenuItemCallback(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            try
            {
                var selectedItemPaths = _solutionSelectionService.GetSelectedItemsPaths();

                var allPaths = _innerPathFinder.GetAllInnerPaths(selectedItemPaths);

                if (!allPaths.Any())
                {
                    return;
                }

                var projectFile  = ProjectHelper.GetProjectFilePath(allPaths[0]);
                var solutionFile = ProjectHelper.GetSolutionFilePath(projectFile.Directory.FullName);

                _namespaceBuilder = NamespaceBuilderFactory.CreateNamespaceBuilderService(projectFile.Extension, _options);

                allPaths.ToList().ForEach(f => FixNamespace(f, solutionFile, projectFile));
            }
            finally
            {
                MsBuildEvaluationHelper.ClearCache();
            }
        }
Example #3
0
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void MenuItemCallback(object sender, EventArgs e)
        {
            var selectedItemPaths = _solutionSelectionService.GetSelectedItemsPaths();

            var allPaths = _innerPathFinder.GetAllInnerPaths(selectedItemPaths);

            if (!allPaths.Any())
            {
                return;
            }

            var projectFile  = GetProjectFilePath(allPaths[0]);
            var solutionFile = GetSolutionFilePath(projectFile.Directory.FullName);

            allPaths.ToList().ForEach(f => FixNamespace(f, solutionFile, projectFile));
        }