public IResource getResource() { IFile file = ResourcesPlugin.getWorkspace().getRoot() .getFileForLocation(path); return file; }
/** * Return the IResource within the workspace that maps to the given File */ public static IResource findResource(String fullPath) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IPath path = new Path(fullPath); return root.getFileForLocation(path); }
protected Object getSourceModule(String fileName) { IFile f = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(fileName)); return f; }
/** * This will try and resolve the given {@link java.io.File} within the workspace and return it if found. * * @param file * The file we wish to find in the workspace. * @return The resolved IFile if any, <code>null</code> otherwise. */ public static IFile getWorkspaceFile(File file) { return ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(file.getAbsolutePath())); }
private IResource getResourceByParameter(ExecutionEvent event) { String parameter = event.getParameter(RESOURCE_PATH_PARAMETER); if (parameter == null) { return null; } IPath path = new Path(parameter); IResource item = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path); return item; }
private void match(Element node) { IFile file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation( new Path(path)); if(matcher != null){ matcher.locateMatches(pattern, file, node, requestor); } }
public String getLocalFile() { String file = reader.getFile(fileid); if (file.startsWith("file:/")) { IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); IFile iFile = workspaceRoot.getFileForLocation(new Path(file.substring(6))); file = iFile.getFullPath().toString(); } return file; }
public String getLocalFile() { String file = reader.getFile(fileid); if (file.startsWith("file:/")) { IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); IFile iFile = workspaceRoot.getFileForLocation(new Path(file.substring(6))); file = iFile.getFullPath().toString(); } return file; }
/** * * @return org.eclipse.core.resources.IFile * @param location * java.lang.String */ public static IFile location2File(String location) { Path path = new Path(location); IFile file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path); if (file == null && path.segmentCount() > 1) file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); return file; }
public IFile getFile() { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IPath jspPath = new Path(this.fJSPPathString); IFile jspFile = root.getFile(jspPath); if (!jspFile.exists()) { // possibly outside workspace jspFile = root.getFileForLocation(jspPath); } return jspFile; }
/** * Open text editor. * * @param fullPath the full path */ public void openTextEditor(String fullPath) { Path path = new Path(fullPath); IFile fileToOpen = TAEConfiguratorPlugin.getWorkspace().getRoot().getFileForLocation(path); openTextEditor(fileToOpen); }
public static IResource getResource(Path path) { final IPath iPath = getIPath(path); final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); final IResource res = Files.isDirectory(path) ? root.getContainerForLocation(iPath) : root.getFileForLocation(iPath); return res; }
/** * Open. * * @param fullPath the full path */ public void open(String fullPath) { Path path = new Path(fullPath); IFile fileToOpen = TAEConfiguratorPlugin.getWorkspace().getRoot().getFileForLocation(path); open(fileToOpen); }
@Override public void append(Path path, byte[] content) throws IOException { final IFile file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(getIPath(path)); if (file == null) { JAVA.append(path, content); } else { try { file.appendContents(new ByteArrayInputStream(content), true, true, null); } catch (final CoreException e) { throw new IOException(e); } } }
private static IResource[] getResourcesImpl(GitModelObject[] children) { List<IResource> result = new ArrayList<IResource>(children.length); for (GitModelObject object : children) { IPath location = object.getLocation(); IResource resource; if (object.isContainer()) resource = ROOT.getContainerForLocation(location); else resource = ROOT.getFileForLocation(location); if (resource != null) result.add(resource); } return result.toArray(new IResource[result.size()]); }
@Override public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException { IPath path = gitBlob.getLocation(); IResource file = workspaceRoot.getFileForLocation(path); if (file != null) return new ResourceTraversal[] { new ResourceTraversal( new IResource[] { file }, IResource.DEPTH_ZERO, IResource.ALLOW_MISSING_LOCAL) }; return new ResourceTraversal[0]; }
private static IProject getProject(IFeatureModel featureModel) { final java.nio.file.Path file = featureModel.getSourceFile(); final IWorkspace workspace = ResourcesPlugin.getWorkspace(); final IPath location = Path.fromOSString(file.toAbsolutePath().toString()); final IFile iFile = workspace.getRoot().getFileForLocation(location); try { return iFile.getProject(); } catch (final NullPointerException e) { Logger.logWarning(location.toOSString()); throw e; } }
private IResource[] getResources(GitModelBlob modelBlob) { IFile file = ROOT.getFileForLocation(modelBlob.getLocation()); if (file == null) file = ROOT.getFile(modelBlob.getLocation()); return new IResource[] { file }; }
private ResourceTraversal createTraversalForFile(GitModelObject aChild) { IPath childLocation = aChild.getLocation(); IFile file = ROOT.getFileForLocation(childLocation); if (file == null) { file = ROOT.getFile(childLocation); } ResourceTraversal traversal = new ResourceTraversal( new IResource[] { file }, DEPTH_ONE, ALLOW_MISSING_LOCAL); return traversal; }
public IFile getFile() { if( isInJar() ) return null; Path path = new Path(getFilePath()); IWorkspaceRoot workspaceRoot = InstaSearchPlugin.getWorkspaceRoot(); IFile file = workspaceRoot.getFile(path); if( file == null || file.getRawLocation() == null ) file = workspaceRoot.getFileForLocation(path); return file; }