Java Code Examples for org.eclipse.jface.text.rules.ITokenScanner#setRange()
The following examples show how to use
org.eclipse.jface.text.rules.ITokenScanner#setRange() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TagStyleConfigurator.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
public static void configure(TextLayout textLayout) { String text = textLayout.getText(); Document doc = new Document(text); ITokenScanner scanner = getRecipeScanner(doc); scanner.setRange(doc, 0, doc.getLength()); IToken token; while ((token = scanner.nextToken()) != Token.EOF) { int offset = scanner.getTokenOffset(); int length = scanner.getTokenLength(); Object data = token.getData(); if (data != null && data instanceof TextStyle) { TextStyle textStyle = (TextStyle) data; textLayout.setStyle(textStyle, offset, offset + length - 1); } } }
Example 2
Source File: TagStyleConfigurator.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
public static void configure(TextLayout textLayout) { String text = textLayout.getText(); Document doc = new Document(text); ITokenScanner scanner = getRecipeScanner(doc); scanner.setRange(doc, 0, doc.getLength()); IToken token; while ((token = scanner.nextToken()) != Token.EOF) { int offset = scanner.getTokenOffset(); int length = scanner.getTokenLength(); Object data = token.getData(); if (data != null && data instanceof TextStyle) { TextStyle textStyle = (TextStyle) data; textLayout.setStyle(textStyle, offset, offset + length - 1); } } scanner = null; doc = null; }
Example 3
Source File: TagStyleConfigurator.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
public static void configure(TextLayout textLayout) { String text = textLayout.getText(); Document doc = new Document(text); ITokenScanner scanner = getRecipeScanner(doc); scanner.setRange(doc, 0, doc.getLength()); IToken token; while ((token = scanner.nextToken()) != Token.EOF) { int offset = scanner.getTokenOffset(); int length = scanner.getTokenLength(); Object data = token.getData(); if (data != null && data instanceof TextStyle) { TextStyle textStyle = (TextStyle) data; textLayout.setStyle(textStyle, offset, offset + length - 1); } } }
Example 4
Source File: TagStyleConfigurator.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
public static void configure(TextLayout textLayout) { String text = textLayout.getText(); Document doc = new Document(text); ITokenScanner scanner = getRecipeScanner(doc); scanner.setRange(doc, 0, doc.getLength()); IToken token; while ((token = scanner.nextToken()) != Token.EOF) { int offset = scanner.getTokenOffset(); int length = scanner.getTokenLength(); Object data = token.getData(); if (data != null && data instanceof TextStyle) { TextStyle textStyle = (TextStyle) data; textLayout.setStyle(textStyle, offset, offset + length - 1); } } }
Example 5
Source File: TagStyleConfigurator.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
public static void configure(TextLayout textLayout) { String text = textLayout.getText(); Document doc = new Document(text); ITokenScanner scanner = getRecipeScanner(doc); scanner.setRange(doc, 0, doc.getLength()); IToken token; while ((token = scanner.nextToken()) != Token.EOF) { int offset = scanner.getTokenOffset(); int length = scanner.getTokenLength(); Object data = token.getData(); if (data != null && data instanceof TextStyle) { TextStyle textStyle = (TextStyle) data; textLayout.setStyle(textStyle, offset, offset + length - 1); } } scanner = null; doc = null; }
Example 6
Source File: QueuedRuleBasedScanner.java From APICloud-Studio with GNU General Public License v3.0 | 2 votes |
/** * Queue the specified delegate token scanner with offset:length range for return by nextToken() The given delegate * will be used until EOF token returned. * * @param tokenScanner * @param offset * @param length */ public void queueDelegate(ITokenScanner tokenScanner, int offset, int length) { tokenScanner.setRange(fDocument, offset, length); queue.add(new Entry(tokenScanner, null, offset, length)); }