public void Deactivate(SnippetEventArgs e) { TextDocumentWeakEventManager.TextChanged.RemoveListener(context.Document, this); context.TextArea.TextView.BackgroundRenderers.Remove(background); context.TextArea.TextView.BackgroundRenderers.Remove(foreground); context.TextArea.Caret.PositionChanged -= Caret_PositionChanged; }
/// <summary> /// Calls the <see cref="IActiveElement.Deactivate"/> method on all registered active elements. /// </summary> /// <param name="e">The EventArgs to use</param> public void Deactivate(SnippetEventArgs e) { if (currentStatus == Status.Deactivated || currentStatus == Status.RaisingDeactivated) { return; } if (currentStatus != Status.Interactive) { throw new InvalidOperationException("Cannot call Deactivate() until RaiseInsertionCompleted() has finished."); } if (e == null) { e = new SnippetEventArgs(DeactivateReason.Unknown); } TextDocumentWeakEventManager.UpdateFinished.RemoveListener(Document, this); currentStatus = Status.RaisingDeactivated; TextArea.PopStackedInputHandler(myInputHandler); foreach (IActiveElement element in registeredElements) { element.Deactivate(e); } if (Deactivated != null) { Deactivated(this, e); } currentStatus = Status.Deactivated; }
/// <summary> /// Main logic of switch snippet. Called when user ends the snippet interactive mode. /// Inserts switch body depending on the type of switch condition: /// Inserts all cases if condition is enum, generic switch body with one case otherwise. /// </summary> void InteractiveModeCompleted(object sender, SnippetEventArgs e) { if (e.Reason != DeactivateReason.ReturnPressed) return; int offset; string conditionText = GetSwitchConditionText(this.context, out offset); IReturnType conditionType = ResolveConditionType(conditionText, offset); string switchBodyIndent = GetBodyIndent(this.Editor.Document, this.InsertionPosition); if (conditionType != null && IsEnum(conditionType)) { GenerateEnumSwitchBodyCode(this.InsertionPosition, conditionType, switchBodyIndent); } else { GenerateGenericSwitchBodyCode(this.InsertionPosition, switchBodyIndent); } }
void IActiveElement.Deactivate(SnippetEventArgs e) { if (e.Reason == DeactivateReason.Deleted) { Deactivate(); return; } if (e.Reason == DeactivateReason.ReturnPressed) OKButtonClick(null, null); if (e.Reason == DeactivateReason.EscapePressed) CancelButtonClick(null, null); Deactivate(); }
public void Deactivate(SnippetEventArgs e) { }
/// <inheritdoc /> public void Deactivate(SnippetEventArgs e) { }
/// <summary> /// Calls the <see cref="IActiveElement.Deactivate"/> method on all registered active elements. /// </summary> /// <param name="e">The EventArgs to use</param> public void Deactivate(SnippetEventArgs e) { if (currentStatus == Status.Deactivated || currentStatus == Status.RaisingDeactivated) return; if (currentStatus != Status.Interactive) throw new InvalidOperationException("Cannot call Deactivate() until RaiseInsertionCompleted() has finished."); if (e == null) e = new SnippetEventArgs(DeactivateReason.Unknown); TextDocumentWeakEventManager.UpdateFinished.RemoveListener(Document, this); currentStatus = Status.RaisingDeactivated; TextArea.PopStackedInputHandler(myInputHandler); foreach (IActiveElement element in registeredElements) { element.Deactivate(e); } if (Deactivated != null) Deactivated(this, e); currentStatus = Status.Deactivated; }
public void Deactivate(SnippetEventArgs e) { TextDocumentWeakEventManager.TextChanged.RemoveListener(context.Document, this); context.TextArea.TextView.BackgroundRenderers.Remove(background); context.TextArea.TextView.BackgroundRenderers.Remove(foreground); context.TextArea.Caret.PositionChanged -= Caret_PositionChanged; }