예제 #1
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();
            var dllPath = Assembly.GetExecutingAssembly().Location;

            this.authManager                 = new AuthenticationManager();
            this.arasDataProvider            = new ArasDataProvider(authManager);
            this.dialogFactory               = new DialogFactory(authManager, arasDataProvider);
            this.projectConfigurationManager = new ProjectConfigurationManager();
            this.projectManager              = new ProjectManager(this, dialogFactory);
            this.defaultCodeProvider         = new DefaultCodeProvider();
            this.codeProviderFactory         = new CodeProviderFactory(projectManager, defaultCodeProvider);

            Commands.OpenFromArasCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory);
            Commands.OpenFromPackageCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory);
            Commands.CreateMethodCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory);
            Commands.SaveToArasCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory);
            Commands.SaveToPackageCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory);
            Commands.UpdateMethodCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory);
            Commands.ConnectionInfoCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager);
            Commands.CreatePartialElementCmd.Initialize(projectManager, dialogFactory, projectConfigurationManager, codeProviderFactory);
            Commands.RefreshConfigCmd.Initialize(projectManager, dialogFactory, projectConfigurationManager);
            Commands.DebugMethodCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory);

            var dte = (DTE)this.GetService(typeof(DTE));

            this.projectItemsEvents = dte.Events.GetObject("CSharpProjectItemsEvents") as ProjectItemsEvents;
            if (this.projectItemsEvents != null)
            {
                this.projectItemsEvents.ItemRemoved += this.ProjectItemsEvents_ItemRemoved;
                this.projectItemsEvents.ItemRenamed += this.ProjectItemsEvents_ItemRenamed;
            }
        }
예제 #2
0
        private OpenFromPackageCmd(IProjectManager projectManager, IAuthenticationManager authManager, IDialogFactory dialogFactory, IProjectConfigurationManager projectConfigurationManager, ICodeProviderFactory codeProviderFactory)
            : base(projectManager, dialogFactory, projectConfigurationManager)
        {
            if (authManager == null)
            {
                throw new ArgumentNullException(nameof(authManager));
            }
            if (projectConfigurationManager == null)
            {
                throw new ArgumentNullException(nameof(projectConfigurationManager));
            }
            if (codeProviderFactory == null)
            {
                throw new ArgumentNullException(nameof(codeProviderFactory));
            }

            this.authManager         = authManager;
            this.codeProviderFactory = codeProviderFactory;

            if (projectManager.CommandService != null)
            {
                var menuCommandID = new CommandID(CommandSet, CommandId);
                var menuItem      = new OleMenuCommand(this.ExecuteCommand, menuCommandID);
                menuItem.BeforeQueryStatus += CheckCommandAccessibility;

                projectManager.CommandService.AddCommand(menuItem);
            }
        }
예제 #3
0
        public void Init()
        {
            projectManager = Substitute.For <IProjectManager>();
            projectConfigurationManager = new ProjectConfigurationManager();
            dialogFactory       = Substitute.For <IDialogFactory>();
            authManager         = new AuthManagerStub();
            codeProviderFactory = Substitute.For <ICodeProviderFactory>();
            globalConfiguration = Substitute.For <IGlobalConfiguration>();;
            CreateMethodCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, globalConfiguration);
            createMethodCmd = CreateMethodCmd.Instance;
            iVsUIShell      = Substitute.For <IVsUIShell>();
            var currentPath = AppDomain.CurrentDomain.BaseDirectory;

            projectManager.ProjectConfigPath.Returns(Path.Combine(currentPath, "TestData\\projectConfig.xml"));
            projectManager.MethodConfigPath.Returns(Path.Combine(currentPath, "TestData\\method-config.xml"));
            template = new TemplateInfo {
                TemplateName = string.Empty
            };
            eventSpecificDataType = new EventSpecificDataType {
                EventSpecificData = EventSpecificData.None
            };
            templateLoader       = new TemplateLoader(dialogFactory);
            packageManager       = new PackageManager(authManager);
            codeProvider         = Substitute.For <ICodeProvider>();
            projectConfiguration = projectConfigurationManager.Load(projectManager.ProjectConfigPath);
            templateLoader.Load(projectManager.MethodConfigPath);
            codeProviderFactory.GetCodeProvider(null, null).ReturnsForAnyArgs(codeProvider);
        }
