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


Java RSyntaxTextArea.getLineCount方法代码示例

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


在下文中一共展示了RSyntaxTextArea.getLineCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTagCloseInfo

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
/**
 * Grabs the token representing the closing of a tag (i.e.
 * "<code>&gt;</code>" or "<code>/&gt;</code>").  This should only be
 * called after a tag name has been parsed, to ensure  the "closing" of
 * other tags is not identified.
 * 
 * @param tagNameToken The token denoting the name of the tag.
 * @param textArea The text area whose contents are being parsed.
 * @param line The line we're currently on.
 * @param info On return, information about the closing of the tag is
 *        returned in this object.
 * @return The line number of the closing tag token.
 */
private int getTagCloseInfo(Token tagNameToken, RSyntaxTextArea textArea,
		int line, TagCloseInfo info) {

	info.reset();
	Token t = tagNameToken.getNextToken();

	do {

		while (t!=null && t.getType()!=Token.MARKUP_TAG_DELIMITER) {
			t = t.getNextToken();
		}

		if (t!=null) {
			info.closeToken = t;
			info.line = line;
			break;
		}

	} while (++line<textArea.getLineCount() &&
			(t=textArea.getTokenListForLine(line))!=null);

	return line;

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

示例2: find

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
private void find(RSyntaxTextArea textArea) {

        try {
            int offset = currentLine < textArea.getLineCount() ? textArea.getLineStartOffset(currentLine) : 0;
            String searchTerm = tfSearchEditor.getText();
            String text = textArea.getText();
            int foundIndex = -1;
            int flags = (checkboxRegexp.isSelected() ? 0 : Pattern.LITERAL)
                    | (checkboxMatchCase.isSelected() ? 0 : Pattern.CASE_INSENSITIVE);
            Pattern p = Pattern.compile(searchTerm, flags);
            Matcher matcher = p.matcher(text);
            matcher.region(offset, text.length());
            if (matcher.find()) {
                foundIndex = matcher.start();
            } else if (checkboxWrap.isSelected() && offset > 0) {
                matcher.region(0, offset);
                if (matcher.find()) {
                    foundIndex = matcher.start();
                }
            }
            if (foundIndex != -1) {
                int lineOfOffset = textArea.getLineOfOffset(foundIndex);
                // textArea.setActiveLineRange(lineOfOffset, lineOfOffset);
                textArea.setCurrentLine(lineOfOffset);
                // textArea.setCaretPosition(foundIndex + searchTerm.length());
                parent.repaint();
                parent.fireStepChanged(lineOfOffset);
                currentLine = lineOfOffset + 1;
            } else {
                JOptionPane.showMessageDialog(parent, "Search String not found.");
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
 
开发者ID:intuit,项目名称:Tank,代码行数:37,代码来源:FindReplaceDialog.java

示例3: getToolTipText

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
/**
 * Overridden to show the content of a collapsed fold on mouse-overs.
 *
 * @param e The mouse location.
 */
@Override
public String getToolTipText(MouseEvent e) {

	String text = null;

	RSyntaxTextArea rsta = (RSyntaxTextArea)textArea;
	if (rsta.isCodeFoldingEnabled()) {
		FoldManager fm = rsta.getFoldManager();
		int pos = rsta.viewToModel(new Point(0, e.getY()));
		if (pos>=0) { // Not -1
			int line = 0;
			try {
				line = rsta.getLineOfOffset(pos);
			} catch (BadLocationException ble) {
				ble.printStackTrace(); // Never happens
				return null;
			}
			Fold fold = fm.getFoldForLine(line);
			if (fold!=null && fold.isCollapsed()) {

				int endLine = fold.getEndLine();
				if (fold.getLineCount()>25) { // Not too big
					endLine = fold.getStartLine() + 25;
				}

				StringBuilder sb = new StringBuilder("<html><nobr>");
				while (line<=endLine && line<rsta.getLineCount()) { // Sanity
					Token t = rsta.getTokenListForLine(line);
					while (t!=null && t.isPaintable()) {
						t.appendHTMLRepresentation(sb, rsta, true, true);
						t = t.getNextToken();
					}
					sb.append("<br>");
					line++;
				}

				text = sb.toString();

			}
		}
	}

	return text;

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


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