Exemplo n.º 1
0
        MenuCommand MakeFindDerivedClassesItem(IClass baseClass)
        {
            if (baseClass == null || baseClass.IsStatic || baseClass.IsSealed)
            {
                return(null);
            }
            var item = new MenuCommand(StringParser.Parse("${res:SharpDevelop.Refactoring.FindDerivedClassesCommand}"));

            item.ShortcutKeys = System.Windows.Forms.Keys.F6;
            //item.Image = ClassBrowserIconService.Class.Bitmap;
            item.Click += delegate {
                ContextActionsHelper.MakePopupWithDerivedClasses(baseClass).OpenAtCaretAndFocus();
            };
            return(item);
        }
        protected override void RunImpl(ITextEditor editor, int offset, ResolveResult symbol)
        {
            var classUnderCaret = GetClass(symbol);

            if (classUnderCaret != null)
            {
                ContextActionsHelper.MakePopupWithDerivedClasses(classUnderCaret).OpenAtCaretAndFocus();
                return;
            }
            var memberUnderCaret = GetMember(symbol);

            if (memberUnderCaret != null && memberUnderCaret.IsOverridable)
            {
                ContextActionsHelper.MakePopupWithOverrides(memberUnderCaret).OpenAtCaretAndFocus();
                return;
            }
            MessageService.ShowError("${res:ICSharpCode.Refactoring.NoClassOrOverridableSymbolUnderCursorError}");
        }