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


Java SearchContext.setMarkAll方法代码示例

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


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

示例1: makeCell

import org.fife.ui.rtextarea.SearchContext; //导入方法依赖的package包/类
private Component makeCell(JNode node, int column) {
	if (column == 0) {
		JLabel label = new JLabel(node.makeLongString() + "  ", node.getIcon(), SwingConstants.LEFT);
		label.setOpaque(true);
		label.setToolTipText(label.getText());
		return label;
	}
	if (!node.hasDescString()) {
		return emptyLabel;
	}
	RSyntaxTextArea textArea = new RSyntaxTextArea();
	textArea.setFont(codeFont);
	textArea.setEditable(false);
	textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
	textArea.setText("  " + node.makeDescString());
	textArea.setRows(1);
	textArea.setColumns(textArea.getText().length());
	if (highlightText != null) {
		SearchContext searchContext = new SearchContext(highlightText);
		searchContext.setMatchCase(true);
		searchContext.setMarkAll(true);
		SearchEngine.markAll(textArea, searchContext);
	}
	return textArea;
}
 
开发者ID:skylot,项目名称:jadx,代码行数:26,代码来源:CommonSearchDialog.java

示例2: searchText

import org.fife.ui.rtextarea.SearchContext; //导入方法依赖的package包/类
public void searchText(String operation, boolean regex, boolean matchCase,
		boolean wholeWord, boolean markAll, boolean forSearch) {
	int chosenIndex = tabPane.getSelectedIndex();
	if (chosenIndex < 0) {
		JOptionPane.showMessageDialog(null, "No files opened to search on");
		return;
	}
	RTextScrollPane htmlScroll = (RTextScrollPane) tabPane
			.getComponentAt(chosenIndex);
	RSyntaxTextArea searchtextArea = (RSyntaxTextArea) htmlScroll
			.getViewport().getView();
	SearchContext context = new SearchContext();
	String text = searchField.getText();
	if (text.length() == 0) {
		return;
	}
	context.setSearchFor(text);
	context.setMatchCase(matchCase);
	context.setRegularExpression(regex);
	context.setSearchForward(forSearch);
	context.setWholeWord(wholeWord);
	context.setMarkAll(markAll);
	boolean found = false;
	if (operation.equals("replace")) {
		context.setReplaceWith(repWithField.getText());
		found = SearchEngine.replace(searchtextArea, context).wasFound();
	} else if (operation.equals("replaceAll")) {
		context.setReplaceWith(repWithField.getText());
		found = SearchEngine.replaceAll(searchtextArea, context).wasFound();
	} else {
		found = SearchEngine.find(searchtextArea, context).wasFound();
	}
	if (!found) {
		JOptionPane.showMessageDialog(null, "Text not found");
	}
}
 
开发者ID:csanuragjain,项目名称:APKRepatcher,代码行数:37,代码来源:APKRepatcher.java

示例3: searchInTextarea

import org.fife.ui.rtextarea.SearchContext; //导入方法依赖的package包/类
public void searchInTextarea() {
	String text = samlGUI.getActionPanel().getSearchText();
	SearchContext context = new SearchContext();
	context.setMatchCase(false);
	context.setMarkAll(true);
	context.setSearchFor(text);
	context.setWholeWord(false);
	SearchResult result = SearchEngine.find(textArea, context);
	if (!result.wasFound()) {
		textArea.setCaretPosition(0);
		SearchEngine.find(textArea, context);
	}
}
 
开发者ID:SAMLRaider,项目名称:SAMLRaider,代码行数:14,代码来源:SamlTabController.java

示例4: highlightAllMatches

import org.fife.ui.rtextarea.SearchContext; //导入方法依赖的package包/类
/**
 * @param str - if null -> reset current highlights
 */
private void highlightAllMatches(@Nullable String str) {
	SearchContext context = new SearchContext(str);
	context.setMarkAll(true);
	context.setMatchCase(true);
	context.setWholeWord(true);
	SearchEngine.markAll(this, context);
}
 
开发者ID:skylot,项目名称:jadx,代码行数:11,代码来源:CodeArea.java

示例5: search

import org.fife.ui.rtextarea.SearchContext; //导入方法依赖的package包/类
private void search(int direction) {
	String searchText = searchField.getText();
	if (searchText == null
			|| searchText.length() == 0
			|| rTextArea.getText() == null) {
		return;
	}

	boolean forward = direction >= 0;
	boolean matchCase = matchCaseCB.isSelected();
	boolean regex = regexCB.isSelected();
	boolean wholeWord = wholeWordCB.isSelected();

	SearchContext context = new SearchContext();
	context.setSearchFor(searchText);
	context.setMatchCase(matchCase);
	context.setRegularExpression(regex);
	context.setSearchForward(forward);
	context.setWholeWord(wholeWord);
	context.setMarkAll(markAllCB.isSelected());

	// TODO hack: move cursor before previous search for not jump to next occurrence
	if (direction == 0 && !COLOR_BG_ERROR.equals(searchField.getBackground())) {
		try {
			int caretPos = rTextArea.getCaretPosition();
			int lineNum = rTextArea.getLineOfOffset(caretPos) - 1;
			if (lineNum > 1) {
				rTextArea.setCaretPosition(rTextArea.getLineStartOffset(lineNum));
			}
		} catch (BadLocationException e) {
			LOG.error("Caret move error", e);
		}
	}

	SearchResult result = SearchEngine.find(rTextArea, context);
	if (!result.wasFound()) {
		int pos = SearchEngine.getNextMatchPos(searchText, rTextArea.getText(), forward, matchCase, wholeWord);
		if (pos != -1) {
			rTextArea.setCaretPosition(forward ? 0 : rTextArea.getDocument().getLength() - 1);
			search(direction);
			searchField.setBackground(COLOR_BG_WARN);
			return;
		}
		searchField.setBackground(COLOR_BG_ERROR);
	} else {
		searchField.setBackground(COLOR_BG_NORMAL);
	}
}
 
开发者ID:skylot,项目名称:jadx,代码行数:49,代码来源:SearchBar.java


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