/** * Source elements returned from this method are instances of <code>IFile</code> or <code> * LocalFileStorage</code>. * * @see org.eclipse.debug.core.sourcelookup.ISourceContainer#findSourceElements(String) */ public Object[] findSourceElements(String name) throws CoreException { File file = new File(name); if (!file.isAbsolute()) { file = new File(fDirectory, name); } List<Object> sources = new ArrayList<Object>(); if (file.exists() && file.isFile()) { sources.addAll(Arrays.asList(SourceUtils.findSourceElements(file, getDirector()))); } else { sources = new ArrayList<Object>(); } // Check sub-folders if (fSubfolders && (isFindDuplicates() || sources.isEmpty())) { for (ISourceContainer container : getSourceContainers()) { Object[] elements = container.findSourceElements(name); if (elements == null || elements.length == 0) { continue; } if (isFindDuplicates()) { for (Object element : elements) sources.add(element); } else { sources.add(elements[0]); break; } } } if (sources.isEmpty()) return EMPTY; return sources.toArray(); }
private IEditorInput findFileInCommonSourceLookup(IPath path) { try { AbstractSourceLookupDirector director = CDebugCorePlugin.getDefault().getCommonSourceLookupDirector(); ISourceContainer[] c = director.getSourceContainers(); for (ISourceContainer sourceContainer : c) { Object[] o = sourceContainer.findSourceElements(path.toOSString()); for (Object object : o) { if (object instanceof IFile) { return new FileEditorInput((IFile)object); } else if (object instanceof LocalFileStorage) { LocalFileStorage storage = (LocalFileStorage) object; IFileStore ifs = EFS.getStore(storage.getFile().toURI()); return new FileStoreEditorInput(ifs); } } } } catch (Exception _) { // do nothing } return null; }