From 36e22c430bc254faee6b2c64ec034cb9706d6808 Mon Sep 17 00:00:00 2001 From: Maxim Shafirov Date: Tue, 8 Feb 2005 21:53:20 +0300 Subject: [PATCH] Making some methods static. Preparing to extract chunk extraction algorithm. --- .../com/intellij/usages/UsageInfo2UsageAdapter.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/UsageView/src/com/intellij/usages/UsageInfo2UsageAdapter.java b/UsageView/src/com/intellij/usages/UsageInfo2UsageAdapter.java index cee87b14b647..96dd4cc9e0ce 100644 --- a/UsageView/src/com/intellij/usages/UsageInfo2UsageAdapter.java +++ b/UsageView/src/com/intellij/usages/UsageInfo2UsageAdapter.java @@ -93,7 +93,7 @@ public class UsageInfo2UsageAdapter implements Usage, UsageInModule, UsageInLibr private void initChunks() { int lineStartOffset = myDocument.getLineStartOffset(myLineNumber); int lineEndOffset = myDocument.getLineEndOffset(myLineNumber); - myTextChunks = createTextChunks(myPsiFile.getFileType().getHighlighter(myPsiFile.getProject()), lineStartOffset, lineEndOffset); + myTextChunks = createTextChunks(myDocument.getCharsSequence(), myPsiFile.getFileType().getHighlighter(myPsiFile.getProject()), lineStartOffset, lineEndOffset); } public UsagePresentation getPresentation() { @@ -171,7 +171,7 @@ public class UsageInfo2UsageAdapter implements Usage, UsageInModule, UsageInLibr return project; } - public int compareTo(Usage usage) { + public static int compareTo(Usage usage) { return 0; } @@ -247,14 +247,16 @@ public class UsageInfo2UsageAdapter implements Usage, UsageInModule, UsageInLibr } } - private TextChunk[] createTextChunks(SyntaxHighlighter highlighter, int start, int end) { + private TextChunk[] createTextChunks(final CharSequence chars, + SyntaxHighlighter highlighter, + int start, + int end) { LOG.assertTrue(start <= end); List result = new ArrayList(); appendPrefix(result); Lexer lexer = highlighter.getHighlightingLexer(); - CharSequence chars = myDocument.getCharsSequence(); lexer.start(CharArrayUtil.fromSequence(chars)); for (int offset = start; offset < end; offset++) { @@ -322,7 +324,7 @@ public class UsageInfo2UsageAdapter implements Usage, UsageInModule, UsageInLibr addChunk(chars, Math.min(hiEnd, usageEnd), hiEnd, originalAttrs, false, result); } - private void addChunk(CharSequence chars, int start, int end, TextAttributes originalAttrs, boolean bold, List result) { + private static void addChunk(CharSequence chars, int start, int end, TextAttributes originalAttrs, boolean bold, List result) { if (start >= end) return; String rText = chars.subSequence(start, end).toString(); TextAttributes attrs = bold