public void CreateFileWithinProject([NotNull] TestCopProjectItem projectItem, [NotNull] string targetFile)
        {
            var desiredTemplateName = LookupTemplateName(projectItem.Project);
            var boundSettingsStore  = _settingsStore.BindToContextTransient(ContextRange.ApplicationWide);

            var context = _dataContexts.CreateOnActiveControl(_lifetime);

            var applicableFileTemplateScopes = _scopeManager.EnumerateRealScopePoints(new TemplateAcceptanceContext(new ProjectFolderWithLocation(projectItem.Project)));

            applicableFileTemplateScopes = applicableFileTemplateScopes.Distinct().Where(s => s is InLanguageSpecificProject).ToList();

            var classTemplate = _storedTemplatesProvider.EnumerateTemplates(boundSettingsStore, TemplateApplicability.File)
                                .Where(x => x.Description == desiredTemplateName &&
                                       TemplateScopeManager.TemplateIsAvailable(x, applicableFileTemplateScopes))
                                .Select(x => x)
                                .FirstOrDefault();

            if (classTemplate == null)
            {
                ResharperHelper.AppendLineToOutputWindow(string.Format("File Template for '{0}' not found with default to 'Class'", desiredTemplateName));
                classTemplate = LoadTemplateFromQuickList(context, "Class");
            }
            IProjectFolder folder = (IProjectFolder)projectItem.Project.FindProjectItemByLocation(projectItem.SubNamespaceFolder)
                                    ?? GetOrCreateProjectFolder(projectItem);

            if (folder == null)
            {
                ResharperHelper.AppendLineToOutputWindow("Error failed to create/location project folder" + projectItem.SubNamespaceFolder);
                return;
            }

            string extension = Enumerable.First(_fileExtensions.GetExtensions(projectItem.Project.ProjectProperties.DefaultLanguage.DefaultProjectFileType));

            FileTemplatesManager.Instance.CreateFileFromTemplate(targetFile + extension, new ProjectFolderWithLocation(folder), classTemplate);
        }
        protected override bool ExecuteItem(JetPopupMenuItem item)
        {
            var occurence = item.Key as IOccurence;

            using (CommitCookie.Commit(Solution))
            {
                var elementOccurence = occurence as DeclaredElementOccurence;
                if (elementOccurence != null)
                {
                    var validDeclaredElement = elementOccurence.DisplayElement.GetValidDeclaredElement();
                    if (validDeclaredElement != null)
                    {
                        var action = new FindUsagesOfElementAction(validDeclaredElement);
                        threading.ExecuteOrQueue("FindUsagesOfSymbolController",
                                                 () => Lifetimes.Using(lifetime => action.Execute(dataContexts.CreateOnActiveControl(lifetime), () => { })));
                        return(true);
                    }
                }

                return(false);
            }
        }