Esempio n. 1
0
        private void HandleActionOnPluginTypesCommandInternal(ConnectionData connectionData, CommonConfiguration commonConfig, IEnumerable <SelectedFile> selectedFiles, ActionOnComponent actionOnComponent, string fieldName, string fieldTitle)
        {
            if (!selectedFiles.Any())
            {
                return;
            }

            this.ActivateOutputWindow(connectionData);

            this.WriteToOutput(connectionData, Properties.OutputStrings.GettingClassTypeFullNameFromFilesFormat, selectedFiles.Count().ToString());

            List <string> pluginTypeNames = new List <string>();

            var table = new FormatTextTableHandler();

            table.SetHeader("File", "Type.FullName");

            foreach (var selectedFile in selectedFiles.OrderBy(f => f.FileName))
            {
                string pluginType = CSharpCodeHelper.GetClassInFileBySyntaxTree(selectedFile.FilePath);

                table.AddLine(selectedFile.FilePath, pluginType);

                pluginTypeNames.Add(pluginType);
            }

            StringBuilder stringBuilder = new StringBuilder();

            table.GetFormatedLines(false).ForEach(s => stringBuilder.AppendLine(s));

            this.WriteToOutput(connectionData, stringBuilder.ToString());

            Controller.StartActionOnPluginTypes(connectionData, commonConfig, pluginTypeNames, actionOnComponent, fieldName, fieldTitle);
        }
Esempio n. 2
0
        private void HandleAddPluginStepInternal(ConnectionData connectionData, CommonConfiguration commonConfig, SelectedFile selectedFile)
        {
            string pluginType = CSharpCodeHelper.GetClassInFileBySyntaxTree(selectedFile.FilePath);

            this.WriteToOutput(connectionData, Properties.OutputStrings.GettingClassTypeFullNameFromFileFormat2, selectedFile.FilePath, pluginType);
            this.ActivateOutputWindow(connectionData);

            this.Controller.StartAddPluginStep(connectionData, commonConfig, pluginType);
        }
Esempio n. 3
0
        private void HandleGetPluginTypeOpenPluginTypeExplorerInternal(ConnectionData connectionData, CommonConfiguration commonConfig, SelectedFile selectedFile)
        {
            string pluginType = string.Empty;

            if (selectedFile != null)
            {
                pluginType = CSharpCodeHelper.GetClassInFileBySyntaxTree(selectedFile.FilePath);

                this.WriteToOutput(connectionData, Properties.OutputStrings.GettingClassTypeFullNameFromFileFormat2, selectedFile.FilePath, pluginType);
                this.ActivateOutputWindow(connectionData);
            }

            Controller.StartOpenPluginTypeExplorer(connectionData, commonConfig, pluginType);
        }
        private static string GetTypeFullName(ProjectItem item)
        {
            string fileType = string.Empty;

            VSProject2 proj = item.ContainingProject?.Object as VSProject2;

            if (item != null && item.FileCount > 0 && proj != null)
            {
                fileType = CSharpCodeHelper.GetFileTypeFullName(item.FileNames[1], proj);
            }
            else if (item != null && item.FileCount > 0)
            {
                fileType = item.Name.Split('.').FirstOrDefault();
            }

            return(fileType);
        }
        private static string GetTypeFullName(EnvDTE.Document document)
        {
            if (document == null)
            {
                return(string.Empty);
            }

            string fileType = string.Empty;

            VSProject2 proj = document?.ProjectItem?.ContainingProject?.Object as VSProject2;

            if (proj != null)
            {
                fileType = CSharpCodeHelper.GetFileTypeFullName(document.FullName, proj);
            }

            if (string.IsNullOrEmpty(fileType))
            {
                fileType = Path.GetFileNameWithoutExtension(document.FullName).Split('.').FirstOrDefault();
            }

            return(fileType);
        }