Example #1
0
        private void actReSharperSurroundWithTemplate_Execute(ExecuteEventArgs ea)
        {
            bool      allowPersistResponse = false;
            string    title     = "Surround With Template";
            string    message   = "CodeRush includes several built-in features to wrap and modify selections. There are keyboard shortcuts for many of these (just select the code you want to modify and press the specified key), and you can also access these from the right-click context menu. Select from one of the options below.";
            Redirects redirects = new Redirects();

            redirects.AddSelectionEmbedding("block", "Embeds a selection inside block delimiters (e.g., {} braces in C# or C++).");
            redirects.AddSelectionEmbedding("lock", "Embeds a selection inside a lock statement.");
            redirects.AddSelectionEmbedding("region", "Embeds a selection inside a region.");
            redirects.AddSelectionEmbedding("SyncLock", "Embeds a selection inside a SyncLock statement.");
            redirects.AddSelectionEmbedding("ToString", "Converts a selection to a string, escaping characters as needed.");
            redirects.AddSelectionEmbedding("try/catch", "Embeds a selection inside a try/catch block.");
            redirects.AddSelectionEmbedding("try/catch/finally", "Embeds a selection inside a try/catch/finally block.");
            redirects.AddSelectionEmbedding("try/finally", "Embeds a selection inside a try/finally block.");
            redirects.AddSelectionEmbedding("using", "Embeds a selection inside a using statement.");
            redirects.AddSelectionEmbedding("WaitCursor", "Embeds a selection inside code that displays an hourglass cursor while the code executes.");
            redirects.AddOptionsPage("Embedding Options && Customization", "Editor\\Selections\\Embedding", "Click this button to view, change, and create custom embeddings.");

            FrmResharperCompatibility frmResharperCompatibility = new FrmResharperCompatibility(title, message, redirects, allowPersistResponse);

            frmResharperCompatibility.ShowDialog(CodeRush.IDE);
            if (frmResharperCompatibility.Result == CompatibilityResult.ExecuteCommand)
            {
                CodeRush.Command.Execute(frmResharperCompatibility.Command, frmResharperCompatibility.Parameters);
            }
        }