Esempio n. 1
0
        //------------------------------------------------------------------------------------------------------------------------
        private static IList <SimpleMenuItem> DescribeFilesAssociatedWithDeclaredElement(Lifetime lifetime, DocumentManager documentManager, IClrDeclaredElement declaredElement, Func <IProjectFile, Action> clickAction)
        {
            IList <SimpleMenuItem> menuItems = new List <SimpleMenuItem>();

            var projectFiles = GetProjectFiles(documentManager, declaredElement);

            foreach (var projectFile in projectFiles)
            {
                IProjectFile currentProjectFile = projectFile;
                var          np = new ProjectFileNavigationPoint(currentProjectFile);

                var result = new SimpleMenuItemForProjectItem(np.GetPresentationText()
                                                              , np.GetPresentationImage()
                                                              , ResharperHelper.ProtectActionFromReEntry(lifetime, "TestingMenuNavigation", clickAction.Invoke(projectFile))
                                                              , projectFile, declaredElement
                                                              );

                result.ShortcutText = np.GetSecondaryPresentationText();
                result.Style        = MenuItemStyle.Enabled;
                result.Tag          = projectFile.Location.FullPath;

                menuItems.Add(result);
            }
            return(menuItems);
        }
Esempio n. 2
0
        //------------------------------------------------------------------------------------------------------------------------
        private static List <SimpleMenuItem> AddCreateFileMenuItem(Lifetime lifetime, TestCopProjectItem projectItem, string targetFile)
        {
            var menuItems = new List <SimpleMenuItem>();

            var result = new SimpleMenuItem("Create associated file"
                                            , null,
                                            ResharperHelper.ProtectActionFromReEntry(lifetime, "TestingMenuNavigation",
                                                                                     () =>
                                                                                     ResharperHelper.CreateFileWithinProject(projectItem, targetFile)));

            result.Style        = MenuItemStyle.Enabled;
            result.Icon         = UnnamedThemedIcons.Agent16x16.Id;
            result.Text         = new RichText("Create ", TextStyle.FromForeColor(Color.Green)).Append(targetFile, TextStyle.FromForeColor(TextStyle.DefaultForegroundColor));
            result.ShortcutText = new RichText("(" + projectItem.Project.GetPresentableProjectPath()
                                               +
                                               projectItem.SubNamespaceFolder.FullPath.RemoveLeading(
                                                   projectItem.Project.ProjectFileLocation.Directory.FullPath) + ")",
                                               TextStyle.FromForeColor(Color.LightGray));
            menuItems.Add(result);
            return(menuItems);
        }