Exemple #1
0
        IList <MethodSourceStatement> GetStatements()
        {
            var documentViewer = appWindow.FileTabManager.ActiveTab.TryGetDocumentViewer();

            if (documentViewer == null)
            {
                return(null);
            }
            if (!documentViewer.UIObject.IsKeyboardFocusWithin)
            {
                return(null);
            }

            return(BodyCommandUtils.GetStatements(documentViewer, documentViewer.Caret.Position.BufferPosition));
        }
Exemple #2
0
        IList <MethodSourceStatement> GetStatements()
        {
            var documentViewer = appService.DocumentTabService.ActiveTab.TryGetDocumentViewer();

            if (documentViewer == null)
            {
                return(null);
            }
            if (!documentViewer.UIObject.IsKeyboardFocusWithin)
            {
                return(null);
            }

            return(BodyCommandUtils.GetStatements(documentViewer, documentViewer.Caret.Position.BufferPosition, FindByTextPositionOptions.None));
        }
 internal static bool IsVisibleInternal(IMenuItemContext?context) => IsVisible(BodyCommandUtils.GetStatements(context, FindByTextPositionOptions.None));
Exemple #4
0
        void Execute(IList <MethodSourceStatement> list)
        {
            if (list == null)
            {
                return;
            }

            var method     = list[0].Method;
            var methodNode = appService.DocumentTreeView.FindNode(method);

            if (methodNode == null)
            {
                MsgBox.Instance.Show(string.Format(dnSpy_AsmEditor_Resources.Error_CouldNotFindMethod, method));
                return;
            }

            EditMethodBodyILCommand.Execute(methodAnnotations, undoCommandService, appService, new DocumentTreeNodeData[] { methodNode }, BodyCommandUtils.GetInstructionOffsets(method, list));
        }
Exemple #5
0
 public override void Execute(IMenuItemContext context) => Execute(BodyCommandUtils.GetStatements(context, FindByTextPositionOptions.None));
Exemple #6
0
 public override void Execute(IMenuItemContext context) => Execute(BodyCommandUtils.GetStatements(context));
Exemple #7
0
 internal static bool IsVisibleInternal(IMenuItemContext context) => IsVisible(BodyCommandUtils.GetStatements(context));