@@ -16,17 +16,17 @@ namespace QuickNavigate.Forms
1616{
1717 public sealed partial class TypeExplorerForm : ClassModelExplorerForm
1818 {
19- readonly List < string > closedTypes = new List < string > ( ) ;
20- readonly List < string > openedTypes = new List < string > ( ) ;
21- static readonly Dictionary < string , ClassModel > TypeToClassModel = new Dictionary < string , ClassModel > ( ) ;
22- readonly List < Button > filters = new List < Button > ( ) ;
23- readonly Dictionary < Keys , Button > keysToFilter = new Dictionary < Keys , Button > ( ) ;
24- readonly Dictionary < Button , string > filterToEnabledTip = new Dictionary < Button , string > ( ) ;
25- readonly Dictionary < Button , string > filterToDisabledTip = new Dictionary < Button , string > ( ) ;
26- readonly Dictionary < FlagType , Button > flagToFilter = new Dictionary < FlagType , Button > ( ) ;
27-
28- [ CanBeNull ]
29- readonly Brush defaultNodeBrush ;
19+ [ NotNull ] readonly List < string > closedTypes = new List < string > ( ) ;
20+ [ NotNull ] readonly List < string > openedTypes = new List < string > ( ) ;
21+ [ NotNull ] static readonly Dictionary < string , ClassModel > TypeToClassModel = new Dictionary < string , ClassModel > ( ) ;
22+ [ NotNull ] readonly List < Button > filters = new List < Button > ( ) ;
23+ [ NotNull ] readonly Dictionary < Keys , Button > keysToFilter = new Dictionary < Keys , Button > ( ) ;
24+ [ NotNull ] readonly Dictionary < Button , string > filterToEnabledTip = new Dictionary < Button , string > ( ) ;
25+ [ NotNull ] readonly Dictionary < Button , string > filterToDisabledTip = new Dictionary < Button , string > ( ) ;
26+ [ NotNull ] readonly Dictionary < FlagType , Button > flagToFilter = new Dictionary < FlagType , Button > ( ) ;
27+ [ NotNull ] readonly Timer timer = new Timer ( ) ;
28+ [ CanBeNull ] readonly Brush defaultNodeBrush ;
29+ private int filesCount ;
3030
3131 /// <summary>
3232 /// Initializes a new instance of the QuickNavigate.Controls.TypeExplorer
@@ -42,14 +42,17 @@ public TypeExplorerForm(Settings settings) : base(settings)
4242 CreateItemsList ( ) ;
4343 InitializeTree ( ) ;
4444 RefreshTree ( ) ;
45+ timer . Interval = PluginBase . MainForm . Settings . DisplayDelay ;
46+ timer . Tick += OnTimerTick ;
47+ timer . Start ( ) ;
4548 }
4649
4750 [ CanBeNull ]
4851 ToolTip filterToolTip ;
4952
5053 [ CanBeNull ]
5154 Button currentFilter ;
52-
55+
5356 [ CanBeNull ]
5457 Button CurrentFilter
5558 {
@@ -86,6 +89,7 @@ protected override void Dispose(bool disposing)
8689 {
8790 defaultNodeBrush ? . Dispose ( ) ;
8891 components ? . Dispose ( ) ;
92+ timer . Dispose ( ) ;
8993 }
9094 base . Dispose ( disposing ) ;
9195 }
@@ -194,7 +198,7 @@ static TypeNode CreateNode(string type)
194198 }
195199
196200 [ NotNull ]
197- static IEnumerable < TypeNode > SortNodes ( IEnumerable < TypeNode > nodes , string search )
201+ static IEnumerable < TypeNode > SortNodes ( [ NotNull ] IEnumerable < TypeNode > nodes , [ NotNull ] string search )
198202 {
199203 search = search . ToLower ( ) ;
200204 var nodes0 = new List < TypeNode > ( ) ;
@@ -311,6 +315,7 @@ protected override void OnKeyDown(KeyEventArgs e)
311315
312316 protected override void OnFormClosing ( FormClosingEventArgs e )
313317 {
318+ timer . Stop ( ) ;
314319 Settings . TypeExplorerSize = Size ;
315320 Settings . TypeExplorerSearchExternalClassPath = searchingInExternalClasspaths . Checked ;
316321 }
@@ -455,6 +460,17 @@ void OnFilterMouseLeave(object sender, EventArgs e)
455460
456461 void OnFilterMouseClick ( object sender , EventArgs e ) => CurrentFilter = filters . First ( sender . Equals ) ;
457462
463+ void OnTimerTick ( object sender , EventArgs e )
464+ {
465+ var context = ASContext . GetLanguageContext ( PluginBase . CurrentProject . Language ) ;
466+ if ( context == null || context . Classpath . Count == openedTypes . Count + closedTypes . Count ) return ;
467+ var filesCount = context . Classpath . Sum ( it => it . FilesCount ) ;
468+ if ( filesCount == this . filesCount ) return ;
469+ this . filesCount = filesCount ;
470+ CreateItemsList ( ) ;
471+ RefreshTree ( ) ;
472+ }
473+
458474 #endregion
459475 }
460476}
0 commit comments