예제 #4
0
 public AuthenticationCommandBaseTest(IAuthenticationManager authManager,
                                      IDialogFactory dialogFactory,
                                      IProjectManager projectManager,
                                      IProjectConfigurationManager projectConfigurationManager,
                                      ICodeProviderFactory codeProviderFactory)
     : base(authManager, dialogFactory, projectManager, projectConfigurationManager, codeProviderFactory)
 {
 }
예제 #5
0
        public void Setup()
        {
            this.projectManager = Substitute.For <IProjectManager>();
            this.dialogFactory  = Substitute.For <IDialogFactory>();
            this.projectConfigurationManager = Substitute.For <IProjectConfigurationManager>();
            this.codeProviderFactory         = Substitute.For <ICodeProviderFactory>();

            CreateCodeItemCmd.Initialize(this.projectManager, this.dialogFactory, this.projectConfigurationManager, this.codeProviderFactory);
            createCodeItemCmd = CreateCodeItemCmd.Instance;
        }
예제 #6
0
        public void Init()
        {
            authManager = Substitute.For <IAuthenticationManager>();
            projectConfigurationManager = Substitute.For <IProjectConfigurationManager>();
            dialogFactory                 = Substitute.For <IDialogFactory>();
            projectManager                = Substitute.For <IProjectManager>();
            codeProviderFactory           = Substitute.For <ICodeProviderFactory>();
            authenticationCommandBaseTest = new AuthenticationCommandBaseTest(authManager, dialogFactory, projectManager, projectConfigurationManager, codeProviderFactory);
            var projectConfiguraiton = Substitute.For <IProjectConfiguraiton>();

            projectConfigurationManager.Load(projectManager.ProjectConfigPath).Returns(projectConfiguraiton);
            projectConfiguraiton.Connections.Returns(Substitute.For <List <ConnectionInfo> >());
        }
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override async System.Threading.Tasks.Task InitializeAsync(System.Threading.CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            await base.InitializeAsync(cancellationToken, progress);

            // When initialized asynchronously, we *may* be on a background thread at this point.
            // Do any initialization that requires the UI thread after switching to the UI thread.
            // Otherwise, remove the switch to the UI thread if you don't need it.
            await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            IVisualStudioServiceProvider serviceProvider = new VisualStudioServiceProvider(this);

            this.messageManager = new VisualStudioMessageManager();
            this.iOWrapper      = new IOWrapper();
            this.projectConfigurationManager = new ProjectConfigurationManager(this.messageManager);
            this.vsPackageWrapper            = new VsPackageWrapper();
            this.projectManager   = new ProjectManager(serviceProvider, iOWrapper, vsPackageWrapper, messageManager, projectConfigurationManager);
            this.authManager      = new AuthenticationManager(messageManager, projectManager);
            this.arasDataProvider = new ArasDataProvider(authManager, messageManager);
            this.dialogFactory    = new DialogFactory(authManager, arasDataProvider, serviceProvider, iOWrapper, messageManager);
            ICodeFormatter codeFormatter = new VisualStudioCodeFormatter(this.projectManager);

            this.codeProviderFactory = new CodeProviderFactory(codeFormatter, messageManager, iOWrapper);
            this.globalConfiguration = new GlobalConfiguration(iOWrapper);
            this.projectUpdater      = new ProjectUpdater(this.iOWrapper);
            this.eventListener       = new EventListener(projectManager, projectUpdater, projectConfigurationManager, iOWrapper);
            this.openContextParser   = new OpenContextParser();
            this.methodOpener        = new MethodOpener(projectManager, dialogFactory, openContextParser, messageManager);

            Commands.OpenFromArasCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.OpenFromPackageCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.CreateMethodCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, globalConfiguration, messageManager);
            Commands.SaveToArasCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.SaveToPackageCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.UpdateMethodCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.ConnectionInfoCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, messageManager);
            Commands.CreateCodeItemCmd.Initialize(projectManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.RefreshConfigCmd.Initialize(projectManager, dialogFactory, projectConfigurationManager, messageManager);
            Commands.DebugMethodCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.MoveToCmd.Initialize(projectManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.ImportOpenInVSActionCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);

            this.eventListener.StartListening();

            IVsAppCommandLine cmdLine = await GetServiceAsync(typeof(SVsAppCommandLine)) as IVsAppCommandLine;

            ErrorHandler.ThrowOnFailure(cmdLine.GetOption(OpenInVSConstants.ProtocolName, out int isPresent, out string openMethodRequest));
            if (isPresent == 1)
            {
                methodOpener.OpenMethodFromAras(openMethodRequest);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CreateCodeItemCmd"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        private CreateCodeItemCmd(IProjectManager projectManager, IDialogFactory dialogFactory, IProjectConfigurationManager projectConfigurationManager, ICodeProviderFactory codeProviderFactory, MessageManager messageManager)
            : base(projectManager, dialogFactory, projectConfigurationManager, messageManager)
        {
            this.codeProviderFactory = codeProviderFactory ?? throw new ArgumentNullException(nameof(codeProviderFactory));

            if (projectManager.CommandService != null)
            {
                var menuCommandID = new CommandID(CommandSet, CommandId);
                var menuItem      = new OleMenuCommand(this.ExecuteCommand, menuCommandID);
                menuItem.BeforeQueryStatus += CheckCommandAccessibility;

                projectManager.CommandService.AddCommand(menuItem);
            }
        }
        public void Init()
        {
            projectManager = Substitute.For <IProjectManager>();
            projectConfigurationManager = Substitute.For <ProjectConfigurationManager>();
            dialogFactory       = Substitute.For <IDialogFactory>();
            authManager         = new AuthManagerStub();
            codeProviderFactory = Substitute.For <ICodeProviderFactory>();
            codeProvider        = Substitute.For <ICodeProvider>();
            codeProviderFactory.GetCodeProvider(null).ReturnsForAnyArgs(codeProvider);
            iVsUIShell = Substitute.For <IVsUIShell>();
            var currentPath = AppDomain.CurrentDomain.BaseDirectory;

            projectManager.ProjectConfigPath.Returns(Path.Combine(currentPath, "TestData\\projectConfig.xml"));
            projectConfigurationManager.Load(projectManager.ProjectConfigPath);
            projectManager.MethodName.Returns("TestMethod");
            projectManager.MethodPath.Returns(Path.Combine(currentPath, "TestData\\TestMethod.txt"));
            messageManager = Substitute.For <MessageManager>();
            DebugMethodCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            debugMethodCmd = DebugMethodCmd.Instance;

            var project    = Substitute.For <Project>();
            var properties = Substitute.For <EnvDTE.Properties>();
            var property   = Substitute.For <Property>();
            var propertiesForActiveConfigurations = Substitute.For <EnvDTE.Properties>();
            var propertyForActiveConfiguration    = Substitute.For <Property>();
            var configurationManager = Substitute.For <ConfigurationManager>();
            var activeConfigurator   = Substitute.For <Configuration>();

            projectManager.SelectedProject.Returns(project);
            project.FileName.Returns(currentPath);
            project.Properties.Returns(properties);
            properties.Item(Arg.Any <string>()).Returns(property);
            property.Value = "";

            project.ConfigurationManager.Returns(configurationManager);
            configurationManager.ActiveConfiguration.Returns(activeConfigurator);
            activeConfigurator.Properties.Returns(propertiesForActiveConfigurations);
            propertiesForActiveConfigurations.Item(Arg.Any <string>()).Returns(propertyForActiveConfiguration);
            propertyForActiveConfiguration.Value = "";
            projectManager.When(x => x.AttachToProcess(Arg.Any <System.Diagnostics.Process>())).Do(x => { });
            var codeModel = Substitute.For <CodeModel>();

            project.CodeModel.Returns(codeModel);
            codeModel.Language.Returns("");
        }
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override async System.Threading.Tasks.Task InitializeAsync(System.Threading.CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            await base.InitializeAsync(cancellationToken, progress);

            // When initialized asynchronously, we *may* be on a background thread at this point.
            // Do any initialization that requires the UI thread after switching to the UI thread.
            // Otherwise, remove the switch to the UI thread if you don't need it.
            await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            IVisualStudioServiceProvider serviceProvider = new VisualStudioServiceProvider(this);

            this.messageManager = new VisualStudioMessageManager();
            this.iOWrapper      = new IOWrapper();
            this.projectConfigurationManager = new ProjectConfigurationManager();
            this.vsPackageWrapper            = new VsPackageWrapper();
            this.projectManager   = new ProjectManager(serviceProvider, iOWrapper, vsPackageWrapper, messageManager, projectConfigurationManager);
            this.authManager      = new AuthenticationManager(messageManager, projectManager);
            this.arasDataProvider = new ArasDataProvider(authManager, messageManager);
            this.dialogFactory    = new DialogFactory(authManager, arasDataProvider, serviceProvider, iOWrapper, messageManager);
            ICodeFormatter codeFormatter = new VisualStudioCodeFormatter(this.projectManager);

            this.codeProviderFactory = new CodeProviderFactory(codeFormatter, messageManager, iOWrapper);
            this.globalConfiguration = new GlobalConfiguration(iOWrapper);

            Commands.OpenFromArasCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.OpenFromPackageCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.CreateMethodCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, globalConfiguration, messageManager);
            Commands.SaveToArasCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.SaveToPackageCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.UpdateMethodCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.ConnectionInfoCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, messageManager);
            Commands.CreateCodeItemCmd.Initialize(projectManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.RefreshConfigCmd.Initialize(projectManager, dialogFactory, projectConfigurationManager, messageManager);
            Commands.DebugMethodCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.MoveToCmd.Initialize(projectManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);

            var dte = (DTE)serviceProvider.GetService(typeof(DTE));

            this.projectItemsEvents = dte.Events.GetObject("CSharpProjectItemsEvents") as ProjectItemsEvents;
            if (this.projectItemsEvents != null)
            {
                this.projectItemsEvents.ItemRemoved += this.ProjectItemsEvents_ItemRemoved;
                this.projectItemsEvents.ItemRenamed += this.ProjectItemsEvents_ItemRenamed;
            }
        }
예제 #11
0
        public void Init()
        {
            projectManager = Substitute.For <IProjectManager>();
            projectConfigurationManager = Substitute.For <ProjectConfigurationManager>();
            dialogFactory       = Substitute.For <IDialogFactory>();
            codeProviderFactory = Substitute.For <ICodeProviderFactory>();
            CreatePartialElementCmd.Initialize(projectManager, dialogFactory, projectConfigurationManager, codeProviderFactory);
            createPartialElementCmd = CreatePartialElementCmd.Instance;
            iVsUIShell = Substitute.For <IVsUIShell>();
            var currentPath = AppDomain.CurrentDomain.BaseDirectory;

            projectManager.ProjectConfigPath.Returns(Path.Combine(currentPath, "TestData\\projectConfig.xml"));
            projectManager.MethodName.Returns("TestMethod");
            projectConfiguration = projectConfigurationManager.Load(projectManager.ProjectConfigPath);
            projectConfiguration.UseVSFormatting = false;
            codeProvider = Substitute.For <ICodeProvider>();
            codeProviderFactory.GetCodeProvider(null, null).ReturnsForAnyArgs(codeProvider);
        }
예제 #12
0
		public CodePreviewDialog(IActiveRecordDescriptor descriptor) : this()
		{
			codeproviderFactory = 
				ServiceRegistry.Instance[ typeof(ICodeProviderFactory) ] as ICodeProviderFactory;
			ICodeDomGenerator codeDomGen = 
				ServiceRegistry.Instance[ typeof(ICodeDomGenerator) ] as ICodeDomGenerator;

			typeDecl = codeDomGen.Generate(descriptor);

			language.ValueMember = "Label";

			foreach(CodeProviderInfo info in codeproviderFactory.GetAvailableProviders())
			{
				language.Items.Add(info);
			}

			language.SelectedIndex = 0;
		}
예제 #13
0
        public CodePreviewDialog(IActiveRecordDescriptor descriptor) : this()
        {
            codeproviderFactory =
                ServiceRegistry.Instance[typeof(ICodeProviderFactory)] as ICodeProviderFactory;
            ICodeDomGenerator codeDomGen =
                ServiceRegistry.Instance[typeof(ICodeDomGenerator)] as ICodeDomGenerator;

            typeDecl = codeDomGen.Generate(descriptor);

            language.ValueMember = "Label";

            foreach (CodeProviderInfo info in codeproviderFactory.GetAvailableProviders())
            {
                language.Items.Add(info);
            }

            language.SelectedIndex = 0;
        }
예제 #14
0
        public AuthenticationCommandBase(
            IAuthenticationManager authManager,
            IDialogFactory dialogFactory,
            IProjectManager projectManager,
            IProjectConfigurationManager projectConfigurationManager,
            ICodeProviderFactory codeProviderFactory) : base(projectManager, dialogFactory, projectConfigurationManager)
        {
            if (authManager == null)
            {
                throw new ArgumentNullException(nameof(authManager));
            }
            if (codeProviderFactory == null)
            {
                throw new ArgumentNullException(nameof(codeProviderFactory));
            }

            this.authManager         = authManager;
            this.codeProviderFactory = codeProviderFactory;
        }
예제 #15
0
		protected GenCodeDialog()
		{
			codeproviderFactory = 
				ServiceRegistry.Instance[ typeof(ICodeProviderFactory) ] as ICodeProviderFactory;

			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			languageCombo.ValueMember = "Label";

			foreach(CodeProviderInfo info in codeproviderFactory.GetAvailableProviders())
			{
				languageCombo.Items.Add(info);
			}

			languageCombo.SelectedIndex = 0;
		}
예제 #16
0
        public void Init()
        {
            projectManager = Substitute.For <IProjectManager>();
            projectConfigurationManager = Substitute.For <ProjectConfigurationManager>();
            dialogFactory       = Substitute.For <IDialogFactory>();
            authManager         = Substitute.For <IAuthenticationManager>();
            codeProviderFactory = Substitute.For <ICodeProviderFactory>();
            codeProvider        = Substitute.For <ICodeProvider>();
            codeProviderFactory.GetCodeProvider(null, null).ReturnsForAnyArgs(codeProvider);
            OpenFromPackageCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory);
            openFromPackageCmd = OpenFromPackageCmd.Instance;
            iVsUIShell         = Substitute.For <IVsUIShell>();
            var currentPath = AppDomain.CurrentDomain.BaseDirectory;

            projectManager.ProjectConfigPath.Returns(Path.Combine(currentPath, "TestData\\projectConfig.xml"));
            projectConfiguration = projectConfigurationManager.Load(projectManager.ProjectConfigPath);
            templateLoader       = new TemplateLoader();
            projectManager.MethodConfigPath.Returns(Path.Combine(currentPath, "TestData\\method-config.xml"));
            templateLoader.Load(projectManager.MethodConfigPath);
        }
        public void Init()
        {
            authManager = Substitute.For <IAuthenticationManager>();
            projectConfigurationManager = Substitute.For <IProjectConfigurationManager>();
            dialogFactory                 = Substitute.For <IDialogFactory>();
            projectManager                = Substitute.For <IProjectManager>();
            codeProviderFactory           = Substitute.For <ICodeProviderFactory>();
            messageManager                = Substitute.For <MessageManager>();
            authenticationCommandBaseTest = new AuthenticationCommandBaseTest(authManager, dialogFactory, projectManager, projectConfigurationManager, codeProviderFactory, messageManager);

            IProjectConfiguraiton projectConfiguraiton = Substitute.For <IProjectConfiguraiton>();

            projectConfiguraiton.Connections.Returns(Substitute.For <List <ConnectionInfo> >());
            projectConfiguraiton.MethodInfos.Returns(Substitute.For <List <MethodInfo> >());

            projectConfigurationManager.When(x => x.Load(projectManager.ProjectConfigPath))
            .Do(callback =>
            {
                projectConfigurationManager.CurrentProjectConfiguraiton.Returns(projectConfiguraiton);
            });
        }
