|
|
@ -5,8 +5,11 @@ using System; |
|
|
|
using System.Collections; |
|
|
|
using System.Collections; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Linq; |
|
|
|
|
|
|
|
using System.Windows; |
|
|
|
|
|
|
|
using System.Windows.Controls; |
|
|
|
|
|
|
|
|
|
|
|
using ICSharpCode.Core; |
|
|
|
using ICSharpCode.Core.Presentation; |
|
|
|
|
|
|
|
using ICSharpCode.SharpDevelop; |
|
|
|
using ICSharpCode.SharpDevelop.Editor.Search; |
|
|
|
using ICSharpCode.SharpDevelop.Editor.Search; |
|
|
|
using ICSharpCode.SharpDevelop.Gui; |
|
|
|
using ICSharpCode.SharpDevelop.Gui; |
|
|
|
|
|
|
|
|
|
|
@ -43,13 +46,69 @@ namespace SearchAndReplace |
|
|
|
WorkbenchSingleton.AssertMainThread(); |
|
|
|
WorkbenchSingleton.AssertMainThread(); |
|
|
|
if (resultsTreeViewInstance == null) |
|
|
|
if (resultsTreeViewInstance == null) |
|
|
|
resultsTreeViewInstance = new ResultsTreeView(); |
|
|
|
resultsTreeViewInstance = new ResultsTreeView(); |
|
|
|
|
|
|
|
rootNode.GroupResultsByFile(ResultsTreeView.GroupResultsByFile); |
|
|
|
resultsTreeViewInstance.ItemsSource = new object[] { rootNode }; |
|
|
|
resultsTreeViewInstance.ItemsSource = new object[] { rootNode }; |
|
|
|
return resultsTreeViewInstance; |
|
|
|
return resultsTreeViewInstance; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static IList toolbarItems; |
|
|
|
|
|
|
|
static MenuItem flatItem, perFileItem; |
|
|
|
|
|
|
|
|
|
|
|
public IList GetToolbarItems() |
|
|
|
public IList GetToolbarItems() |
|
|
|
{ |
|
|
|
{ |
|
|
|
return null; |
|
|
|
WorkbenchSingleton.AssertMainThread(); |
|
|
|
|
|
|
|
if (toolbarItems == null) { |
|
|
|
|
|
|
|
toolbarItems = new List<object>(); |
|
|
|
|
|
|
|
DropDownButton perFileDropDown = new DropDownButton(); |
|
|
|
|
|
|
|
perFileDropDown.Content = new Image { Height = 16, Source = PresentationResourceService.GetBitmapSource("Icons.16x16.FindIcon") }; |
|
|
|
|
|
|
|
perFileDropDown.SetValueToExtension(DropDownButton.ToolTipProperty, new LocalizeExtension("MainWindow.Windows.SearchResultPanel.SelectViewMode.ToolTip")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flatItem = new MenuItem(); |
|
|
|
|
|
|
|
flatItem.SetValueToExtension(MenuItem.HeaderProperty, new LocalizeExtension("MainWindow.Windows.SearchResultPanel.Flat")); |
|
|
|
|
|
|
|
flatItem.Click += delegate { SetPerFile(false); }; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
perFileItem = new MenuItem(); |
|
|
|
|
|
|
|
perFileItem.SetValueToExtension(MenuItem.HeaderProperty, new LocalizeExtension("MainWindow.Windows.SearchResultPanel.PerFile")); |
|
|
|
|
|
|
|
perFileItem.Click += delegate { SetPerFile(true); }; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
perFileDropDown.DropDownMenu = new ContextMenu(); |
|
|
|
|
|
|
|
perFileDropDown.DropDownMenu.Items.Add(flatItem); |
|
|
|
|
|
|
|
perFileDropDown.DropDownMenu.Items.Add(perFileItem); |
|
|
|
|
|
|
|
toolbarItems.Add(perFileDropDown); |
|
|
|
|
|
|
|
toolbarItems.Add(new Separator()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Button expandAll = new Button(); |
|
|
|
|
|
|
|
expandAll.SetValueToExtension(Button.ToolTipProperty, new LocalizeExtension("MainWindow.Windows.SearchResultPanel.ExpandAll.ToolTip")); |
|
|
|
|
|
|
|
expandAll.Content = new Image { Height = 16, Source = PresentationResourceService.GetBitmapSource("Icons.16x16.OpenAssembly") }; |
|
|
|
|
|
|
|
expandAll.Click += delegate { ExpandCollapseAll(true); }; |
|
|
|
|
|
|
|
toolbarItems.Add(expandAll); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Button collapseAll = new Button(); |
|
|
|
|
|
|
|
collapseAll.SetValueToExtension(Button.ToolTipProperty, new LocalizeExtension("MainWindow.Windows.SearchResultPanel.CollapseAll.ToolTip")); |
|
|
|
|
|
|
|
collapseAll.Content = new Image { Height = 16, Source = PresentationResourceService.GetBitmapSource("Icons.16x16.Assembly") }; |
|
|
|
|
|
|
|
collapseAll.Click += delegate { ExpandCollapseAll(false); }; |
|
|
|
|
|
|
|
toolbarItems.Add(collapseAll); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return toolbarItems; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void ExpandCollapseAll(bool newIsExpanded) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (resultsTreeViewInstance != null) { |
|
|
|
|
|
|
|
foreach (SearchNode node in resultsTreeViewInstance.ItemsSource.OfType<SearchNode>().Flatten(n => n.Children)) { |
|
|
|
|
|
|
|
node.IsExpanded = newIsExpanded; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void SetPerFile(bool perFile) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ResultsTreeView.GroupResultsByFile = perFile; |
|
|
|
|
|
|
|
if (resultsTreeViewInstance != null) { |
|
|
|
|
|
|
|
foreach (SearchRootNode node in resultsTreeViewInstance.ItemsSource.OfType<SearchRootNode>()) { |
|
|
|
|
|
|
|
node.GroupResultsByFile(perFile); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|