summaryrefslogtreecommitdiff
path: root/platform/lang-impl/src/com/intellij/codeInsight/actions/FormatChangedTextUtil.java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/lang-impl/src/com/intellij/codeInsight/actions/FormatChangedTextUtil.java')
-rw-r--r--platform/lang-impl/src/com/intellij/codeInsight/actions/FormatChangedTextUtil.java30
1 files changed, 13 insertions, 17 deletions
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/FormatChangedTextUtil.java b/platform/lang-impl/src/com/intellij/codeInsight/actions/FormatChangedTextUtil.java
index 3b51cc9ad976..dadafc7a7d84 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/actions/FormatChangedTextUtil.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/FormatChangedTextUtil.java
@@ -250,7 +250,7 @@ public class FormatChangedTextUtil {
}
@NotNull
- public static List<TextRange> getChangedTextRanges(@NotNull Project project, @NotNull PsiFile file) {
+ public static List<TextRange> getChangedTextRanges(@NotNull Project project, @NotNull PsiFile file) throws FilesTooBigForDiffException {
Change change = ChangeListManager.getInstance(project).getChange(file.getVirtualFile());
if (change == null) {
return ContainerUtilRt.emptyList();
@@ -281,7 +281,10 @@ public class FormatChangedTextUtil {
}
@NotNull
- private static List<TextRange> calculateChangedTextRanges(@NotNull Project project, @NotNull PsiFile file, @NotNull String contentFromVcs) {
+ private static List<TextRange> calculateChangedTextRanges(@NotNull Project project,
+ @NotNull PsiFile file,
+ @NotNull String contentFromVcs) throws FilesTooBigForDiffException
+ {
Document documentFromVcs = ((EditorFactoryImpl)EditorFactory.getInstance()).createDocument(contentFromVcs, true, false);
Document document = PsiDocumentManager.getInstance(project).getDocument(file);
@@ -289,23 +292,16 @@ public class FormatChangedTextUtil {
return ContainerUtil.emptyList();
}
- try {
- List<Range> changedRanges;
-
- LineStatusTracker tracker = LineStatusTrackerManager.getInstance(project).getLineStatusTracker(document);
- if (tracker != null) {
- changedRanges = tracker.getRanges();
- }
- else {
- changedRanges = new RangesBuilder(document, documentFromVcs).getRanges();
- }
-
- return getChangedTextRanges(document, changedRanges);
+ List<Range> changedRanges;
+ LineStatusTracker tracker = LineStatusTrackerManager.getInstance(project).getLineStatusTracker(document);
+ if (tracker != null) {
+ changedRanges = tracker.getRanges();
}
- catch (FilesTooBigForDiffException e) {
- LOG.error("Error while calculating changed ranges for: " + file.getVirtualFile(), e);
- return ContainerUtil.emptyList();
+ else {
+ changedRanges = new RangesBuilder(document, documentFromVcs).getRanges();
}
+
+ return getChangedTextRanges(document, changedRanges);
}
@NotNull