예제 #18
0
 public void Init()
 {
     projectManager = Substitute.For <IProjectManager>();
     projectConfigurationManager = Substitute.For <ProjectConfigurationManager>();
     dialogFactory       = Substitute.For <IDialogFactory>();
     authManager         = Substitute.For <IAuthenticationManager>();
     codeProviderFactory = Substitute.For <ICodeProviderFactory>();
     codeProvider        = Substitute.For <ICodeProvider>();
     codeProviderFactory.GetCodeProvider(null).ReturnsForAnyArgs(codeProvider);
     messageManager = Substitute.For <MessageManager>();
     SaveToPackageCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
     saveToPackageCmd = SaveToPackageCmd.Instance;
     iVsUIShell       = Substitute.For <IVsUIShell>();
     currentPath      = AppDomain.CurrentDomain.BaseDirectory;
     projectManager.ProjectConfigPath.Returns(Path.Combine(currentPath, "TestData\\projectConfig.xml"));
     projectConfigurationManager.Load(projectManager.ProjectConfigPath);
     projectConfigurationManager.CurrentProjectConfiguraiton.MethodConfigPath = Path.Combine(currentPath, "TestData\\method-config.xml");
     templateLoader = new TemplateLoader();
     templateLoader.Load(projectConfigurationManager.CurrentProjectConfiguraiton.MethodConfigPath);
     projectManager.MethodPath.Returns(Path.Combine(currentPath, "TestData\\TestMethod.txt"));
     packageManager = Substitute.For <PackageManager>(authManager, messageManager);
     File.Delete(Path.Combine(currentPath, "imports.mf"));
 }
