示例#1
0
 void _refactorFormatXaml_PreparePreview(object sender, PrepareContentPreviewEventArgs ea)
 {
     if (_breakApartPreview != null)
     {
         _breakApartPreview.ShowPreview(ea);
     }
 }
示例#2
0
 public void ShowArrow(PrepareContentPreviewEventArgs ea)
 {
     if (!this._Up)
     {
         ea.AddArrow90(this._Range.End, RefactorColors.ArrowFill, RefactorColors.ArrowOutline);
     }
 }
示例#3
0
 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));
 }
示例#6
0
        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);
            }
        }
示例#7
0
 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));
 }
示例#8
0
        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);
        }
示例#9
0
 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;
     }
 }
示例#10
0
 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;
     }
 }
示例#11
0
 private void cpDisposeFields_PreparePreview(object sender, PrepareContentPreviewEventArgs ea)
 {
     ea.AddCodePreview(_OldIfDisposingBlockRange.Top, _CodeForNewIfDisposingBlock);
       ea.AddStrikethrough(_OldIfDisposingBlockRange);
 }
        } // 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 refConvertToConstructorCall_PreparePreview(object sender, PrepareContentPreviewEventArgs ea)
 {
     ea.AddCodePreview(_DeleteRange.Start, _NewCall);
     ea.AddStrikethrough(_DeleteRange);
 }
示例#14
0
 private void cpRemoveOuterBlock_PreparePreview(object sender, PrepareContentPreviewEventArgs ea)
 {
     CalculateCode(ea.Element as ParentingStatement);
     ea.AddCodePreview(_DeleteRange.Top, _NewCode);
     ea.AddStrikethrough(_DeleteRange);
 }
示例#15
0
        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);
		}
示例#19
0
        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);
        }
示例#20
0
 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 cpRemoveOuterBlock_PreparePreview(object sender, PrepareContentPreviewEventArgs ea)
 {
     CalculateCode(ea.Element as ParentingStatement);
     ea.AddCodePreview(_DeleteRange.Top, _NewCode);
     ea.AddStrikethrough(_DeleteRange);
 }
        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 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 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));
 }
 void _refactorFormatXaml_PreparePreview(object sender, PrepareContentPreviewEventArgs ea)
 {
     if (_breakApartPreview != null)
     {
         _breakApartPreview.ShowPreview(ea);
     }
 }