/// <summary> /// Main method to link the source ranges and start refactoring /// </summary> /// <param name="context"></param> /// <param name="ranges"></param> public static void ApplyRename(RefactoringContext context, FileSourceRangeCollection ranges) { if ((ranges != null) && (ranges.Count != 0)) { LinkedTextHelper.breakLinks(context, ranges); LinkedTextHelper.setUpLinks(context, ranges); } }
/// <summary> /// Creates links between all the ranges passed as parameter /// </summary> /// <param name="context"></param> /// <param name="ranges"></param> private static void setUpLinks(RefactoringContext context, FileSourceRangeCollection ranges) { if (LinkedTextHelper.isOneDocumentLidList(context.Document, ranges)) { LinkedTextHelper.setUpLinksForDocument(context.Document, ranges); } else { CodeRush.LinkedIdentifiers.NewMultiDocumentContainer().AddRange(ranges); } CodeRush.LinkedIdentifiers.Invalidate(context.Document); }
private void executeRefactoring(ApplyContentEventArgs ea) { try { if (actionIsAvailable(ea.Element)) { FileSourceRangeCollection collection = extractHqlNamedQuery(ea.Element); if (collection != null) { RefactoringContext context = new RefactoringContext(ea); LinkedTextHelper.ApplyRename(context, collection); } } } catch (Exception ex) { ShowException(ex); } }