예제 #19
0
 /// <summary>
 /// Initializes the singleton instance of the command.
 /// </summary>
 /// <param name="package">Owner package, not null.</param>
 public static void Initialize(IProjectManager projectManager, IAuthenticationManager authManager, IDialogFactory dialogFactory, IProjectConfigurationManager projectConfigurationManager, ICodeProviderFactory codeProviderFactory)
 {
     Instance = new OpenFromPackageCmd(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory);
 }
예제 #20
0
 /// <summary>
 /// Initializes the singleton instance of the command.
 /// </summary>
 /// <param name="package">Owner package, not null.</param>
 public static void Initialize(IProjectManager projectManager, IAuthenticationManager authManager, IDialogFactory dialogFactory, IProjectConfigurationManager projectConfigurationManager, ICodeProviderFactory codeProviderFactory, IGlobalConfiguration userConfiguration, MessageManager messageManager)
 {
     Instance = new CreateMethodCmd(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, userConfiguration, messageManager);
 }
예제 #21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CreateMethodCmd"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        private CreateMethodCmd(IProjectManager projectManager, IAuthenticationManager authManager, IDialogFactory dialogFactory, IProjectConfigurationManager projectConfigurationManager, ICodeProviderFactory codeProviderFactory, IGlobalConfiguration userConfiguration, MessageManager messageManager) : base(authManager, dialogFactory, projectManager, projectConfigurationManager, codeProviderFactory, messageManager)
        {
            this.globalConfiguration = userConfiguration ?? throw new ArgumentNullException(nameof(userConfiguration));

            if (projectManager.CommandService != null)
            {
                var menuCommandID = new CommandID(CommandSet, CommandId);
                var menuItem      = new OleMenuCommand(this.ExecuteCommand, menuCommandID);
                menuItem.BeforeQueryStatus += CheckCommandAccessibility;

                projectManager.CommandService.AddCommand(menuItem);
            }
        }
 /// <summary>
 /// Initializes the singleton instance of the command.
 /// </summary>
 /// <param name="package">Owner package, not null.</param>
 public static void Initialize(IProjectManager projectManager, IAuthenticationManager authManager, IDialogFactory dialogFactory, IProjectConfigurationManager projectConfigurationManager, ICodeProviderFactory codeProviderFactory, MessageManager messageManager)
 {
     Instance = new SaveToPackageCmd(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="SaveToPackageCmd"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        private SaveToPackageCmd(IProjectManager projectManager, IAuthenticationManager authManager, IDialogFactory dialogFactory, IProjectConfigurationManager projectConfigurationManager, ICodeProviderFactory codeProviderFactory, MessageManager messageManager)
            : base(authManager, dialogFactory, projectManager, projectConfigurationManager, codeProviderFactory, messageManager)
        {
            if (projectManager.CommandService != null)
            {
                var itemCommandID = new CommandID(ItemCommandSet, ItemCommandId);
                var itemMenu      = new OleMenuCommand(this.ExecuteCommand, itemCommandID);
                itemMenu.BeforeQueryStatus += CheckCommandAccessibility;

                projectManager.CommandService.AddCommand(itemMenu);
            }
        }
예제 #24
0
        private DebugMethodCmd(IProjectManager projectManager, IAuthenticationManager authManager, IDialogFactory dialogFactory, IProjectConfigurationManager projectConfigurationManager, ICodeProviderFactory codeProviderFactory, MessageManager messageManager) : base(authManager, dialogFactory, projectManager, projectConfigurationManager, codeProviderFactory, messageManager)
        {
            if (projectManager.CommandService != null)
            {
                var menuCommandID = new CommandID(CommandSet, CommandId);
                var menuItem      = new OleMenuCommand(this.ExecuteCommand, menuCommandID);
                menuItem.BeforeQueryStatus += CheckCommandAccessibility;

                projectManager.CommandService.AddCommand(menuItem);
            }
        }
예제 #25
0
		public ProjectGenerator(ICodeDomGenerator domGenerator, ICodeProviderFactory providerFactory)
		{
			_domGenerator = domGenerator;
			_providerFactory = providerFactory;
		}
예제 #26
0
 /// <summary>
 /// Initializes the singleton instance of the command.
 /// </summary>
 /// <param name="package">Owner package, not null.</param>
 public static void Initialize(IProjectManager projectManager, IDialogFactory dialogFactory, IProjectConfigurationManager projectConfigurationManager, ICodeProviderFactory codeProviderFactory, MessageManager messageManager)
 {
     Instance = new CreateCodeItemCmd(projectManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
 }
예제 #27
0
 public ProjectGenerator(ICodeDomGenerator domGenerator, ICodeProviderFactory providerFactory)
 {
     _domGenerator    = domGenerator;
     _providerFactory = providerFactory;
 }
예제 #28
0
 /// <summary>
 /// Initializes the singleton instance of the command.
 /// </summary>
 /// <param name="projectManager"></param>
 /// <param name="dialogFactory"></param>
 /// <param name="projectConfigurationManager"></param>
 /// <param name="codeProviderFactory"></param>
 public static void Initialize(IProjectManager projectManager, IDialogFactory dialogFactory, IProjectConfigurationManager projectConfigurationManager, ICodeProviderFactory codeProviderFactory)
 {
     Instance = new MoveToCmd(projectManager, dialogFactory, projectConfigurationManager, codeProviderFactory);
 }