当前位置: 首页>>代码示例>>Java>>正文


Java ITokenScanner类代码示例

本文整理汇总了Java中org.eclipse.jface.text.rules.ITokenScanner的典型用法代码示例。如果您正苦于以下问题:Java ITokenScanner类的具体用法?Java ITokenScanner怎么用?Java ITokenScanner使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ITokenScanner类属于org.eclipse.jface.text.rules包,在下文中一共展示了ITokenScanner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configure

import org.eclipse.jface.text.rules.ITokenScanner; //导入依赖的package包/类
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);
		}
	}
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:17,代码来源:TagStyleConfigurator.java

示例2: getRecipeScanner

import org.eclipse.jface.text.rules.ITokenScanner; //导入依赖的package包/类
private static ITokenScanner getRecipeScanner(final IDocument doc) {
//		IPreferenceStore store = Activator.getDefault().getPreferenceStore();
		final InnerTagScanner scanner = new InnerTagScanner();
//		store.addPropertyChangeListener(new IPropertyChangeListener() {
//
//			public void propertyChange(PropertyChangeEvent event) {
//				String property = event.getProperty();
//				if (IPreferenceConstants.TAG_FOREGROUND.equals(property)
//						|| IPreferenceConstants.TAG_BACKGROUND.equals(property)) {
//					scanner.updateToken(IPreferenceConstants.TAG_FOREGROUND, IPreferenceConstants.TAG_BACKGROUND);
//
//					if (doc != null) { // 刷新
//						try {
//							doc.replace(doc.getLength(), 0, "");
//						} catch (BadLocationException e) {
//							e.printStackTrace();
//						}
//					}
//				}
//			}
//		});
		return scanner;
	}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:24,代码来源:TagStyleConfigurator.java

示例3: configure

import org.eclipse.jface.text.rules.ITokenScanner; //导入依赖的package包/类
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;
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:19,代码来源:TagStyleConfigurator.java

示例4: getRecipeScanner

import org.eclipse.jface.text.rules.ITokenScanner; //导入依赖的package包/类
private static ITokenScanner getRecipeScanner(final IDocument doc) {
		IPreferenceStore store = Activator.getDefault().getPreferenceStore();
		/*final*/ InnerTagScanner scanner = new InnerTagScanner(store, IColorPreferenceConstant.TAG_FG_COLOR,
				IColorPreferenceConstant.TAG_BG_COLOR);
//		store.addPropertyChangeListener(new IPropertyChangeListener() {
//
//			public void propertyChange(PropertyChangeEvent event) {
//				String property = event.getProperty();
//				if (IColorPreferenceConstant.TAG_FG_COLOR.equals(property)
//						|| IColorPreferenceConstant.TAG_BG_COLOR.equals(property)) {
//					scanner.updateToken(IColorPreferenceConstant.TAG_FG_COLOR, IColorPreferenceConstant.TAG_BG_COLOR);
//
//					if (doc != null) { // 刷新
//						try {
//							doc.replace(doc.getLength(), 0, "");
//						} catch (BadLocationException e) {
//							e.printStackTrace();
//						}
//					}
//				}
//			}
//		});
		return scanner;
	}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:25,代码来源:TagStyleConfigurator.java

示例5: getPresentationReconciler

import org.eclipse.jface.text.rules.ITokenScanner; //导入依赖的package包/类
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
    final PresentationReconciler reconciler = new PresentationReconciler();
    reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
    final SyntaxHighlighter scanner = new SyntaxHighlighter(
            com.abstratt.mdd.frontend.textuml.core.TextUMLConstants.KEYWORDS);
    final DefaultDamagerRepairer dr = new DefaultDamagerRepairer(scanner);
    reconciler.setDamager(dr, ContentTypes.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, ContentTypes.DEFAULT_CONTENT_TYPE);

    // fix bug 2127735 --multiline comment is broken
    final ITokenScanner commentScanner = scanner.getCommentScanner();
    final DefaultDamagerRepairer commentDamagerRepairer = new DefaultDamagerRepairer(commentScanner);
    reconciler.setDamager(commentDamagerRepairer, ContentTypes.COMMENT_CONTENT_TYPE);
    reconciler.setRepairer(commentDamagerRepairer, ContentTypes.COMMENT_CONTENT_TYPE);

    return reconciler;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:18,代码来源:TextUMLSourceViewerConfiguration.java

