private Object findSourceElement(ISourceContainer[] containers, String typeName) throws CoreException { for (int i = 0; i < containers.length; i++) { Object[] result = containers[i].findSourceElements(typeName); if (result.length > 0) return result[0]; } return null; }
/** * Given a source name info, search the associated source file or class file from the source container list. * * @param sourcePath * the target source name (e.g. com\microsoft\java\debug\xxx.java). * @param containers * the source container list. * @return the associated source file or class file. */ public static Object findSourceElement(String sourcePath, ISourceContainer[] containers) { if (containers == null) { return null; } for (ISourceContainer container : containers) { try { Object[] objects = container.findSourceElements(sourcePath); if (objects.length > 0 && (objects[0] instanceof IResource || objects[0] instanceof IClassFile)) { return objects[0]; } } catch (CoreException e) { // do nothing. } } return null; }
@Override public Object[] findSourceElements(Object element) throws CoreException { ISourceContainer container = getSourceContainer(element, false /* don't refresh cache */, null /* async */ ); if (container == null) { return null; } String sourcePath = jdi.getSourcePath(element); if (sourcePath == null) { // can't really happen return null; } return container.findSourceElements(sourcePath); }
ISourceContainer[] containers = getSourceContainers(); for (int i=0; i < containers.length; i++) { Object[] objects = containers[i].findSourceElements(name); if (objects == null || objects.length == 0) { continue;
private IResource findMostSpecific(String sourceFile) throws CoreException { IResource resolved = null; int shortestPath = Integer.MAX_VALUE; for (ISourceContainer container : sourceContainer.getSourceContainers()) { Object[] paths = container.findSourceElements(sourceFile); for (Object path : paths) { if (path instanceof IFile) { IFile file = (IFile) path; IPath p = file.getFullPath(); if (p instanceof Path) { int count = ((Path) p).segmentCount(); if (count < shortestPath) { shortestPath = count; resolved = file; } } } } } return resolved; }
ISourceContainer container = containers[i]; try { Object[] objects = container.findSourceElements(name); if (objects.length > 0) {
ISourceContainer container = getDelegateContainer(containers[i]); if (container != null) { Object[] objects = container.findSourceElements(name); if (objects.length > 0) {
ISourceContainer[] containers = getSourceContainers(); for (int i=0; i < containers.length; i++) { Object[] objects = containers[i].findSourceElements(name); if (objects == null || objects.length == 0) { continue;