コード例 #1
0
        protected override void Run(object dataItem)
        {
            if (dataItem is Result)
            {
                ((Result)dataItem).ShowResultOptionsDialog();
                return;
            }
            if (dataItem is System.Action)
            {
                ((System.Action)dataItem)();
                return;
            }
            if (!RefactoringService.CheckUserSettings())
            {
                return;
            }
            var action = dataItem as IAnalysisFixAction;

            if (action != null)
            {
                action.Fix();
                return;
            }
            var ca = dataItem as CodeAction;

            if (ca != null)
            {
                var doc = MonoDevelop.Ide.IdeApp.Workbench.ActiveDocument;

                var context = doc.ParsedDocument.CreateRefactoringContext != null?doc.ParsedDocument.CreateRefactoringContext(doc, default(CancellationToken)) : null;

                using (var script = context.CreateScript()) {
                    ca.Run(context, script);
                }
                return;
            }
        }