예제 #1
0
		static ContextActionsPopup MakePopupWithBaseClasses(ITypeDefinition @class)
		{
			var baseClassList = @class.GetAllBaseTypeDefinitions().Where(baseClass => baseClass != @class).ToList();
			var popupViewModel = new ContextActionsPopupViewModel();
			popupViewModel.Title = MenuService.ConvertLabel(StringParser.Parse(
				"${res:SharpDevelop.Refactoring.BaseClassesOf}", new StringTagPair("Name", @class.Name)));
			popupViewModel.Actions = BuildListViewModel(baseClassList);
			return new ContextActionsPopup { Actions = popupViewModel };
		}
		static ContextActionsPopup MakePopupWithDerivedClasses(ITypeDefinition baseClass)
		{
			var derivedClassesTree = BuildDerivedTypesGraph(baseClass);
			var popupViewModel = new ContextActionsPopupViewModel();
			popupViewModel.Title = MenuService.ConvertLabel(StringParser.Parse(
				"${res:SharpDevelop.Refactoring.ClassesDerivingFrom}", new StringTagPair("Name", baseClass.Name)));
			popupViewModel.Actions = BuildTreeViewModel(derivedClassesTree.Children);
			return new ContextActionsPopup { Actions = popupViewModel };
		}
예제 #3
0
 void ShowPopupWithPartialClasses(ITypeDefinition definition)
 {
     var popupViewModel = new ContextActionsPopupViewModel();
     popupViewModel.Title = MenuService.ConvertLabel(StringParser.Parse(
         "${res:SharpDevelop.Refactoring.PartsOfClass}", new StringTagPair("Name", definition.Name)));
     popupViewModel.Actions = new ObservableCollection<ContextActionViewModel>(definition.Parts.Where(p => !p.Region.IsEmpty).Select(MakeViewModel));
     var uiService = SD.GetActiveViewContentService<IEditorUIService>();
     if (uiService != null)
         uiService.ShowContextActionsPopup(popupViewModel);
 }
		static ContextActionsPopup MakePopupWithOverrides(IMember member)
		{
			var derivedClassesTree = BuildDerivedTypesGraph(member.DeclaringTypeDefinition);
			var popupViewModel = new ContextActionsPopupViewModel {
				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 };
		}
예제 #5
0
		static ContextActionsPopup MakePopupWithClipboardOptions(EditorRefactoringContext context)
		{
			var popupViewModel = new ContextActionsPopupViewModel();
			var actions = BuildClipboardRingData(context);
			
			string labelSource = "${res:SharpDevelop.Refactoring.ClipboardRing}";
			if (actions == null || actions.Count == 0) 
				labelSource = "${res:SharpDevelop.Refactoring.ClipboardRingEmpty}";
			
			popupViewModel.Title = MenuService.ConvertLabel(StringParser.Parse(labelSource));
			popupViewModel.Actions = actions;
			return new ClipboardRingPopup { Actions = popupViewModel };
		}
예제 #6
0
		static ContextActionsPopup MakePopupWithBaseMembers(IMember member)
		{
			var baseClassList = member.DeclaringTypeDefinition.GetAllBaseTypeDefinitions().Where(
				                    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 };
		}
		/// <inheritdoc />
		public void ShowContextActionsPopup(ContextActionsPopupViewModel viewModel)
		{
			new ContextActionsPopup { Actions = viewModel }.OpenAtCursorAndFocus();
		}