本文整理汇总了Java中org.eclipse.search.ui.text.AbstractTextSearchResult.getElements方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractTextSearchResult.getElements方法的具体用法?Java AbstractTextSearchResult.getElements怎么用?Java AbstractTextSearchResult.getElements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.search.ui.text.AbstractTextSearchResult
的用法示例。
在下文中一共展示了AbstractTextSearchResult.getElements方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入方法依赖的package包/类
private synchronized void initialize(AbstractTextSearchResult result) {
fResult= result;
fChildrenMap= new HashMap();
boolean showLineMatches= true; //!((TypeScriptSearchQuery) fResult.getQuery()).isFileNameSearch();
if (result != null) {
Object[] elements= result.getElements();
for (int i= 0; i < elements.length; i++) {
if (showLineMatches) {
Match[] matches= result.getMatches(elements[i]);
for (int j= 0; j < matches.length; j++) {
insert(((TypeScriptMatch) matches[j]).getLineElement(), false);
}
} else {
insert(elements[i], false);
}
}
}
}
示例2: initialize
import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入方法依赖的package包/类
private synchronized void initialize(AbstractTextSearchResult result) {
fResult = result;
fChildrenMap = new HashMap<Object, Set>();
boolean showLineMatches = !((AbstractPythonSearchQuery) fResult.getQuery()).isFileNameSearch();
if (result != null) {
Object[] elements = result.getElements();
for (int i = 0; i < elements.length; i++) {
if (showLineMatches) {
Match[] matches = result.getMatches(elements[i]);
for (int j = 0; j < matches.length; j++) {
insert(((FileMatch) matches[j]).getLineElement(), false);
}
} else {
insert(elements[i], false);
}
}
}
}
示例3: initialize
import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入方法依赖的package包/类
@Override
protected synchronized void initialize(AbstractTextSearchResult result) {
super.initialize(result);
fChildrenMap= new HashMap<Object, Set<Object>>();
if (result != null) {
Object[] elements= result.getElements();
for (int i= 0; i < elements.length; i++) {
if (getPage().getDisplayedMatchCount(elements[i]) > 0) {
insert(null, null, elements[i]);
}
}
}
}
示例4: inputChanged
import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入方法依赖的package包/类
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
elementToTreeNode.clear();
if (newInput instanceof AbstractTextSearchResult) {
AbstractTextSearchResult abstractTextSearchResult = (AbstractTextSearchResult) newInput;
this.fResult = abstractTextSearchResult;
root = new TreeNode<>(null, newInput);
Object[] elements = abstractTextSearchResult.getElements();
int elementsLen = elements.length;
for (int i = 0; i < elementsLen; i++) {
Object object = elements[i];
Match[] matches = abstractTextSearchResult.getMatches(object);
int matchesLen = matches.length;
for (int j = 0; j < matchesLen; j++) {
Match match = matches[j];
if (match instanceof ICustomMatch) {
ICustomMatch moduleMatch = (ICustomMatch) match;
obtainTeeNodeElement(moduleMatch.getLineElement());
} else {
Log.log("Expecting ICustomMatch. Found:" + match.getClass() + " - " + match);
}
}
}
} else {
this.clear();
}
}
示例5: initialize
import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入方法依赖的package包/类
private synchronized void initialize(AbstractTextSearchResult result) {
fResult = result;
fChildrenMap = new HashMap();
if (result != null) {
Object[] elements = result.getElements();
for (int i = 0; i < elements.length; i++) {
insert(elements[i], false);
}
}
}
示例6: getLabel
import org.eclipse.search.ui.text.AbstractTextSearchResult; //导入方法依赖的package包/类
@Override
public String getLabel() {
StructuredViewer viewer = getViewer();
if (viewer instanceof TreeViewer) {
int count = 0;
TreeViewer tv = (TreeViewer) viewer;
final AbstractTextSearchResult input = getInput();
if (input != null) {
ViewerFilter[] filters = tv.getFilters();
if (filters != null && filters.length > 0) {
Object[] elements = input.getElements();
for (int j = 0; j < elements.length; j++) {
Object element = elements[j];
Match[] matches = input.getMatches(element);
for (Match match : matches) {
for (int i = 0; i < filters.length; i++) {
ViewerFilter vf = filters[i];
if (vf instanceof AbstractSearchResultsViewerFilter) {
AbstractSearchResultsViewerFilter searchResultsViewerFilter = (AbstractSearchResultsViewerFilter) vf;
if (searchResultsViewerFilter.isLeafMatch(viewer, match)) {
count += 1;
}
}
}
}
}
} else {
// No active filters
count = input.getMatchCount();
}
}
AbstractTextSearchResult result = getInput();
if (result == null) {
return "";
}
ISearchQuery query = result.getQuery();
if (query instanceof AbstractSearchIndexQuery) {
AbstractSearchIndexQuery searchIndexQuery = (AbstractSearchIndexQuery) query;
return searchIndexQuery.getResultLabel(count);
}
}
return super.getLabel();
}