Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Commit

Permalink
Added Ctrl+F6 shortcut for "Find base symbols", finding base or deriv…
Browse files Browse the repository at this point in the history
…ed symbols on constructors and destructors now the same as for types.
  • Loading branch information
Rpinski committed Aug 23, 2014
1 parent e9864a2 commit ce21246
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@

<MenuItem id = "FindBaseClassesOrMembers"
label = "${res:SharpDevelop.Refactoring.FindBaseClassesOrMembersCommand}"
shortcut="Control+F6"
icon="Icons.16x16.Interface"
class = "ICSharpCode.AvalonEdit.AddIn.ContextActions.FindBaseClassesOrMembers"/>
</Path>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@ public override void Run(ResolveResult symbol)
MakePopupWithBaseClasses((ITypeDefinition)entityUnderCaret).OpenAtCaretAndFocus();
return;
}
if (entityUnderCaret is IMember) {
MakePopupWithBaseMembers((IMember)entityUnderCaret).OpenAtCaretAndFocus();
var member = entityUnderCaret as IMember;
if (member != null) {
if ((member.SymbolKind == SymbolKind.Constructor) || (member.SymbolKind == SymbolKind.Destructor)) {
MakePopupWithBaseClasses(member.DeclaringTypeDefinition).OpenAtCaretAndFocus();
} else {
MakePopupWithBaseMembers(member).OpenAtCaretAndFocus();
}
return;
}
MessageService.ShowError("${res:ICSharpCode.Refactoring.NoClassOrMemberUnderCursorError}");
Expand All @@ -67,12 +72,13 @@ static ObservableCollection<ContextActionViewModel> BuildBaseClassListViewModel(
static ContextActionsPopup MakePopupWithBaseMembers(IMember member)
{
var baseClassList = member.DeclaringTypeDefinition.GetAllBaseTypeDefinitions().Where(
baseClass => baseClass != member.DeclaringTypeDefinition).ToList();
baseClass => baseClass != member.DeclaringTypeDefinition).ToList();
var popupViewModel = new ContextActionsPopupViewModel {
Title = MenuService.ConvertLabel(StringParser.Parse(
"${res:SharpDevelop.Refactoring.BaseMembersOf}",
new StringTagPair("Name", member.FullName))
)};
)
};
popupViewModel.Actions = BuildBaseMemberListViewModel(member);
return new ContextActionsPopup { Actions = popupViewModel };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@ public override void Run(ResolveResult symbol)
MakePopupWithDerivedClasses((ITypeDefinition)entityUnderCaret).OpenAtCaretAndFocus();
return;
}
if (entityUnderCaret is IMember && ((IMember)entityUnderCaret).IsOverridable) {
MakePopupWithOverrides((IMember)entityUnderCaret).OpenAtCaretAndFocus();
var member = entityUnderCaret as IMember;
if (member != null) {
if ((member.SymbolKind == SymbolKind.Constructor) || (member.SymbolKind == SymbolKind.Destructor)) {
MakePopupWithDerivedClasses(member.DeclaringTypeDefinition).OpenAtCaretAndFocus();
} else if (member.IsOverridable) {
MakePopupWithOverrides(member).OpenAtCaretAndFocus();
}
return;
}
MessageService.ShowError("${res:ICSharpCode.Refactoring.NoClassOrOverridableSymbolUnderCursorError}");
Expand Down Expand Up @@ -80,7 +85,8 @@ static ContextActionsPopup MakePopupWithOverrides(IMember member)
Title = MenuService.ConvertLabel(StringParser.Parse(
"${res:SharpDevelop.Refactoring.OverridesOf}",
new StringTagPair("Name", member.FullName))
)};
)
};
popupViewModel.Actions = new OverridesPopupTreeViewModelBuilder(member).BuildTreeViewModel(derivedClassesTree.Children);
return new ContextActionsPopup { Actions = popupViewModel };
}
Expand Down

0 comments on commit ce21246

Please sign in to comment.