Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Unified Diff: editor/tools/plugins/com.google.dart.tools.ui.web/src/com/google/dart/tools/ui/web/html/HtmlPartitionScanner.java

Issue 11673007: Improve our html editor; add syntax highlighting for script tags; hyperlink detection and navigatio… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: editor/tools/plugins/com.google.dart.tools.ui.web/src/com/google/dart/tools/ui/web/html/HtmlPartitionScanner.java
===================================================================
--- editor/tools/plugins/com.google.dart.tools.ui.web/src/com/google/dart/tools/ui/web/html/HtmlPartitionScanner.java (revision 16584)
+++ editor/tools/plugins/com.google.dart.tools.ui.web/src/com/google/dart/tools/ui/web/html/HtmlPartitionScanner.java (working copy)
@@ -16,29 +16,27 @@
import org.eclipse.jface.text.rules.IPredicateRule;
import org.eclipse.jface.text.rules.IToken;
import org.eclipse.jface.text.rules.MultiLineRule;
-import org.eclipse.jface.text.rules.PatternRule;
import org.eclipse.jface.text.rules.RuleBasedPartitionScanner;
import org.eclipse.jface.text.rules.Token;
+import java.util.ArrayList;
+import java.util.List;
+
+@Deprecated
class HtmlPartitionScanner extends RuleBasedPartitionScanner {
public HtmlPartitionScanner() {
IToken htmlComment = new Token(HtmlEditor.HTML_COMMENT_PARTITION);
+ IToken bracketSection = new Token(HtmlEditor.HTML_BRACKET_PARTITION);
IToken templateSection = new Token(HtmlEditor.HTML_TEMPLATE_PARTITION);
- IToken styleSection = new Token(HtmlEditor.HTML_STYLE_PARTITION);
- IToken codeSection = new Token(HtmlEditor.HTML_CODE_PARTITION);
- IPredicateRule[] rules = new IPredicateRule[4];
+ List<IPredicateRule> rules = new ArrayList<IPredicateRule>();
- rules[0] = new MultiLineRule("<!--", "-->", htmlComment);
- rules[1] = new MultiLineRule("{{", "}}", templateSection);
+ rules.add(new MultiLineRule("<!--", "-->", htmlComment));
+ rules.add(new MultiLineRule("<", ">", bracketSection));
+ rules.add(new MultiLineRule("{{", "}}", templateSection));
- // TODO(devoncarew): create a custom IPartitionTokenScanner that can correctly create
- // partitions inside the <foo>...</foo> tags, instead of including the tags themselves.
- rules[2] = new PatternRule("<style", "</style>", styleSection, Character.MIN_VALUE, false);
- rules[3] = new PatternRule("<script", "</script>", codeSection, Character.MIN_VALUE, false);
-
- setPredicateRules(rules);
+ setPredicateRules(rules.toArray(new IPredicateRule[rules.size()]));
}
}

Powered by Google App Engine
This is Rietveld 408576698