/** * Determines whether a given workspace path URI represents a file that already exists. */ protected boolean exists(URI workspacePath) { if (EcorePlugin.getWorkspaceRoot() != null) { return PlatformResourceURIHandlerImpl.WorkbenchHelper.exists(workspacePath.toString(), null); } return getURIConverter().exists(toPlatformResourceURI(workspacePath), null); }
return PlatformResourceURIHandlerImpl.WorkbenchHelper.getLineDelimiter(workspacePath.toString(), null);
/** * Creates an input stream for the given {@link IFile} path. * <p> * This implementation uses {@link IFile#getContents() IFile.getContents}. * </p> * @return an open input stream. * @see IWorkspaceRoot#getFile(org.eclipse.core.runtime.IPath) * @see IFile#getContents() * @exception IOException if there is a problem obtaining an open input stream. * @deprecated since 2.4; use {@link PlatformResourceURIHandlerImpl.WorkbenchHelper#createPlatformResourceInputStream(String, Map)} directly. */ @Deprecated public static InputStream createPlatformResourceInputStream(String platformResourcePath) throws IOException { return PlatformResourceURIHandlerImpl.WorkbenchHelper.createPlatformResourceInputStream(platformResourcePath, null); } }
contentDescription = PlatformResourceURIHandlerImpl.WorkbenchHelper.getContentDescription(uri.toPlatformString(true), options);
contentDescription = PlatformResourceURIHandlerImpl.WorkbenchHelper.getContentDescription(uri.toPlatformString(true), options);
if (workspaceRoot != null) return WorkbenchHelper.createPlatformResourceInputStream(platformResourcePath, options);
if (workspaceRoot != null) return WorkbenchHelper.createPlatformResourceInputStream(platformResourcePath, options);
if (workspaceRoot != null) return WorkbenchHelper.createPlatformResourceOutputStream(platformResourcePath, options);
if (workspaceRoot != null) return WorkbenchHelper.createPlatformResourceOutputStream(platformResourcePath, options);
@Override public void delete(URI uri, Map<?, ?> options) throws IOException { String platformResourcePath = uri.toPlatformString(true); if (workspaceRoot != null) { WorkbenchHelper.delete(platformResourcePath, options); } else { URI resolvedLocation = EcorePlugin.resolvePlatformResourcePath(platformResourcePath); if (resolvedLocation != null) { getURIConverter(options).delete(resolvedLocation, options); } else { throw new IOException("The path '" + platformResourcePath + "' is unmapped"); } } }
@Override public void setAttributes(URI uri, Map<String, ?> attributes, Map<?, ?> options) throws IOException { String platformResourcePath = uri.toPlatformString(true); if (workspaceRoot != null) { WorkbenchHelper.updateAttributes(platformResourcePath, attributes, options); } else { URI resolvedLocation = EcorePlugin.resolvePlatformResourcePath(platformResourcePath); if (resolvedLocation != null) { getURIConverter(options).setAttributes(resolvedLocation, attributes, options); } else { throw new IOException("The platform resource path '" + platformResourcePath + "' does not resolve"); } } } }
@Override public void delete(URI uri, Map<?, ?> options) throws IOException { String platformResourcePath = uri.toPlatformString(true); if (workspaceRoot != null) { WorkbenchHelper.delete(platformResourcePath, options); } else { URI resolvedLocation = EcorePlugin.resolvePlatformResourcePath(platformResourcePath); if (resolvedLocation != null) { getURIConverter(options).delete(resolvedLocation, options); } else { throw new IOException("The path '" + platformResourcePath + "' is unmapped"); } } }
@Override public void setAttributes(URI uri, Map<String, ?> attributes, Map<?, ?> options) throws IOException { String platformResourcePath = uri.toPlatformString(true); if (workspaceRoot != null) { WorkbenchHelper.updateAttributes(platformResourcePath, attributes, options); } else { URI resolvedLocation = EcorePlugin.resolvePlatformResourcePath(platformResourcePath); if (resolvedLocation != null) { getURIConverter(options).setAttributes(resolvedLocation, attributes, options); } else { throw new IOException("The platform resource path '" + platformResourcePath + "' does not resolve"); } } } }
/** * This implementation only gets called when platform's content describer throws an exception, i.e., when the resource doesn't exist. * For {@link URI#isPlatformResource() platform resource URIs}, it determines the line delimiter from the project/workspace preferences. * @since 2.9 */ @Override protected String getLineDelimiter(URI uri, InputStream inputStream, Map<?, ?> options, Map<Object, Object> context) throws IOException { if (uri.isPlatformResource() && PlatformResourceURIHandlerImpl.workspaceRoot != null) { return PlatformResourceURIHandlerImpl.WorkbenchHelper.getLineDelimiter(uri.toPlatformString(true), options); } else { return super.getCharset(uri, inputStream, options, context); } } }
/** * This implementation only gets called when platform's content describer throws an exception, i.e., when the resource doesn't exist. * For {@link URI#isPlatformResource() platform resource URIs}, it determines the line delimiter from the project/workspace preferences. * @since 2.9 */ @Override protected String getLineDelimiter(URI uri, InputStream inputStream, Map<?, ?> options, Map<Object, Object> context) throws IOException { if (uri.isPlatformResource() && PlatformResourceURIHandlerImpl.workspaceRoot != null) { return PlatformResourceURIHandlerImpl.WorkbenchHelper.getLineDelimiter(uri.toPlatformString(true), options); } else { return super.getCharset(uri, inputStream, options, context); } } }
/** * This implementation only gets called when platform's content describer throws an exception, i.e., when the resource doesn't exist. * For {@link URI#isPlatformResource() platform resource URIs}, it determines the character set from the workspace. * @since 2.9 */ @Override protected String getCharset(URI uri, InputStream inputStream, Map<?, ?> options, Map<Object, Object> context) throws IOException { if (uri.isPlatformResource() && PlatformResourceURIHandlerImpl.workspaceRoot != null) { return PlatformResourceURIHandlerImpl.WorkbenchHelper.getCharset(uri.toPlatformString(true), options); } else { return super.getCharset(uri, inputStream, options, context); } }
/** * Creates an output stream for the given {@link IFile} path. * <p> * This implementation uses a {@link PlatformResourceURIHandlerImpl.PlatformResourceOutputStream}. * </p> * @return an open output stream. * @exception IOException if there is a problem obtaining an open output stream. * @see IWorkspaceRoot#getFile(org.eclipse.core.runtime.IPath) * @see PlatformResourceURIHandlerImpl.PlatformResourceOutputStream * @see IFile#setContents(InputStream, boolean, boolean, IProgressMonitor) * @deprecated since 2.4; use {@link PlatformResourceURIHandlerImpl.WorkbenchHelper#createPlatformResourceOutputStream(String, Map)} directly. */ @Deprecated public static OutputStream createPlatformResourceOutputStream(String platformResourcePath) throws IOException { return PlatformResourceURIHandlerImpl.WorkbenchHelper.createPlatformResourceOutputStream(platformResourcePath, null); }
/** * This implementation only gets called when platform's content describer throws an exception, i.e., when the resource doesn't exist. * For {@link URI#isPlatformResource() platform resource URIs}, it determines the character set from the workspace. * @since 2.9 */ @Override protected String getCharset(URI uri, InputStream inputStream, Map<?, ?> options, Map<Object, Object> context) throws IOException { if (uri.isPlatformResource() && PlatformResourceURIHandlerImpl.workspaceRoot != null) { return PlatformResourceURIHandlerImpl.WorkbenchHelper.getCharset(uri.toPlatformString(true), options); } else { return super.getCharset(uri, inputStream, options, context); } }
/** * Creates an input stream for the given {@link IFile} path. * <p> * This implementation uses {@link IFile#getContents() IFile.getContents}. * </p> * @return an open input stream. * @see IWorkspaceRoot#getFile(org.eclipse.core.runtime.IPath) * @see IFile#getContents() * @exception IOException if there is a problem obtaining an open input stream. * @deprecated since 2.4; use {@link PlatformResourceURIHandlerImpl.WorkbenchHelper#createPlatformResourceInputStream(String, Map)} directly. */ @Deprecated public static InputStream createPlatformResourceInputStream(String platformResourcePath) throws IOException { return PlatformResourceURIHandlerImpl.WorkbenchHelper.createPlatformResourceInputStream(platformResourcePath, null); } }
/** * Creates an output stream for the given {@link IFile} path. * <p> * This implementation uses a {@link PlatformResourceURIHandlerImpl.PlatformResourceOutputStream}. * </p> * @return an open output stream. * @exception IOException if there is a problem obtaining an open output stream. * @see IWorkspaceRoot#getFile(org.eclipse.core.runtime.IPath) * @see PlatformResourceURIHandlerImpl.PlatformResourceOutputStream * @see IFile#setContents(InputStream, boolean, boolean, IProgressMonitor) * @deprecated since 2.4; use {@link PlatformResourceURIHandlerImpl.WorkbenchHelper#createPlatformResourceOutputStream(String, Map)} directly. */ @Deprecated public static OutputStream createPlatformResourceOutputStream(String platformResourcePath) throws IOException { return PlatformResourceURIHandlerImpl.WorkbenchHelper.createPlatformResourceOutputStream(platformResourcePath, null); }