本文整理汇总了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;
}
示例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;
}
示例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);
}
}
示例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();
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}