Browse Source

clean up TaskListPad code

pull/59/merge
Siegfried Pammer 12 years ago
parent
commit
b4df154db2
  1. 6
      src/AddIns/Analysis/CodeAnalysis/Src/SuppressMessageCommand.cs
  2. 3
      src/AddIns/Misc/HelpViewer/Source/Commands.cs
  3. 10
      src/Main/Base/Project/Src/Gui/Pads/ErrorList/ErrorListPad.cs
  4. 9
      src/Main/Base/Project/Src/Gui/Pads/TaskList/TaskListPad.cs
  5. 35
      src/Main/Base/Project/Src/Gui/Pads/TaskList/TaskListPadCommands.cs
  6. 4
      src/Main/Base/Project/Src/Gui/Pads/TaskList/TaskViewResources.xaml.cs

6
src/AddIns/Analysis/CodeAnalysis/Src/SuppressMessageCommand.cs

@ -3,19 +3,13 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Text;
using System.Windows.Documents;
using ICSharpCode.Core; using ICSharpCode.Core;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.Semantics;
using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.TypeSystem;
using ICSharpCode.NRefactory.TypeSystem.Implementation; using ICSharpCode.NRefactory.TypeSystem.Implementation;
using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Refactoring; using ICSharpCode.SharpDevelop.Refactoring;
namespace ICSharpCode.CodeAnalysis namespace ICSharpCode.CodeAnalysis

3
src/AddIns/Misc/HelpViewer/Source/Commands.cs

