• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Match类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: run

import org.eclipse.search.ui.text.Match; //导入依赖的package包/类
@Override
public IStatus run(IProgressMonitor monitor) throws OperationCanceledException {
	startTime = System.currentTimeMillis();
	AbstractTextSearchResult textResult = (AbstractTextSearchResult) getSearchResult();
	textResult.removeAll();

	try {

		IContainer dir = configFile.getParent();
		dir.accept(new AbstractSectionPatternVisitor(section) {

			@Override
			protected void collect(IResourceProxy proxy) {
				Match match = new FileMatch((IFile) proxy.requestResource());
				result.addMatch(match);
			}
		}, IResource.NONE);

		return Status.OK_STATUS;
	} catch (Exception ex) {
		return new Status(IStatus.ERROR, EditorConfigPlugin.PLUGIN_ID, ex.getMessage(), ex);
	}
}
 
开发者ID:angelozerr,项目名称:ec4e,代码行数:24,代码来源:EditorConfigSearchQuery.java


示例2: initialize

import org.eclipse.search.ui.text.Match; //导入依赖的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);
			}
		}
	}
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:20,代码来源:TypeScriptSearchTreeContentProvider.java


示例3: evaluateLineStart

import org.eclipse.search.ui.text.Match; //导入依赖的package包/类
private int evaluateLineStart(Match[] matches, String lineContent, int lineOffset) {
	int max= lineContent.length();
	if (matches.length > 0) {
		TypeScriptMatch match= (TypeScriptMatch) matches[0];
		max= match.getOriginalOffset() - lineOffset;
		if (max < 0) {
			return 0;
		}
	}
	for (int i= 0; i < max; i++) {
		char ch= lineContent.charAt(i);
		if (!Character.isWhitespace(ch) || ch == '\n' || ch == '\r') {
			return i;
		}
	}
	return max;
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:18,代码来源:TypeScriptSearchLabelProvider.java


示例4: collectMatches

import org.eclipse.search.ui.text.Match; //导入依赖的package包/类
private void collectMatches(Set<Match> matches, IJavaElement element) {
  Match[] m = getMatches(element);
  if (m.length != 0) {
    for (int i = 0; i < m.length; i++) {
      matches.add(m[i]);
    }
  }
  if (element instanceof IParent) {
    IParent parent = (IParent) element;
    try {
      IJavaElement[] children = parent.getChildren();
      for (int i = 0; i < children.length; i++) {
        collectMatches(matches, children[i]);
      }
    } catch (JavaModelException e) {
      // we will not be tracking these results
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:AbstractJavaSearchResult.java


示例5: addMatch

import org.eclipse.search.ui.text.Match; //导入依赖的package包/类
boolean addMatch(Match match, IMatchPresentation participant) {
  Object element = match.getElement();
  if (fElementsToParticipants.get(element) != null) {
    // TODO must access the participant id / label to properly report the error.
    JavaPlugin.log(
        new Status(
            IStatus.WARNING,
            JavaPlugin.getPluginId(),
            0,
            "A second search participant was found for an element",
            null)); // $NON-NLS-1$
    return false;
  }
  fElementsToParticipants.put(element, participant);
  addMatch(match);
  return true;
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:JavaSearchResult.java


示例6: collectMatches

import org.eclipse.search.ui.text.Match; //导入依赖的package包/类
private void collectMatches(Set<Match> matches, IJavaElement element) {
	//TODO: copied from JavaSearchResult:
	Match[] m= getMatches(element);
	if (m.length != 0) {
		for (int i= 0; i < m.length; i++) {
			matches.add(m[i]);
		}
	}
	if (element instanceof IParent) {
		IParent parent= (IParent) element;
		try {
			IJavaElement[] children= parent.getChildren();
			for (int i= 0; i < children.length; i++) {
				collectMatches(matches, children[i]);
			}
		} catch (JavaModelException e) {
			// we will not be tracking these results
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:NLSSearchResult.java


示例7: addMatch

import org.eclipse.search.ui.text.Match; //导入依赖的package包/类
private void addMatch(FileEntry groupElement, String propertyName) {
	/*
	 * TODO (bug 63794): Should read in .properties file with our own reader and not
	 * with Properties.load(InputStream) . Then, we can remember start position and
	 * original version (not interpreting escape characters) for each property.
	 *
	 * The current workaround is to escape the key again before searching in the
	 * .properties file. However, this can fail if the key is escaped in a different
	 * manner than what PropertyFileDocumentModel.unwindEscapeChars(.) produces.
	 */
	String escapedPropertyName= PropertyFileDocumentModel.escape(propertyName, false);
	int start= findPropertyNameStartPosition(escapedPropertyName);
	int length;
	if (start == -1) { // not found -> report at beginning
		start= 0;
		length= 0;
	} else {
		length= escapedPropertyName.length();
	}
	fResult.addMatch(new Match(groupElement, start, length));
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:NLSSearchResultRequestor.java


示例8: collectMatches

import org.eclipse.search.ui.text.Match; //导入依赖的package包/类
private void collectMatches(Set<Match> matches, IJavaElement element) {
	Match[] m= getMatches(element);
	if (m.length != 0) {
		for (int i= 0; i < m.length; i++) {
			matches.add(m[i]);
		}
	}
	if (element instanceof IParent) {
		IParent parent= (IParent) element;
		try {
			IJavaElement[] children= parent.getChildren();
			for (int i= 0; i < children.length; i++) {
				collectMatches(matches, children[i]);
			}
		} catch (JavaModelException e) {
			// we will not be tracking these results
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:AbstractJavaSearchResult.java


示例9: computeContainedMatches

import org.eclipse.search.ui.text.Match; //导入依赖的package包/类
public Match[] computeContainedMatches(AbstractTextSearchResult result, IEditorPart editor) {
	//TODO same code in JavaSearchResult
	IEditorInput editorInput= editor.getEditorInput();
	if (editorInput instanceof IFileEditorInput)  {
		IFileEditorInput fileEditorInput= (IFileEditorInput) editorInput;
		return computeContainedMatches(result, fileEditorInput.getFile());

	} else if (editorInput instanceof IClassFileEditorInput) {
		IClassFileEditorInput classFileEditorInput= (IClassFileEditorInput) editorInput;
		IClassFile classFile= classFileEditorInput.getClassFile();

		Object[] elements= getElements();
		if (elements.length == 0)
			return NO_MATCHES;
		//all matches from same file:
		JavaElementLine jel= (JavaElementLine) elements[0];
		if (jel.getJavaElement().equals(classFile))
			return collectMatches(elements);
	}
	return NO_MATCHES;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:OccurrencesSearchResult.java


示例10: isShownInEditor

import org.eclipse.search.ui.text.Match; //导入依赖的package包/类
public boolean isShownInEditor(Match match, IEditorPart editor) {
	Object element= match.getElement();
	IJavaElement je= ((JavaElementLine) element).getJavaElement();
	IEditorInput editorInput= editor.getEditorInput();
	if (editorInput instanceof IFileEditorInput) {
		try {
			return ((IFileEditorInput)editorInput).getFile().equals(je.getCorrespondingResource());
		} catch (JavaModelException e) {
			return false;
		}
	} else if (editorInput instanceof IClassFileEditorInput) {
		return ((IClassFileEditorInput)editorInput).getClassFile().equals(je);
	}

	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:OccurrencesSearchResult.java


示例11: showMatch

import org.eclipse.search.ui.text.Match; //导入依赖的package包/类
@Override
public void showMatch(Match match, int offset, int length, boolean activate) throws PartInitException {
	IEditorPart editor= fEditorOpener.openMatch(match);

	if (editor != null && activate)
		editor.getEditorSite().getPage().activate(editor);
	Object element= match.getElement();
	if (editor instanceof ITextEditor) {
		ITextEditor textEditor= (ITextEditor) editor;
		textEditor.selectAndReveal(offset, length);
	} else if (editor != null) {
		if (element instanceof IFile) {
			IFile file= (IFile) element;
			showWithMarker(editor, file, offset, length);
		}
	} else if (getInput() instanceof JavaSearchResult) {
		JavaSearchResult result= (JavaSearchResult) getInput();
		IMatchPresentation participant= result.getSearchParticpant(element);
		if (participant != null)
			participant.showMatch(match, offset, length, activate);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:JavaSearchResultPage.java


示例12: removeSearchResults

import org.eclipse.search.ui.text.Match; //导入依赖的package包/类
private void removeSearchResults(final Match[] matches)
{
  final IExecutionModel model = executionModel();
  model.readLock();
  try
  {
    for (final Match match : matches)
    {
      final IJiveEvent event = (IJiveEvent) match.getElement();
      final IInitiatorEvent execution = event.parent();
      if (searchResultMap.containsKey(execution))
      {
        final List<IJiveEvent> results = searchResultMap.get(execution);
        results.remove(event);
        if (results.isEmpty())
        {
          searchResultMap.remove(execution);
        }
      }
    }
  }
  finally
  {
    model.readUnlock();
  }
}
 
开发者ID:UBPL,项目名称:jive,代码行数:27,代码来源:SequenceDiagramEditPart.java


示例13: search

import org.eclipse.search.ui.text.Match; //导入依赖的package包/类
protected void search(final IProgressMonitor monitor, final IQueryFactory queryFactory)
{
  final EventQuery query = createQuery(queryFactory);
  if (query == null)
  {
    return;
  }
  final JiveSearchResult result = (JiveSearchResult) getSearchResult();
  query.open();
  try
  {
    while (!monitor.isCanceled() && query.processEvent())
    {
      // add a result only if the last processed event was a match
      if (query.match() != null)
      {
        result.addMatch(new Match(query.match(), 0, 1));
      }
    }
  }
  finally
  {
    query.close();
  }
}
 
开发者ID:UBPL,项目名称:jive,代码行数:26,代码来源:JiveSearchQuery.java


示例14: evaluateLineStart

import org.eclipse.search.ui.text.Match; //导入依赖的package包/类
private int evaluateLineStart(Match[] matches, String lineContent, int lineOffset) {
    int max = lineContent.length();
    if (matches.length > 0) {
        ICustomMatch match = (ICustomMatch) matches[0];
        max = match.getOriginalOffset() - lineOffset;
        if (max < 0) {
            return 0;
        }
    }
    for (int i = 0; i < max; i++) {
        char ch = lineContent.charAt(i);
        if (!Character.isWhitespace(ch) || ch == '\n' || ch == '\r') {
            return i;
        }
    }
    return max;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:18,代码来源:SearchIndexLabelProvider.java


示例15: handleDelta

import org.eclipse.search.ui.text.Match; //导入依赖的package包/类
private void handleDelta(IResourceDelta d) {
    try {
        d.accept(new IResourceDeltaVisitor() {
            @Override
            public boolean visit(IResourceDelta delta) throws CoreException {
                switch (delta.getKind()) {
                    case IResourceDelta.ADDED:
                        return false;
                    case IResourceDelta.REMOVED:
                        IResource res = delta.getResource();
                        if (res instanceof IFile) {
                            Match[] matches = fResult.getMatches(res);
                            fResult.removeMatches(matches);
                        }
                        break;
                    case IResourceDelta.CHANGED:
                        // handle changed resource (remove existing matches and redo search in file).
                        break;
                }
                return true;
            }
        });
    } catch (CoreException e) {
        Log.log(e);
    }
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:27,代码来源:SearchResultUpdater.java


示例16: getDisplayedMatches

import org.eclipse.search.ui.text.Match; //导入依赖的package包/类
@Override
public Match[] getDisplayedMatches(Object element) {
    if (element instanceof TreeNode<?>) {
        element = ((TreeNode<?>) element).data;
    }

    if (element instanceof ICustomModule) {
        ICustomModule customModule = (ICustomModule) element;
        element = customModule.getModuleLineElement();
    }

    if (element instanceof ICustomLineElement) {
        ICustomLineElement lineEntry = (ICustomLineElement) element;
        return lineEntry.getMatches(getInput());
    }
    return new Match[0];
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:18,代码来源:AbstractSearchIndexResultPage.java


示例17: initialize

import org.eclipse.search.ui.text.Match; //导入依赖的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);
            }
        }
    }
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:20,代码来源:FileTreeContentProvider.java


示例18: handleDelta

import org.eclipse.search.ui.text.Match; //导入依赖的package包/类
private void handleDelta(IResourceDelta d) {
    try {
        d.accept(new IResourceDeltaVisitor() {
            @Override
            public boolean visit(IResourceDelta delta) throws CoreException {
                switch (delta.getKind()) {
                    case IResourceDelta.ADDED:
                        return false;
                    case IResourceDelta.REMOVED:
                        IResource res = delta.getResource();
                        if (res instanceof IFile) {
                            Match[] matches = fResult.getMatches(res);
                            fResult.removeMatches(matches);
                        }
                        break;
                    case IResourceDelta.CHANGED:
                        // handle changed resource
                        break;
                }
                return true;
            }
        });
    } catch (CoreException e) {
        Log.log(e);
    }
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:27,代码来源:SearchResultUpdater.java


示例19: evaluateLineStart

import org.eclipse.search.ui.text.Match; //导入依赖的package包/类
private int evaluateLineStart(Match[] matches, String lineContent, int lineOffset) {
    int max = lineContent.length();
    if (matches.length > 0) {
        FileMatch match = (FileMatch) matches[0];
        max = match.getOriginalOffset() - lineOffset;
        if (max < 0) {
            return 0;
        }
    }
    for (int i = 0; i < max; i++) {
        char ch = lineContent.charAt(i);
        if (!Character.isWhitespace(ch) || ch == '\n' || ch == '\r') {
            return i;
        }
    }
    return max;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:18,代码来源:FileLabelProvider.java


示例20: doAddMatch

import org.eclipse.search.ui.text.Match; //导入依赖的package包/类
private boolean doAddMatch(Match match) {
  updateFilterState(match);

  List matches = (List) fElementsToMatches.get(match.getElement());
  if (matches == null) {
    matches = new ArrayList();
    fElementsToMatches.put(match.getElement(), matches);
    matches.add(match);
    return true;
  }
  if (!matches.contains(match)) {
    insertSorted(matches, match);
    return true;
  }
  return false;
}
 
开发者ID:agusevas,项目名称:logan,代码行数:17,代码来源:TextSearchResult.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Page类代码示例发布时间:2022-05-21
下一篇:
Java FontFactory类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap