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


Java Parser类代码示例

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


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

示例1: addParser

import org.fife.ui.rsyntaxtextarea.parser.Parser; //导入依赖的package包/类
/**
 * Adds a parser for the text area.
 *
 * @param parser The new parser.  If this is <code>null</code>, nothing
 *        happens.
 * @see #getParser(int)
 * @see #removeParser(Parser)
 */
public void addParser(Parser parser) {
	if (parser!=null && !parsers.contains(parser)) {
		if (running) {
			timer.stop();
		}
		parsers.add(parser);
		if (parsers.size()==1) {
			// Okay to call more than once.
			ToolTipManager.sharedInstance().registerComponent(textArea);
		}
		if (running) {
			timer.restart();
		}
	}
}
 
开发者ID:curiosag,项目名称:ftc,代码行数:24,代码来源:ParserManager.java

示例2: clearParserNoticeHighlights

import org.fife.ui.rsyntaxtextarea.parser.Parser; //导入依赖的package包/类
/**
 * Removes all parser notice highlights for a specific parser.
 *
 * @param parser The parser whose highlights to remove.
 */
private void clearParserNoticeHighlights(Parser parser) {
	RSyntaxTextAreaHighlighter h = (RSyntaxTextAreaHighlighter)
										textArea.getHighlighter();
	if (h!=null) {
		h.clearParserHighlights(parser);
	}
	if (noticeHighlightPairs!=null) {
		for (Iterator<NoticeHighlightPair> i=noticeHighlightPairs.iterator(); i.hasNext(); ) {
			NoticeHighlightPair pair = i.next();
			if (pair.notice.getParser()==parser) {
				i.remove();
			}
		}
	}
}
 
开发者ID:curiosag,项目名称:ftc,代码行数:21,代码来源:ParserManager.java

示例3: forceReparsing

import org.fife.ui.rsyntaxtextarea.parser.Parser; //导入依赖的package包/类
/**
 * Forces the given {@link Parser} to re-parse the content of this text
 * area.<p>
 * 
 * This method can be useful when a <code>Parser</code> can be configured
 * as to what notices it returns.  For example, if a Java language parser
 * can be configured to set whether no serialVersionUID is a warning,
 * error, or ignored, this method can be called after changing the expected
 * notice type to have the document re-parsed.
 *
 * @param parser The index of the <code>Parser</code> to re-run.
 * @see #getParser(int)
 */
public void forceReparsing(int parser) {
	Parser p = getParser(parser);
	RSyntaxDocument doc = (RSyntaxDocument)textArea.getDocument();
	String style = textArea.getSyntaxEditingStyle();
	doc.readLock();
	try {
		if (p.isEnabled()) {
			ParseResult res = p.parse(doc, style);
			addParserNoticeHighlights(res);
		}
		else {
			clearParserNoticeHighlights(p);
		}
		textArea.fireParserNoticesChange();
	} finally {
		doc.readUnlock();
	}
}
 
开发者ID:curiosag,项目名称:ftc,代码行数:32,代码来源:ParserManager.java

示例4: clearParserHighlights

import org.fife.ui.rsyntaxtextarea.parser.Parser; //导入依赖的package包/类
/**
 * Removes all of the highlights for a specific parser.
 *
 * @param parser The parser.
 */
