Browse Source

Added comments to CaretReferencesRenderer.

pull/14/head
mkonicek 15 years ago
parent
commit
df5acd812d
  1. 34
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CaretReferencesRenderer.cs
  2. 3
      src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsService.cs

34
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CaretReferencesRenderer.cs

@ -74,6 +74,16 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -74,6 +74,16 @@ namespace ICSharpCode.AvalonEdit.AddIn
this.highlightRenderer.ClearHighlight();
}
/// <summary>
/// In the current document, highlights all references to the expression
/// which is currently under the caret (local variable, class, property).
/// This gets called on every caret position change, so quite often.
/// </summary>
void CaretPositionChanged(object sender, EventArgs e)
{
Restart(this.delayMoveTimer);
}
void TimerTick(object sender, EventArgs e)
{
this.delayTimer.Stop();
@ -94,7 +104,7 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -94,7 +104,7 @@ namespace ICSharpCode.AvalonEdit.AddIn
var resolveResult = GetExpressionAtCaret();
if (resolveResult == null) {
this.lastResolveResult = resolveResult;
this.lastResolveResult = null;
this.highlightRenderer.ClearHighlight();
return;
}
@ -104,20 +114,11 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -104,20 +114,11 @@ namespace ICSharpCode.AvalonEdit.AddIn
this.lastResolveResult = resolveResult;
this.highlightRenderer.ClearHighlight();
this.delayTimer.Start();
} else {
// highlight stays the same, both timers are stopped (will start again when caret moves)
}
}
/// <summary>
/// In the current document, highlights all references to the expression
/// which is currently under the caret (local variable, class, property).
/// This gets called on every caret position change, so quite often.
/// </summary>
void CaretPositionChanged(object sender, EventArgs e)
{
this.delayMoveTimer.Stop();
this.delayMoveTimer.Start();
}
/// <summary>
/// Resolves the current expression under caret.
/// This gets called on every caret position change, so quite often.
@ -167,5 +168,14 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -167,5 +168,14 @@ namespace ICSharpCode.AvalonEdit.AddIn
// TODO determine if 2 ResolveResults refer to the same symbol
return false;
}
/// <summary>
/// Restarts a timer.
/// </summary>
void Restart(DispatcherTimer timer)
{
timer.Stop();
timer.Start();
}
}
}

3
src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsService.cs

@ -18,6 +18,9 @@ namespace ICSharpCode.SharpDevelop.Refactoring @@ -18,6 +18,9 @@ namespace ICSharpCode.SharpDevelop.Refactoring
{
private static ContextActionsService instance = new ContextActionsService();
/// <summary>
/// Key for storing the names of disabled providers in PropertyService.
/// </summary>
const string PropertyServiceKey = "DisabledContextActionProviders";
public static ContextActionsService Instance {

Loading…
Cancel
Save