Code cleanup.
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/documentation/MLCommentDocumentationProvider.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/documentation/MLCommentDocumentationProvider.java
index aac7d9c..4917b06 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/documentation/MLCommentDocumentationProvider.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/documentation/MLCommentDocumentationProvider.java
@@ -33,14 +33,13 @@
private static final List<Pattern> CLEAN_UP = new ArrayList<Pattern>();
static {
- addToCleanUp("\\A/\\*\\*?");
- addToCleanUp("\\*/\\z");
- addToCleanUp("(?m)^( |\\t)*\\** ?");
- addToCleanUp("(?m)( |\\t)*\\**( |\\t)*$");
+ addToCleanUp("\\A/\\*\\*?", "\\*/\\z", "(?m)^( |\\t)*\\** ?", "(?m)( |\\t)*\\**( |\\t)*$");
}
- private static void addToCleanUp(String regex) {
- CLEAN_UP.add(Pattern.compile(regex));
+ private static void addToCleanUp(String...patterns) {
+ for (String p : patterns) {
+ CLEAN_UP.add(Pattern.compile(p));
+ }
}
@Inject private INodes nodes;
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/documentation/SLCommentDocumentationProvider.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/documentation/SLCommentDocumentationProvider.java
index 02763d9..eaab068 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/documentation/SLCommentDocumentationProvider.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/documentation/SLCommentDocumentationProvider.java
@@ -15,6 +15,7 @@
import org.eclipse.xtext.documentation.IEObjectDocumentationProvider;
import org.eclipse.xtext.nodemodel.*;
+import java.util.*;
import java.util.regex.Pattern;
import com.google.eclipse.protobuf.model.util.*;
@@ -30,7 +31,17 @@
public class SLCommentDocumentationProvider implements IEObjectDocumentationProvider {
private static final Pattern COMMENT_START = Pattern.compile("//\\s*"); // "//" plus any whitespace
- private static final Pattern[] NEW_LINE = { Pattern.compile("\\r\\n"), Pattern.compile("\\n") };
+ private static final List<Pattern> NEW_LINE = new ArrayList<Pattern>();
+
+ static {
+ addToNewLine("\\r\\n", "\\n");
+ }
+
+ private static void addToNewLine(String...patterns) {
+ for (String p : patterns) {
+ NEW_LINE.add(Pattern.compile(p));
+ }
+ }
@Inject private FieldOptions fieldOptions;
@Inject private INodes nodes;