@ -2,9 +2,7 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System; using System;
using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using Microsoft.Win32; using Microsoft.Win32;
@ -12,7 +10,6 @@ using MSHelpSystem.Core;
using MSHelpSystem.Controls; using MSHelpSystem.Controls;
using ICSharpCode.Core; using ICSharpCode.Core;
using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
namespace MSHelpSystem.Commands namespace MSHelpSystem.Commands
{ {

10
src/Main/Base/Project/Src/Gui/Pads/ErrorList/ErrorListPad.cs

@ -3,6 +3,7 @@
using System; using System;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using ICSharpCode.Core; using ICSharpCode.Core;
@ -27,7 +28,7 @@ namespace ICSharpCode.SharpDevelop.Gui
ToolBar toolBar; ToolBar toolBar;
DockPanel contentPanel = new DockPanel(); DockPanel contentPanel = new DockPanel();
ListView errorView = new ListView(); ListView errorView = new ListView();
readonly ObservableCollection<SDTask> errors = new ObservableCollection<SDTask>(); readonly ObservableCollection<SDTask> errors;
Properties properties; Properties properties;
@ -81,9 +82,9 @@ namespace ICSharpCode.SharpDevelop.Gui
instance = this; instance = this;
properties = PropertyService.NestedProperties("ErrorListPad"); properties = PropertyService.NestedProperties("ErrorListPad");
TaskService.Cleared += new EventHandler(TaskServiceCleared); TaskService.Cleared += TaskServiceCleared;
TaskService.Added += new TaskEventHandler(TaskServiceAdded); TaskService.Added += TaskServiceAdded;
TaskService.Removed += new TaskEventHandler(TaskServiceRemoved); TaskService.Removed += TaskServiceRemoved;
TaskService.InUpdateChanged += delegate { TaskService.InUpdateChanged += delegate {
if (!TaskService.InUpdate) if (!TaskService.InUpdate)
InternalShowResults(); InternalShowResults();
@ -92,6 +93,7 @@ namespace ICSharpCode.SharpDevelop.Gui
SD.BuildService.BuildFinished += ProjectServiceEndBuild; SD.BuildService.BuildFinished += ProjectServiceEndBuild;
SD.ProjectService.SolutionOpened += OnSolutionOpen; SD.ProjectService.SolutionOpened += OnSolutionOpen;
SD.ProjectService.SolutionClosed += OnSolutionClosed; SD.ProjectService.SolutionClosed += OnSolutionClosed;
errors = new ObservableCollection<SDTask>(TaskService.Tasks.Where(t => t.TaskType != TaskType.Comment));
toolBar = ToolBarService.CreateToolBar(contentPanel, this, "/SharpDevelop/Pads/ErrorList/Toolbar"); toolBar = ToolBarService.CreateToolBar(contentPanel, this, "/SharpDevelop/Pads/ErrorList/Toolbar");

9
src/Main/Base/Project/Src/Gui/Pads/TaskList/TaskListPad.cs

@ -7,7 +7,6 @@ using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Text;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using ICSharpCode.Core.Presentation; using ICSharpCode.Core.Presentation;
@ -65,15 +64,15 @@ namespace ICSharpCode.SharpDevelop.Gui
{ {
instance = this; instance = this;
this.displayedTokens = new Dictionary<string, bool>(); this.displayedTokens = new Dictionary<string, bool>();
this.tasks = new ObservableCollection<SDTask>();
InitializePadContent();
TaskService.Cleared += TaskServiceCleared; TaskService.Cleared += TaskServiceCleared;
TaskService.Added += TaskServiceAdded; TaskService.Added += TaskServiceAdded;
TaskService.Removed += TaskServiceRemoved; TaskService.Removed += TaskServiceRemoved;
TaskService.InUpdateChanged += TaskServiceInUpdateChanged; TaskService.InUpdateChanged += TaskServiceInUpdateChanged;
this.tasks = new ObservableCollection<SDTask>(TaskService.CommentTasks);
InitializePadContent();
SD.Workbench.ActiveViewContentChanged += WorkbenchActiveViewContentChanged; SD.Workbench.ActiveViewContentChanged += WorkbenchActiveViewContentChanged;
if (SD.Workbench.ActiveViewContent != null) { if (SD.Workbench.ActiveViewContent != null) {

35
src/Main/Base/Project/Src/Gui/Pads/TaskList/TaskListPadCommands.cs

@ -2,51 +2,48 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System; using System;
using System.Windows.Forms; using System.Windows;
using System.Windows.Controls;
using ICSharpCode.Core; using ICSharpCode.Core;
namespace ICSharpCode.SharpDevelop.Gui namespace ICSharpCode.SharpDevelop.Gui
{ {
public class SelectScopeComboBox : ToolStripComboBox public class SelectScopeComboBox : ComboBox
{ {
private static string[] viewTypes = new string[] {"Solution", "Project", "All open documents", "Document", "Namespace", "Class/Module"}; static readonly string[] viewTypes = new string[] {"Solution", "Project", "All open documents", "Document", "Namespace", "Class/Module"};
public SelectScopeComboBox() public SelectScopeComboBox()
{ {
SetItems(); this.ItemsSource = viewTypes;
this.SelectedIndex = 0; this.SelectedIndex = 0;
} }
protected override void OnSelectedIndexChanged(EventArgs e) protected override void OnSelectionChanged(SelectionChangedEventArgs e)
{ {
base.OnSelectedIndexChanged(e); base.OnSelectionChanged(e);
if (this.SelectedIndex != TaskListPad.Instance.SelectedScopeIndex) { if (this.SelectedIndex != TaskListPad.Instance.SelectedScopeIndex) {
TaskListPad.Instance.SelectedScopeIndex = this.SelectedIndex; TaskListPad.Instance.SelectedScopeIndex = this.SelectedIndex;
} }
} }
void SetItems()
{
this.Items.Clear();
this.Items.AddRange(viewTypes);
}
} }
sealed class TaskListTokensToolbarCheckBox : CheckBox, ICheckableMenuCommand sealed class TaskListTokensToolbarCheckBox : CheckBox, ICheckableMenuCommand
{ {
public event EventHandler IsCheckedChanged = delegate {}; event EventHandler ICheckableMenuCommand.IsCheckedChanged { add {} remove {} }
event EventHandler System.Windows.Input.ICommand.CanExecuteChanged { add {} remove {} }
public event EventHandler CanExecuteChanged { add {} remove {} }
readonly string token; readonly string token;
public TaskListTokensToolbarCheckBox(string token) public TaskListTokensToolbarCheckBox(string token)
{ {
this.token = token; this.token = token;
this.Text = token; this.Content = token;
this.Command = this;
this.CommandParameter = TaskListPad.Instance;
this.IsChecked = TaskListPad.Instance.DisplayedTokens[token];
SetResourceReference(FrameworkElement.StyleProperty, ToolBar.CheckBoxStyleKey);
} }
public bool IsChecked(object parameter) bool ICheckableMenuCommand.IsChecked(object parameter)
{ {
var pad = (TaskListPad)parameter; var pad = (TaskListPad)parameter;
return pad.DisplayedTokens[token]; return pad.DisplayedTokens[token];
@ -60,7 +57,7 @@ namespace ICSharpCode.SharpDevelop.Gui
public void Execute(object parameter) public void Execute(object parameter)
{ {
var pad = (TaskListPad)parameter; var pad = (TaskListPad)parameter;
pad.DisplayedTokens[token] = this.Checked; pad.DisplayedTokens[token] = IsChecked == true;
if (pad.IsInitialized) if (pad.IsInitialized)
pad.UpdateItems(); pad.UpdateItems();
} }

4
src/Main/Base/Project/Src/Gui/Pads/TaskList/TaskViewResources.xaml.cs

@ -6,13 +6,9 @@ using System.Text;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Controls.Primitives; using System.Windows.Controls.Primitives;
using System.Windows.Media;
namespace ICSharpCode.SharpDevelop.Gui namespace ICSharpCode.SharpDevelop.Gui
{ {
/// <summary>
/// Description of TaskViewResources.
/// </summary>
public partial class TaskViewResources : ResourceDictionary public partial class TaskViewResources : ResourceDictionary
{ {
public TaskViewResources() public TaskViewResources()

Loading…
Cancel
Save