void _refactorFormatXaml_PreparePreview(object sender, PrepareContentPreviewEventArgs ea) { if (_breakApartPreview != null) { _breakApartPreview.ShowPreview(ea); } }
public void ShowArrow(PrepareContentPreviewEventArgs ea) { if (!this._Up) { ea.AddArrow90(this._Range.End, RefactorColors.ArrowFill, RefactorColors.ArrowOutline); } }
} // GetNewPropertyDeclaration(elementBuilder, oldProperty) /// <summary> /// Refactoring provider prepare preview /// </summary> private void refactoringProvider_PreparePreview(object sender, PrepareContentPreviewEventArgs ea) { if (_Property != null && ea.SelectedSubMenuItem != null) { ElementBuilder elementBuilder = ea.NewElementBuilder(); string newCode = string.Empty; switch (ea.SelectedSubMenuItem.Name) { case MenuItem_ConvertTo_XPOProperty: newCode = GetNewPropertyDeclaration(elementBuilder, _Property); break; case MenuItem_ConvertTo_DelayedProperty: newCode = GetNewDelayedPropertyDeclaration(elementBuilder, _Property); break; } // switch if (!string.IsNullOrEmpty(newCode)) { ea.AddCodePreview(_Property.Range.Start, newCode.Trim()); ea.AddStrikethrough(_Property.Range); // How remove field variable used by that property? //if (_IsXpoProperty && _Property.HasGetter) // ea.AddStrikethrough(_Property.Getter.LastChild.FirstDetail.Range); } } // if } // refactoringProvider_PreparePreview(sender, ea)
private void cpConvertToJQuery_PreparePreview(object sender, PrepareContentPreviewEventArgs ea) { if (!IsAvailable(ea.Element)) return; ea.AddPreviewRange(ea.Element.Range); ea.AddStrikethrough(ea.Element.Range); ea.AddCodePreview(ea.Element.Range.Start, GetSource(ea.Element as MethodCallExpression)); }
private void rpRenameXamlNamespacePrefix_PreparePreview(object sender, PrepareContentPreviewEventArgs ea) { IEnumerable <TagPrefix> tagPrefixes = GetTagPrefixes(ea.Element); foreach (TagPrefix tagPrefix in tagPrefixes) { ea.AddBrushStrokeHighlighter(tagPrefix.Range, RefactorColors.ChangeCode); } }
private void cpConvertToJQuery_PreparePreview(object sender, PrepareContentPreviewEventArgs ea) { if (!IsAvailable(ea.Element)) { return; } ea.AddPreviewRange(ea.Element.Range); ea.AddStrikethrough(ea.Element.Range); ea.AddCodePreview(ea.Element.Range.Start, GetSource(ea.Element as MethodCallExpression)); }
private void rpUseNamedParameters_PreparePreview(object sender, PrepareContentPreviewEventArgs ea) { LanguageElement originalCall = GetMethodCall(ea.Element); string generatedCode = GetGeneratedCode(originalCall); if (String.IsNullOrEmpty(generatedCode)) { return; } ea.AddCodePreview(originalCall.Range.Start, generatedCode); }
public void ShowPreview(PrepareContentPreviewEventArgs ea) { if (ea.TextView != null) { foreach (PreviewRange range in this) { range.ShowArrow(ea); } foreach (PreviewRange range2 in this) { ea.AddBrushStrokeHighlighter(range2.Range, RefactorColors.MoveCode); } this._PreviewShown = true; } }
private void cpDisposeFields_PreparePreview(object sender, PrepareContentPreviewEventArgs ea) { ea.AddCodePreview(_OldIfDisposingBlockRange.Top, _CodeForNewIfDisposingBlock); ea.AddStrikethrough(_OldIfDisposingBlockRange); }
private void refConvertToConstructorCall_PreparePreview(object sender, PrepareContentPreviewEventArgs ea) { ea.AddCodePreview(_DeleteRange.Start, _NewCall); ea.AddStrikethrough(_DeleteRange); }
private void cpRemoveOuterBlock_PreparePreview(object sender, PrepareContentPreviewEventArgs ea) { CalculateCode(ea.Element as ParentingStatement); ea.AddCodePreview(_DeleteRange.Top, _NewCode); ea.AddStrikethrough(_DeleteRange); }
private void CorrectReturnType_PreparePreview(object sender, PrepareContentPreviewEventArgs ea) { Method method = ea.Element.GetParentMethod(); SourceRange OldTypeRange = GetMethodReturnTypeRange(method); ea.AddStrikethrough(OldTypeRange); var Return = (Return)ea.Element; string Code = GetExpressionTypeCode(Return.Expression); ea.AddCodePreview(OldTypeRange.Start, Code); }
private void rpUseNamedParameters_PreparePreview(object sender, PrepareContentPreviewEventArgs ea) { LanguageElement originalCall = GetMethodCall(ea.Element); string generatedCode = GetGeneratedCode(originalCall); if (String.IsNullOrEmpty(generatedCode)) return; ea.AddCodePreview(originalCall.Range.Start, generatedCode); }
private void refactoringUpdateNamespace_PreparePreview(object sender, PrepareContentPreviewEventArgs ea) { ea.AddCodePreview(ea.Element.NameRange.Start, ExpectedNamespace(ea.TextDocument.ProjectElement, ea.TextDocument.Path, ea.Element)); ea.AddStrikethrough(ea.Element.NameRange); }
private void cpAssignmentExpressionToEqualityCheck_PreparePreview(object sender, PrepareContentPreviewEventArgs ea) { AssignmentExpression assignmentExpression = GetAssignmentExpression(ea.Element); if (assignmentExpression == null) return; string newEqualityTestCode = GetNewEqualityTestCode(assignmentExpression); ea.AddCodePreview(assignmentExpression.Range.Start, newEqualityTestCode); ea.AddStrikethrough(assignmentExpression.Range); }
private void cpAssignmentExpressionToEqualityCheck_PreparePreview(object sender, PrepareContentPreviewEventArgs ea) { AssignmentExpression assignmentExpression = GetAssignmentExpression(ea.Element); if (assignmentExpression == null) { return; } string newEqualityTestCode = GetNewEqualityTestCode(assignmentExpression); ea.AddCodePreview(assignmentExpression.Range.Start, newEqualityTestCode); ea.AddStrikethrough(assignmentExpression.Range); }
void SplitTag_PreparePreview(object sender, PrepareContentPreviewEventArgs ea) { SP.HtmlElement tag = (SP.HtmlElement)ea.Element.Parent; string code = String.Format("</{0}>{1}<{0}>", tag.Name, System.Environment.NewLine); ea.AddCodePreview(ea.Selection.StartSourcePoint, code); }
private void ChangeToFieldCallRefactoringProvider_PreparePreview(object sender, PrepareContentPreviewEventArgs ea) { var property = ea.Element.GetProperty(); var toReplace = GetCodeElementToReplace(ea.Element, property); var elementBuilder = ea.NewElementBuilder(); string generatedCode = GetChangeToFieldCallCode(elementBuilder, toReplace, property); ea.AddCodePreview(toReplace.Range.Start, generatedCode); ea.AddStrikethrough(toReplace.Range); }
private void rpRenameXamlNamespacePrefix_PreparePreview(object sender, PrepareContentPreviewEventArgs ea) { IEnumerable<TagPrefix> tagPrefixes = GetTagPrefixes(ea.Element); foreach (TagPrefix tagPrefix in tagPrefixes) ea.AddBrushStrokeHighlighter(tagPrefix.Range, RefactorColors.ChangeCode); }
private void cpMoveToSetup_PreparePreview(object sender, PrepareContentPreviewEventArgs ea) { _parentAssignment = ea.Element.FindParentByElementType(LanguageElementType.Assignment) as Assignment; ea.AddStrikethrough(_parentAssignment.Range); ea.AddInsertSymbol(new SourcePoint(_setupMethod.BlockEnd.Bottom.Line - 1, _setupMethod.BlockEnd.Bottom.Offset)); }