示例6: getRecipeScanner

import org.eclipse.jface.text.rules.ITokenScanner; //导入依赖的package包/类
private static ITokenScanner getRecipeScanner(final IDocument doc) {
//		IPreferenceStore store = Activator.getDefault().getPreferenceStore();
		InnerTagScanner scanner = new InnerTagScanner();
//		store.addPropertyChangeListener(new IPropertyChangeListener() {
//
//			public void propertyChange(PropertyChangeEvent event) {
//				String property = event.getProperty();
//				if (IPreferenceConstants.TAG_FOREGROUND.equals(property)
//						|| IPreferenceConstants.TAG_BACKGROUND.equals(property)) {
//					scanner.updateToken(IPreferenceConstants.TAG_FOREGROUND, IPreferenceConstants.TAG_BACKGROUND);
//
//					if (doc != null) { // 刷新
//						try {
//							doc.replace(doc.getLength(), 0, "");
//						} catch (BadLocationException e) {
//							e.printStackTrace();
//						}
//					}
//				}
//			}
//		});
		return scanner;
	}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:24,代码来源:TagStyleConfigurator.java

示例7: scan

import org.eclipse.jface.text.rules.ITokenScanner; //导入依赖的package包/类
public static String scan(ITokenScanner scanner, IDocument document) {
    scanner.setRange(document, 0, document.getLength());

    ArrayList<String> found = new ArrayList<String>();
    FastStringBuffer buf = new FastStringBuffer();
    IToken token = scanner.nextToken();
    while (!token.isEOF()) {
        Object data = token.getData();
        if (data != null) {
            buf.clear();
            buf.append(data.toString()).append(":");
            buf.append(scanner.getTokenOffset()).append(":");
            buf.append(scanner.getTokenLength());
            found.add(buf.toString());
        } else {
            buf.clear();
            buf.append("null").append(":");
            buf.append(scanner.getTokenOffset()).append(":");
            buf.append(scanner.getTokenLength());
            found.add(buf.toString());
        }
        token = scanner.nextToken();
    }
    return listToExpected(found);
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:26,代码来源:TestUtils.java

示例8: getPresentationReconciler

import org.eclipse.jface.text.rules.ITokenScanner; //导入依赖的package包/类
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
	
	DSLPresentationReconciler reconciler = new DSLPresentationReconciler(sourceViewer);
	ITokenScanner scanner = new TokenScanner();
	String contentType = IDocument.DEFAULT_CONTENT_TYPE;
	// TODO preference store
	long delay = 300;
	DefaultDamagerRepairer dr = new DelayedDamagerRepairer(scanner, reconciler, delay);
	reconciler.setDamager(dr, contentType);
	reconciler.setRepairer(dr, contentType);
	
	// IResource file = this.extractResource(this.editor);
	
	return reconciler;
}
 
开发者ID:ngs-doo,项目名称:dsl-compiler-client,代码行数:17,代码来源:DSLSourceViewerConfiguration.java

示例9: getTLACodeScanner

import org.eclipse.jface.text.rules.ITokenScanner; //导入依赖的package包/类
/**
 * @return
 */