public void clearParserHighlights(Parser parser) {

	Iterator<SyntaxLayeredHighlightInfoImpl> i = parserHighlights.iterator();
	for (; i.hasNext(); ) {

		SyntaxLayeredHighlightInfoImpl info = i.next();

		if (info.notice.getParser()==parser) {
		    if (info.width > 0 && info.height > 0) {
		    	textArea.repaint(info.x, info.y, info.width, info.height);
		    }
			i.remove();
		}

	}

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:23,代码来源:RSyntaxTextAreaHighlighter.java

示例5: addParser

import org.fife.ui.rsyntaxtextarea.parser.Parser; //导入依赖的package包/类
/**
 * Adds a parser for the text area.
 * 
 * @param parser
 *            The new parser. If this is <code>null</code>, nothing happens.
 * @see #getParser(int)
 * @see #removeParser(Parser)
 */
public void addParser(Parser parser) {
    if (parser != null && !parsers.contains(parser)) {
        if (running) {
            timer.stop();
        }
        parsers.add(parser);
        if (parsers.size() == 1) {
            // Okay to call more than once.
            ToolTipManager.sharedInstance().registerComponent(textArea);
        }
        if (running) {
            timer.restart();
        }
    }
}
 
开发者ID:intuit,项目名称:Tank,代码行数:24,代码来源:ParserManager.java

示例6: clearParserNoticeHighlights

import org.fife.ui.rsyntaxtextarea.parser.Parser; //导入依赖的package包/类
/**
 * Removes all parser notice highlights for a specific parser.
 * 
 * @param parser
 *            The parser whose highlights to remove.
 */
private void clearParserNoticeHighlights(Parser parser) {
    RSyntaxTextAreaHighlighter h = (RSyntaxTextAreaHighlighter)
            textArea.getHighlighter();
    if (h != null) {
        h.clearParserHighlights(parser);
    }
    if (noticesToHighlights != null) {
        for (Iterator i = noticesToHighlights.entrySet().iterator(); i.hasNext();) {
            Map.Entry entry = (Map.Entry) i.next();
            ParserNotice notice = (ParserNotice) entry.getKey();
            if (notice.getParser() == parser) {
                i.remove();
            }
        }
    }
}
 
开发者ID:intuit,项目名称:Tank,代码行数:23,代码来源:ParserManager.java

示例7: forceReparsing

import org.fife.ui.rsyntaxtextarea.parser.Parser; //导入依赖的package包/类
/**
 * Forces the given {@link Parser} to re-parse the content of this text area.
 * <p>
 * 
 * This method can be useful when a <code>Parser</code> can be configured as to what notices it returns. For
 * example, if a Java language parser can be configured to set whether no serialVersionUID is a warning, error, or
 * ignored, this method can be called after changing the expected notice type to have the document re-parsed.
 * 
 * @param parser
 *            The index of the <code>Parser</code> to re-run.
 * @see #getParser(int)
 */
public void forceReparsing(int parser) {
    Parser p = getParser(parser);
    RSyntaxDocument doc = (RSyntaxDocument) textArea.getDocument();
    String style = textArea.getSyntaxEditingStyle();
    doc.readLock();
    try {
        if (p.isEnabled()) {
            ParseResult res = p.parse(doc, style);
            addParserNoticeHighlights(res);
        }
        else {
            clearParserNoticeHighlights(p);
        }
        textArea.fireParserNoticesChange();
    } finally {
        doc.readUnlock();
    }
}
 
开发者ID:intuit,项目名称:Tank,代码行数:31,代码来源:ParserManager.java

示例8: removeParserNotices

import org.fife.ui.rsyntaxtextarea.parser.Parser; //导入依赖的package包/类
/**
 * Removes all parser notices (and clears highlights in the editor) from a particular parser.
 * 
 * @param parser
 *            The parser.
 */
private void removeParserNotices(Parser parser) {

    if (noticesToHighlights != null) {

        RSyntaxTextAreaHighlighter h = (RSyntaxTextAreaHighlighter)
                textArea.getHighlighter();

        for (Iterator i = noticesToHighlights.entrySet().iterator(); i.hasNext();) {
            Map.Entry entry = (Map.Entry) i.next();
            ParserNotice notice = (ParserNotice) entry.getKey();
            if (notice.getParser() == parser && entry.getValue() != null) {
                h.removeParserHighlight(entry.getValue());
                i.remove();
            }
        }

    }

}
 
开发者ID:intuit,项目名称:Tank,代码行数:26,代码来源:ParserManager.java

示例9: clearParserHighlights

import org.fife.ui.rsyntaxtextarea.parser.Parser; //导入依赖的package包/类
/**
 * Removes all of the highlights for a specific parser.
 * 
 * @param parser
 *            The parser.
 */
public void clearParserHighlights(Parser parser) {

    for (Iterator i = parserHighlights.iterator(); i.hasNext();) {

        HighlightInfo info = (HighlightInfo) i.next();

        if (info.notice.getParser() == parser) {
            if (info instanceof LayeredHighlightInfo) {
                LayeredHighlightInfo lhi = (LayeredHighlightInfo) info;
                if (lhi.width > 0 && lhi.height > 0) {
                    textArea.repaint(lhi.x, lhi.y, lhi.width, lhi.height);
                }
            }
            else {
                TextUI ui = textArea.getUI();
                ui.damageRange(textArea, info.getStartOffset(), info.getEndOffset());
                // safeDamageRange(info.p0, info.p1);
            }
            i.remove();
        }

    }

}
 
开发者ID:intuit,项目名称:Tank,代码行数:31,代码来源:RSyntaxTextAreaHighlighter.java

示例10: clearParserNoticeHighlights

import org.fife.ui.rsyntaxtextarea.parser.Parser; //导入依赖的package包/类
/**
 * Removes all parser notice highlights for a specific parser.
 *
 * @param parser The parser whose highlights to remove.
 */
private void clearParserNoticeHighlights(Parser parser) {
	RSyntaxTextAreaHighlighter h = (RSyntaxTextAreaHighlighter)
										textArea.getHighlighter();
	if (h!=null) {
		h.clearParserHighlights(parser);
	}
	if (noticeHighlightPairs!=null) {
		for (Iterator i=noticeHighlightPairs.iterator(); i.hasNext(); ) {
			NoticeHighlightPair pair = (NoticeHighlightPair)i.next();
			if (pair.notice.getParser()==parser) {
				i.remove();
			}
		}
	}
}
 
开发者ID:Nanonid,项目名称:RSyntaxTextArea,代码行数:21,代码来源:ParserManager.java

示例11: clearParserHighlights

import org.fife.ui.rsyntaxtextarea.parser.Parser; //导入依赖的package包/类
/**
 * Removes all of the highlights for a specific parser.
 *
 * @param parser The parser.
 */
public void clearParserHighlights(Parser parser) {

	for (Iterator<HighlightInfo> i=parserHighlights.iterator(); i.hasNext(); ) {

		HighlightInfo info = (HighlightInfo)i.next();

		if (info.notice.getParser()==parser) {
			if (info instanceof LayeredHighlightInfo) {
				LayeredHighlightInfo lhi = (LayeredHighlightInfo)info;
			    if (lhi.width > 0 && lhi.height > 0) {
			    	textArea.repaint(lhi.x, lhi.y, lhi.width, lhi.height);
			    }
			}
			else {
				TextUI ui = textArea.getUI();
				ui.damageRange(textArea, info.getStartOffset(),info.getEndOffset());
				//safeDamageRange(info.p0, info.p1);
			}
			i.remove();
		}

	}

}
 
开发者ID:Nanonid,项目名称:RSyntaxTextArea,代码行数:30,代码来源:RSyntaxTextAreaHighlighter.java

示例12: forceReparsing

import org.fife.ui.rsyntaxtextarea.parser.Parser; //导入依赖的package包/类
/**
 * Forces re-parsing with a specific parser.  Note that if this parser is
 * not installed on this text area, nothing will happen.
 *
 * @param parser The parser that should re-parse this text area's contents.
 *        This should be installed on this text area.
 * @return Whether the parser was installed on this text area.
 * @see #forceReparsing(int)
 */
public boolean forceReparsing(Parser parser) {
	for (int i=0; i<getParserCount(); i++) {
		if (getParser(i)==parser) {
			forceReparsing(i);
			return true;
		}
	}
	return false;
}
 
开发者ID:curiosag,项目名称:ftc,代码行数:19,代码来源:RSyntaxTextArea.java

示例13: ParserManager

import org.fife.ui.rsyntaxtextarea.parser.Parser; //导入依赖的package包/类
/**
 * Constructor.
 *
 * @param delay The delay between the last key press and when the document
 *        is parsed.
 * @param textArea The text area whose document the parser will be
 *        parsing.
 */
public ParserManager(int delay, RSyntaxTextArea textArea) {
	this.textArea = textArea;
	textArea.getDocument().addDocumentListener(this);
	textArea.addPropertyChangeListener("document", this);
	parsers = new ArrayList<Parser>(1); // Usually small
	timer = new Timer(delay, this);
	timer.setRepeats(false);
	running = true;
}
 
开发者ID:curiosag,项目名称:ftc,代码行数:18,代码来源:ParserManager.java

示例14: removeParser

import org.fife.ui.rsyntaxtextarea.parser.Parser; //导入依赖的package包/类
/**
 * Removes a parser.
 *
 * @param parser The parser to remove.
 * @return Whether the parser was found.
 * @see #addParser(Parser)
 * @see #getParser(int)
 */
public boolean removeParser(Parser parser) {
	removeParserNotices(parser);
	boolean removed = parsers.remove(parser);
	if (removed) {
		textArea.fireParserNoticesChange();
	}
	return removed;
}
 
开发者ID:curiosag,项目名称:ftc,代码行数:17,代码来源:ParserManager.java

示例15: removeParserNotices

import org.fife.ui.rsyntaxtextarea.parser.Parser; //导入依赖的package包/类
/**
 * Removes all parser notices (and clears highlights in the editor) from
 * a particular parser.
 *
 * @param parser The parser.
 */
private void removeParserNotices(Parser parser) {
	if (noticeHighlightPairs!=null) {
		RSyntaxTextAreaHighlighter h = (RSyntaxTextAreaHighlighter)
											textArea.getHighlighter();
		for (Iterator<NoticeHighlightPair> i=noticeHighlightPairs.iterator(); i.hasNext(); ) {
			NoticeHighlightPair pair = i.next();
			if (pair.notice.getParser()==parser && pair.highlight!=null) {
				h.removeParserHighlight(pair.highlight);
				i.remove();
			}
		}
	}
}
 
开发者ID:curiosag,项目名称:ftc,代码行数:20,代码来源:ParserManager.java


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