public void ProcessTest()
        {
            Agent.EnsureSolutionOpen();

            DTE2 DTE = Agent.GetDTE();
            BatchInlineCommand target = Agent.BatchInlineCommand;

            var window = DTE.OpenFile(null, Agent.AspNetReferencesTestFile1);

            window.Activate();

            target.Process(true);

            Assert.IsTrue(VLDocumentViewsManager.IsFileLocked(Agent.AspNetReferencesTestFile1));

            ValidateResults(GetExpectedResultsFor(Agent.AspNetReferencesTestFile1), target.Results);

            Assert.IsTrue(VLDocumentViewsManager.IsFileLocked(Agent.AspNetReferencesTestFile1));

            VLDocumentViewsManager.ReleaseLocks();
            Assert.IsFalse(VLDocumentViewsManager.IsFileLocked(Agent.AspNetReferencesTestFile1));

            window.Detach();
            window.Close(EnvDTE.vsSaveChanges.vsSaveChangesNo);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes commands instances and registers the as handlers for menu items clicks
        /// </summary>
        public MenuManager()
        {
            this.csharpInlineCommand          = new CSharpInlineCommand();
            this.aspNetInlineCommand          = new AspNetInlineCommand();
            this.batchMoveCommand             = new BatchMoveCommand();
            this.batchInlineCommand           = new BatchInlineCommand();
            this.csharpMoveToResourcesCommand = new CSharpMoveToResourcesCommand();
            this.aspNetMoveToResourcesCommand = new AspNetMoveToResourcesCommand();
            this.globalTranslateCommand       = new GlobalTranslateCommand();
            this.vbMoveToResourcesCommand     = new VBMoveToResourcesCommand();
            this.vbInlineCommand = new VBInlineCommand();

            // registers context menu in code windows
            ConfigureMenuCommand(typeof(Guids.VLCommandSet).GUID,
                                 PackageCommandIDs.CodeMenu, null,
                                 new EventHandler(CodeMenuQueryStatus), VisualLocalizerPackage.Instance.menuService);

            // registers context menu in Solution Explorer
            ConfigureMenuCommand(typeof(Guids.VLCommandSet).GUID,
                                 PackageCommandIDs.SolExpMenu, null,
                                 new EventHandler(SolExpMenuQueryStatus), VisualLocalizerPackage.Instance.menuService);

            ConfigureMenuCommand(typeof(Guids.VLCommandSet).GUID,
                                 PackageCommandIDs.MoveCodeMenuItem,
                                 new EventHandler(MoveToResourcesClick), null, VisualLocalizerPackage.Instance.menuService);

            ConfigureMenuCommand(typeof(Guids.VLCommandSet).GUID,
                                 PackageCommandIDs.InlineCodeMenuItem,
                                 new EventHandler(InlineClick), null, VisualLocalizerPackage.Instance.menuService);

            ConfigureMenuCommand(typeof(Guids.VLCommandSet).GUID,
                                 PackageCommandIDs.BatchMoveCodeMenuItem,
                                 new EventHandler(BatchMoveCodeClick), null, VisualLocalizerPackage.Instance.menuService);

            ConfigureMenuCommand(typeof(Guids.VLCommandSet).GUID,
                                 PackageCommandIDs.BatchMoveSolExpMenuItem,
                                 new EventHandler(BatchMoveSolExpClick), new EventHandler(BatchSolExpQueryStatus), VisualLocalizerPackage.Instance.menuService);

            ConfigureMenuCommand(typeof(Guids.VLCommandSet).GUID,
                                 PackageCommandIDs.BatchInlineCodeMenuItem,
                                 new EventHandler(BatchInlineCodeClick), null, VisualLocalizerPackage.Instance.menuService);

            ConfigureMenuCommand(typeof(Guids.VLCommandSet).GUID,
                                 PackageCommandIDs.TranslateSolExpMenuItem,
                                 new EventHandler(TranslateSolExpClick), new EventHandler(TranslateSolExpQueryStatus), VisualLocalizerPackage.Instance.menuService);

            ConfigureMenuCommand(typeof(Guids.VLCommandSet).GUID,
                                 PackageCommandIDs.BatchInlineSolExpMenuItem,
                                 new EventHandler(BatchInlineSolExpClick), new EventHandler(BatchSolExpQueryStatus), VisualLocalizerPackage.Instance.menuService);

            ConfigureMenuCommand(typeof(Guids.VLCommandSet).GUID,
                                 PackageCommandIDs.BatchInlineSelectionCodeMenuItem,
                                 new EventHandler(BatchInlineSelectionCodeClick), new EventHandler(SelectionCodeQueryStatus), VisualLocalizerPackage.Instance.menuService);

            ConfigureMenuCommand(typeof(Guids.VLCommandSet).GUID,
                                 PackageCommandIDs.BatchMoveSelectionCodeMenuItem,
                                 new EventHandler(BatchMoveSelectionCodeClick), new EventHandler(SelectionCodeQueryStatus), VisualLocalizerPackage.Instance.menuService);
        }