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


Java Match.getElement方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: showMatch

import org.eclipse.search.ui.text.Match; //导入方法依赖的package包/类
protected void showMatch(Match match, int offset, int length, boolean activate) throws PartInitException {
	IFile file= (IFile) match.getElement();
	IWorkbenchPage page= getSite().getPage();
	if (offset >= 0 && length != 0) {
		openAndSelect(page, file, offset, length, activate);
	} else {
		open(page, file, activate);
	}
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:10,代码来源:TypeScriptSearchResultPage.java

示例6: reportMatch

import org.eclipse.search.ui.text.Match; //导入方法依赖的package包/类
public void reportMatch(Match match) {
  IMatchPresentation participant = fParticipant.getUIParticipant();
  if (participant == null
      || match.getElement() instanceof IJavaElement
      || match.getElement() instanceof IResource) {
    fSearchResult.addMatch(match);
  } else {
    fSearchResult.addMatch(match, participant);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:JavaSearchQuery.java

示例7: isShownInEditor

import org.eclipse.search.ui.text.Match; //导入方法依赖的package包/类
public boolean isShownInEditor(Match match, IEditorPart editor) {
	IEditorInput editorInput= editor.getEditorInput();
	if (match.getElement() instanceof FileEntry) {
		IFile file= ((FileEntry) match.getElement()).getPropertiesFile();
		if (editorInput instanceof IFileEditorInput) {
			return ((IFileEditorInput) editorInput).getFile().equals(file);
		}
	} else if (match.getElement() instanceof IJavaElement || match.getElement() instanceof CompilationUnitEntry) {
		IJavaElement je= null;
		if (match.getElement() instanceof IJavaElement) {
			je= (IJavaElement) match.getElement();
		} else {
			je= ((CompilationUnitEntry)match.getElement()).getCompilationUnit();
		}
		if (editorInput instanceof IFileEditorInput) {
			try {
				ICompilationUnit cu= (ICompilationUnit) je.getAncestor(IJavaElement.COMPILATION_UNIT);
				if (cu == null)
					return false;
				else
					return ((IFileEditorInput) editorInput).getFile().equals(cu.getCorrespondingResource());
			} catch (JavaModelException e) {
				return false;
			}
		} else if (editorInput instanceof IClassFileEditorInput) {
			return ((IClassFileEditorInput) editorInput).getClassFile().equals(je.getAncestor(IJavaElement.CLASS_FILE));
		}
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:31,代码来源:NLSSearchResult.java

示例8: getElementToOpen

import org.eclipse.search.ui.text.Match; //导入方法依赖的package包/类
@Override
protected Object getElementToOpen(Match match) {
	Object element= match.getElement();
	if (element instanceof IJavaElement) {
		return element;
	} else if (element instanceof FileEntry) {
		FileEntry fileEntry= (FileEntry) element;
		return fileEntry.getPropertiesFile();
	} else if (element instanceof CompilationUnitEntry) {
		return ((CompilationUnitEntry)element).getCompilationUnit();
	}
	// this should not happen
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:15,代码来源:NLSSearchEditorOpener.java

示例9: reportMatch

import org.eclipse.search.ui.text.Match; //导入方法依赖的package包/类
public void reportMatch(Match match) {
	IMatchPresentation participant= fParticipant.getUIParticipant();
	if (participant == null || match.getElement() instanceof IJavaElement || match.getElement() instanceof IResource) {
		fSearchResult.addMatch(match);
	} else {
		fSearchResult.addMatch(match, participant);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:JavaSearchQuery.java

示例10: isShownInEditor

import org.eclipse.search.ui.text.Match; //导入方法依赖的package包/类
public boolean isShownInEditor(Match match, IEditorPart editor) {
	Object element= match.getElement();
	if (element instanceof IJavaElement) {
		element= ((IJavaElement) element).getOpenable(); // class file or compilation unit
		return element != null && element.equals(editor.getEditorInput().getAdapter(IJavaElement.class));
	} else if (element instanceof IFile) {
		return element.equals(editor.getEditorInput().getAdapter(IFile.class));
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:11,代码来源:AbstractJavaSearchResult.java

示例11: 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:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:JavaSearchResult.java

示例12: addSearchResults

import org.eclipse.search.ui.text.Match; //导入方法依赖的package包/类
private void addSearchResults(final Match[] matches)
{
  for (final Match match : matches)
  {
    final IJiveEvent event = (IJiveEvent) match.getElement();
    // slice queries may return system start events
    if (event instanceof ISystemStartEvent || event instanceof IThreadStartEvent)
    {
      continue;
    }
    // events from threads that are currently hidden are ignored
    if (hiddenThreads.contains(event.thread()))
    {
      continue;
    }
    IInitiatorEvent execution = event.parent();
    if (execution instanceof IMethodCallEvent
        && ((IMethodCallEvent) execution).target().isOutOfModel())
    {
      execution = execution.parent();
    }
    if (!searchResultMap.containsKey(execution))
    {
      searchResultMap.put(execution, new LinkedList<IJiveEvent>());
    }
    searchResultMap.get(execution).add(event);
  }
}
 
开发者ID:UBPL,项目名称:jive,代码行数:29,代码来源:SequenceDiagramEditPart.java

示例13: showMatch

import org.eclipse.search.ui.text.Match; //导入方法依赖的package包/类
@Override
protected void showMatch(final Match match, final int currentOffset, final int currentLength,
    final boolean activate) throws PartInitException
{
  if (match != null)
  {
    final IJiveEvent event = (IJiveEvent) match.getElement();
    showInSequenceDiagram(event);
  }
}
 
开发者ID:UBPL,项目名称:jive,代码行数:11,代码来源:JiveSearchResultPage.java

示例14: showMatch

import org.eclipse.search.ui.text.Match; //导入方法依赖的package包/类
@Override
protected void showMatch(Match match, int offset, int length, boolean activate) throws PartInitException {
    IFile file = (IFile) match.getElement();
    IWorkbenchPage page = getSite().getPage();
    if (offset >= 0 && length != 0) {
        openAndSelect(page, file, offset, length, activate);
    } else {
        open(page, file, activate);
    }
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:11,代码来源:AbstractSearchIndexResultPage.java

示例15: showMatch

import org.eclipse.search.ui.text.Match; //导入方法依赖的package包/类
@Override
protected void showMatch(Match match, int offset, int length, boolean activate) throws PartInitException {
    IFile file = (IFile) match.getElement();
    IWorkbenchPage page = getSite().getPage();
    if (offset >= 0 && length != 0) {
        fEditorOpener.openAndSelect(page, file, offset, length, activate);
    } else {
        fEditorOpener.open(page, file, activate);
    }
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:11,代码来源:FileSearchPage.java


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