@@ -19,18 +19,19 @@ namespace ResultsPanel
19
19
{
20
20
public class PluginUI : DockPanelControl
21
21
{
22
+ public ToolStripMenuItem clearEntriesContextMenuItem ;
23
+ public ToolStripMenuItem copyEntryContextMenuItem ;
24
+ public ToolStripMenuItem ignoreEntryContextMenuItem ;
25
+ public ToolStripMenuItem clearIgnoredEntriesContextMenuItem ;
26
+ public ToolStripMenuItem nextEntryContextMenuItem ;
27
+ public ToolStripMenuItem previousEntryContextMenuItem ;
28
+
22
29
private ListViewEx entriesView ;
23
30
private ColumnHeader entryFile ;
24
31
private ColumnHeader entryDesc ;
25
32
private ColumnHeader entryLine ;
26
33
private ColumnHeader entryPath ;
27
34
private ColumnHeader entryType ;
28
- private ToolStripMenuItem nextEntry ;
29
- private ToolStripMenuItem previousEntry ;
30
- private ToolStripMenuItem ignoreEntriesContextMenuItem ;
31
- private ToolStripMenuItem ignoreEntryContextMenuItem ;
32
- private ToolStripMenuItem copyEntryContextMenuItem ;
33
- private ToolStripMenuItem clearIgnoredEntriesContextMenuItem ;
34
35
private IDictionary < String , Boolean > ignoredEntries ;
35
36
private List < ListViewItem > allListViewItems = new List < ListViewItem > ( ) ;
36
37
private ToolStripButton toolStripButtonError ;
@@ -267,23 +268,25 @@ public void InitializeGraphics()
267
268
public void InitializeContextMenu ( )
268
269
{
269
270
ContextMenuStrip menu = new ContextMenuStrip ( ) ;
270
- this . ignoreEntriesContextMenuItem = new ToolStripMenuItem ( TextHelper . GetString ( "Label.ClearEntries" ) , null , new EventHandler ( this . ClearOutputClick ) ) ;
271
- menu . Items . Add ( this . ignoreEntriesContextMenuItem ) ;
271
+
272
+ this . clearEntriesContextMenuItem = new ToolStripMenuItem ( TextHelper . GetString ( "Label.ClearEntries" ) , null , new EventHandler ( this . ClearOutputClick ) ) ;
272
273
this . copyEntryContextMenuItem = new ToolStripMenuItem ( TextHelper . GetString ( "Label.CopyEntry" ) , null , new EventHandler ( this . CopyTextClick ) ) ;
273
- this . copyEntryContextMenuItem . ShortcutKeyDisplayString = DataConverter . KeysToString ( this . pluginMain . CopyEntry ) ;
274
- menu . Items . Add ( this . copyEntryContextMenuItem ) ;
275
274
this . ignoreEntryContextMenuItem = new ToolStripMenuItem ( TextHelper . GetString ( "Label.IgnoreEntry" ) , null , new EventHandler ( this . IgnoreEntryClick ) ) ;
276
- this . ignoreEntryContextMenuItem . ShortcutKeyDisplayString = DataConverter . KeysToString ( this . pluginMain . IgnoreEntry ) ;
275
+ this . clearIgnoredEntriesContextMenuItem = new ToolStripMenuItem ( TextHelper . GetString ( "Label.ClearIgnoredEntries" ) , null , new EventHandler ( this . ClearIgnoredEntriesClick ) ) ;
276
+ this . nextEntryContextMenuItem = new ToolStripMenuItem ( TextHelper . GetString ( "Label.NextEntry" ) , null , new EventHandler ( this . NextEntryClick ) ) ;
277
+ this . previousEntryContextMenuItem = new ToolStripMenuItem ( TextHelper . GetString ( "Label.PreviousEntry" ) , null , new EventHandler ( this . PreviousEntryClick ) ) ;
278
+
279
+ this . copyEntryContextMenuItem . ShortcutKeyDisplayString = DataConverter . KeysToString ( PluginMain . CopyEntryKeys ) ;
280
+ this . ignoreEntryContextMenuItem . ShortcutKeyDisplayString = DataConverter . KeysToString ( PluginMain . IgnoreEntryKeys ) ;
281
+
282
+ menu . Items . Add ( this . clearEntriesContextMenuItem ) ;
283
+ menu . Items . Add ( this . copyEntryContextMenuItem ) ;
277
284
menu . Items . Add ( this . ignoreEntryContextMenuItem ) ;
278
- this . clearIgnoredEntriesContextMenuItem = new ToolStripMenuItem ( TextHelper . GetString ( "Label.ClearIgnoredEntries" ) , null , new EventHandler ( this . ClearIgnoredEntries ) ) ;
279
285
menu . Items . Add ( this . clearIgnoredEntriesContextMenuItem ) ;
280
286
menu . Items . Add ( new ToolStripSeparator ( ) ) ;
281
- this . nextEntry = new ToolStripMenuItem ( TextHelper . GetString ( "Label.NextEntry" ) , null , new EventHandler ( this . NextEntry ) ) ;
282
- this . nextEntry . ShortcutKeyDisplayString = DataConverter . KeysToString ( this . pluginMain . NextError ) ;
283
- menu . Items . Add ( this . nextEntry ) ;
284
- this . previousEntry = new ToolStripMenuItem ( TextHelper . GetString ( "Label.PreviousEntry" ) , null , new EventHandler ( this . PreviousEntry ) ) ;
285
- this . previousEntry . ShortcutKeyDisplayString = DataConverter . KeysToString ( this . pluginMain . PrevError ) ;
286
- menu . Items . Add ( this . previousEntry ) ;
287
+ menu . Items . Add ( this . nextEntryContextMenuItem ) ;
288
+ menu . Items . Add ( this . previousEntryContextMenuItem ) ;
289
+
287
290
this . entriesView . ContextMenuStrip = menu ;
288
291
menu . Font = PluginBase . Settings . DefaultFont ;
289
292
menu . Renderer = new DockPanelStripRenderer ( false ) ;
@@ -389,10 +392,17 @@ public void CopyTextClick(Object sender, System.EventArgs e)
389
392
/// <summary>
390
393
/// Clears any result entries that are ignored. Invoked from the context menu.
391
394
/// </summary>
392
- public void ClearIgnoredEntries ( Object sender , System . EventArgs e )
395
+ public void ClearIgnoredEntriesClick ( Object sender , System . EventArgs e )
396
+ {
397
+ ClearIgnoredEntries ( ) ;
398
+ }
399
+
400
+ public Boolean ClearIgnoredEntries ( )
393
401
{
402
+ if ( this . ignoredEntries . Count == 0 ) return false ;
394
403
this . ignoredEntries . Clear ( ) ;
395
404
this . FilterResults ( false ) ;
405
+ return true ;
396
406
}
397
407
398
408
/// <summary>
@@ -452,7 +462,7 @@ private void PluginUIResize(object sender, EventArgs e)
452
462
/// </summary>
453
463
private void ContextMenuOpening ( object sender , System . ComponentModel . CancelEventArgs e )
454
464
{
455
- this . nextEntry . Enabled = this . previousEntry . Enabled = this . ignoreEntriesContextMenuItem . Enabled = this . entriesView . Items . Count > 0 ;
465
+ this . nextEntryContextMenuItem . Enabled = this . previousEntryContextMenuItem . Enabled = this . clearEntriesContextMenuItem . Enabled = this . entriesView . Items . Count > 0 ;
456
466
this . ignoreEntryContextMenuItem . Enabled = this . copyEntryContextMenuItem . Enabled = this . entriesView . SelectedItems . Count > 0 ;
457
467
this . clearIgnoredEntriesContextMenuItem . Enabled = this . ignoredEntries . Count > 0 ;
458
468
}
@@ -556,8 +566,9 @@ private void MBSafeSetSelAndFocus(ScintillaControl sci, Int32 line, Int32 startP
556
566
/// <summary>
557
567
/// Clears the output
558
568
/// </summary>
559
- public void ClearOutput ( )
569
+ public Boolean ClearOutput ( )
560
570
{
571
+ if ( this . allListViewItems . Count == 0 ) return false ;
561
572
this . ClearSquiggles ( ) ;
562
573
this . allListViewItems . Clear ( ) ;
563
574
this . toolStripTextBoxFilter . Text = "" ;
@@ -566,6 +577,7 @@ public void ClearOutput()
566
577
this . DisableContextMenuItems ( ) ;
567
578
this . entryIndex = - 1 ;
568
579
this . UpdateButtons ( ) ;
580
+ return true ;
569
581
}
570
582
571
583
/// <summary>
@@ -937,9 +949,17 @@ private void ClearSquiggles()
937
949
/// <summary>
938
950
/// Goes to the next entry in the result list.
939
951
/// </summary>
940
- public void NextEntry ( Object sender , System . EventArgs e )
952
+ public void NextEntryClick ( Object sender , System . EventArgs e )
953
+ {
954
+ NextEntry ( ) ;
955
+ }
956
+
957
+ /// <summary>
958
+ /// Goes to the next entry in the result list.
959
+ /// </summary>
960
+ public Boolean NextEntry ( )
941
961
{
942
- if ( this . entriesView . Items . Count == 0 ) return ;
962
+ if ( this . entriesView . Items . Count == 0 ) return false ;
943
963
if ( this . entryIndex >= 0 && this . entryIndex < this . entriesView . Items . Count )
944
964
{
945
965
this . entriesView . Items [ this . entryIndex ] . ForeColor = this . entriesView . ForeColor ;
@@ -950,14 +970,23 @@ public void NextEntry(Object sender, System.EventArgs e)
950
970
this . entriesView . Items [ this . entryIndex ] . ForeColor = PluginBase . MainForm . GetThemeColor ( "ListView.Highlight" , SystemColors . Highlight ) ;
951
971
this . entriesView . EnsureVisible ( this . entryIndex ) ;
952
972
this . EntriesViewDoubleClick ( null , null ) ;
973
+ return true ;
974
+ }
975
+
976
+ /// <summary>
977
+ /// Goes to the previous entry in the result list.
978
+ /// </summary>
979
+ public void PreviousEntryClick ( Object sender , System . EventArgs e )
980
+ {
981
+ PreviousEntry ( ) ;
953
982
}
954
983
955
984
/// <summary>
956
985
/// Goes to the previous entry in the result list.
957
986
/// </summary>
958
- public void PreviousEntry ( Object sender , System . EventArgs e )
987
+ public Boolean PreviousEntry ( )
959
988
{
960
- if ( this . entriesView . Items . Count == 0 ) return ;
989
+ if ( this . entriesView . Items . Count == 0 ) return false ;
961
990
if ( this . entryIndex >= 0 && this . entryIndex < this . entriesView . Items . Count )
962
991
{
963
992
this . entriesView . Items [ this . entryIndex ] . ForeColor = this . entriesView . ForeColor ;
@@ -968,6 +997,7 @@ public void PreviousEntry(Object sender, System.EventArgs e)
968
997
this . entriesView . Items [ this . entryIndex ] . ForeColor = PluginBase . MainForm . GetThemeColor ( "ListView.Highlight" , SystemColors . Highlight ) ;
969
998
this . entriesView . EnsureVisible ( this . entryIndex ) ;
970
999
this . EntriesViewDoubleClick ( null , null ) ;
1000
+ return true ;
971
1001
}
972
1002
973
1003
#endregion
0 commit comments