public ITokenScanner getTLACodeScanner()
{
    if (tlaCodeScanner== null) 
    {
        tlaCodeScanner = new TLACodeScanner();
    }
    return tlaCodeScanner; 
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:12,代码来源:TLAEditorActivator.java

示例10: getPCALCodeScanner

import org.eclipse.jface.text.rules.ITokenScanner; //导入依赖的package包/类
public ITokenScanner getPCALCodeScanner()
{
    if (pcalCodeScanner== null) 
    {
        pcalCodeScanner = new PCALCodeScanner();
    }
    return pcalCodeScanner; 
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:9,代码来源:TLAEditorActivator.java

示例11: getPreProcessorScanner

import org.eclipse.jface.text.rules.ITokenScanner; //导入依赖的package包/类
/**
 * getPreProcessorScanner
 * 
 * @return
 */
private ITokenScanner getPreProcessorScanner()
{
	XMLTagScanner preProcessorScanner = new XMLTagScanner();

	preProcessorScanner.setDefaultReturnToken(getToken("meta.tag.preprocessor.xml.svg")); //$NON-NLS-1$

	return preProcessorScanner;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:14,代码来源:SVGSourceConfiguration.java

示例12: processLanguage

import org.eclipse.jface.text.rules.ITokenScanner; //导入依赖的package包/类
protected void processLanguage(String language, short endToken) throws IOException, Exception
{
	ITokenScanner tokenScanner = fScanner.getTokenScanner().getPrimaryTokenScanner();
	if (tokenScanner instanceof HTMLTokenScanner)
	{
		((HTMLTokenScanner) tokenScanner).setInsideSpecialTag(true);
	}

	Symbol startTag = fCurrentSymbol;
	advance();

	int start = fCurrentSymbol.getStart();
	int end = start - 1;
	short id = fCurrentSymbol.getId();
	while (id != endToken && id != HTMLTokens.EOF)
	{
		end = fCurrentSymbol.getEnd();
		advance();
		id = fCurrentSymbol.getId();
	}

	if (tokenScanner instanceof HTMLTokenScanner)
	{
		((HTMLTokenScanner) tokenScanner).setInsideSpecialTag(false);
	}

	IParseNode[] nested = getParseResult(language, start, end);
	if (fCurrentElement != null)
	{
		HTMLSpecialNode node = new HTMLSpecialNode(startTag, nested, startTag.getStart(), fCurrentSymbol.getEnd());
		node.setEndNode(fCurrentSymbol.getStart(), fCurrentSymbol.getEnd());
		parseAttribute(node, startTag);
		fCurrentElement.addChild(node);
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:36,代码来源:HTMLParser.java

示例13: ThemeingDamagerRepairer

import org.eclipse.jface.text.rules.ITokenScanner; //导入依赖的package包/类
public ThemeingDamagerRepairer(ITokenScanner scanner)
{
	super(scanner);
	maxLinesToColor = Platform.getPreferencesService().getInt(CommonEditorPlugin.PLUGIN_ID,
			IPreferenceConstants.EDITOR_MAX_COLORED_COLUMNS,
			IPreferenceConstants.EDITOR_MAX_COLORED_COLUMNS_DEFAULT,
			new IScopeContext[] { EclipseUtil.instanceScope(), EclipseUtil.defaultScope() });
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:9,代码来源:ThemeingDamagerRepairer.java

示例14: Entry

import org.eclipse.jface.text.rules.ITokenScanner; //导入依赖的package包/类
public Entry(ITokenScanner tokenScanner, IToken token, int offset, int length)
{
	this.tokenScanner = tokenScanner;
	this.token = token;
	this.offset = offset;
	this.length = length;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:8,代码来源:QueuedRuleBasedScanner.java

示例15: getStartEndTokenScanner

import org.eclipse.jface.text.rules.ITokenScanner; //导入依赖的package包/类
private ITokenScanner getStartEndTokenScanner() {
	if (startEndTokenScanner == null) {
		RuleBasedScanner ts = new RuleBasedScanner();
		IToken seqToken = new Token(getStartEndTokenType());
		List<IRule> rules = new ArrayList<IRule>();
		for (String[] pair : getPartitionerSwitchStrategy().getSwitchTagPairs()) {
			rules.add(new SingleTagRule(pair[0], seqToken));
			rules.add(new SingleTagRule(pair[1], seqToken));
		}
		ts.setRules(rules.toArray(new IRule[rules.size()]));
		ts.setDefaultReturnToken(new Token("text")); //$NON-NLS-1$
		startEndTokenScanner = ts;
	}
	return startEndTokenScanner;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:16,代码来源:CompositeSourceViewerConfiguration.java


注:本文中的org.eclipse.jface.text.rules.ITokenScanner类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。