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


Java Match类代码示例

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


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


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