private IFile getResource(MarkdownEditor markdownEditor) { IPathEditorInput input = (IPathEditorInput) getEditorInput(); IPath path = input.getPath(); IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRoot root = workspace.getRoot(); IFile[] files = root.findFilesForLocation(path); if (files.length != 1) return null; IFile docFile = files[0]; return docFile; }
/** * Checks whether there given file store points * to a file in the workspace. Only returns a * workspace file if there's a single match. * * @param fileStore the file store * @return the <code>IFile</code> that matches the given file store * @since 3.2 */ private IFile getWorkspaceFile(IFileStore fileStore) { IWorkspaceRoot workspaceRoot= ResourcesPlugin.getWorkspace().getRoot(); IFile[] files= workspaceRoot.findFilesForLocation(URIUtil.toPath(fileStore.toURI())); if (files != null && files.length == 1) return files[0]; return null; }
private CMDocument buildCMDocumentFromDirectory(File file) { IFile[] foundFilesForLocation = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(new Path(file.getPath())); for (int i = 0; i < foundFilesForLocation.length; i++) { if (foundFilesForLocation[i].isAccessible() && foundFilesForLocation[i].getType() == IResource.FOLDER) { return buildCMDocumentFromFolder(foundFilesForLocation[i].getFullPath()); } } return null; }
IFile[] files= root.findFilesForLocation(path); for (int i= 0; i < files.length; i++) { IJavaElement el= JavaCore.createCompilationUnitFrom(files[i]);
/** * Returns an IFile from the given uri if possible, null if cannot find * file from uri. * * @param fileString * file system path * @return returns IFile if fileString exists in the workspace */ private IFile getFile(String fileString) { IFile file = null; if (fileString != null) { Path filePath = new Path(fileString); if (filePath.segmentCount() > 1 && ResourcesPlugin.getWorkspace().getRoot().getFile(filePath).exists()) { return ResourcesPlugin.getWorkspace().getRoot().getFile(filePath); } IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(filePath); for (int i = 0; (i < files.length) && (file == null); i++) { if (files[i].exists()) { file = files[i]; } } } return file; }
IFile[] files= root.findFilesForLocation(path); for (int i= 0; i < files.length; i++) { IJavaElement el= JavaCore.createCompilationUnitFrom(files[i]);
/** * Returns the resource in the workspace associated with the given * absolute path, or <code>null</code> if none. The path may have * a device. * * @param path absolute path, or <code>null</code> * @return resource or <code>null</code> */ protected IResource getResource(IPath path) { if (path != null) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); // look for files or folders with the given path @SuppressWarnings("deprecation") IFile[] files = root.findFilesForLocation(path); if (files.length > 0) { return files[0]; } @SuppressWarnings("deprecation") IContainer[] containers = root.findContainersForLocation(path); if (containers.length > 0) { return containers[0]; } if (path.getDevice() == null) { // search relative to the workspace if no device present return root.findMember(path); } } return null; }
/** * Returns the resource in the workspace associated with the given * absolute path, or <code>null</code> if none. The path may have * a device. * * @param path absolute path, or <code>null</code> * @return resource or <code>null</code> */ protected IResource getResource(IPath path) { if (path != null) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); // look for files or folders with the given path @SuppressWarnings("deprecation") IFile[] files = root.findFilesForLocation(path); if (files.length > 0) { return files[0]; } @SuppressWarnings("deprecation") IContainer[] containers = root.findContainersForLocation(path); if (containers.length > 0) { return containers[0]; } if (path.getDevice() == null) { // search relative to the workspace if no device present return root.findMember(path); } } return null; }
/** * Returns the resource in the workspace assciated with the given * absolute path, or <code>null</code> if none. The path may have * a device. * * @param path absolute path, or <code>null</code> * @return resource or <code>null</code> */ private static IResource getResource(IPath path) { if (path != null) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); // look for files or folders with the given path IFile[] files = root.findFilesForLocation(path); if (files.length > 0) { return files[0]; } IContainer[] containers = root.findContainersForLocation(path); if (containers.length > 0) { return containers[0]; } if (path.getDevice() == null) { // search relative to the workspace if no device present return root.findMember(path); } } return null; } }
if (root.findFilesForLocation(antPath).length > 0) {
if (root.findFilesForLocation(filePath).length > 0) {
public void linkActivated() { try { IFile[] files= ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(fExternalPath); if (files.length > 0) { for (int i = 0; i < files.length; i++) { IFile curr= files[0]; IJavaElement element= JavaCore.create(curr); if (element != null && element.exists()) { IEditorPart part= JavaUI.openInEditor(element, true, false); if (part instanceof ITextEditor) { revealLine((ITextEditor) part, fLineNumber); } return; } } } } catch (BadLocationException e) { JavaPlugin.log(e); } catch (PartInitException e) { JavaPlugin.log(e); } catch (JavaModelException e) { JavaPlugin.log(e); } }
IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(baseIPath); if (files.length > 0) baseResource = files[0];
.findFilesForLocation(resourcePath); for (int i = 0; i < files.length; i++) { ((UIMessageHandler)AspectJPlugin.getDefault().getCompilerFactory()
File file= fStore.createXML(checkedProjects); if (file != null) { IFile[] files= fRoot.findFilesForLocation(Path.fromOSString(file.getPath())); if (files != null) { for (int i= 0; i < files.length; i++) {
IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(basePath); if (files.length > 0) file = files[0];
String path = editor.getAbsolutePathFromImport(importItem); IPath iPath = new Path(path); IFile[] files = editor.getProject().getWorkspace().getRoot().findFilesForLocation(iPath); if (null == files || files.length != 1) return;
PersistentWSIContext SSBPcontext = WSPlugin.getInstance().getWSISSBPContext(); IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(new Path(uriStr)); if (files != null && files.length == 1)
PersistentWSIContext SSBPcontext = WSPlugin.getInstance().getWSISSBPContext(); IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(new Path(uriStr)); if (files != null && files.length == 1)