1 11 package org.eclipse.ui.internal.editors.text; 12 13 import java.io.InputStream ; 14 15 import org.eclipse.core.filesystem.EFS; 16 import org.eclipse.core.filesystem.IFileStore; 17 18 import org.eclipse.core.runtime.CoreException; 19 import org.eclipse.core.runtime.IPath; 20 import org.eclipse.core.runtime.Path; 21 22 import org.eclipse.core.resources.IStorage; 23 24 import org.eclipse.jface.text.Assert; 25 26 31 class JavaFileStorage implements IStorage { 32 33 private IFileStore fFileStore; 34 private IPath fFullPath; 35 36 public JavaFileStorage(IFileStore fileStore) { 37 Assert.isNotNull(fileStore); 38 Assert.isTrue(EFS.SCHEME_FILE.equals(fileStore.getFileSystem().getScheme())); 39 fFileStore= fileStore; 40 } 41 42 45 public InputStream getContents() throws CoreException { 46 return fFileStore.openInputStream(EFS.NONE, null); 47 } 48 49 52 public IPath getFullPath() { 53 if (fFullPath == null) 54 fFullPath= new Path(fFileStore.toURI().getPath()); 55 return fFullPath; 56 } 57 58 61 public String getName() { 62 return fFileStore.getName(); 63 } 64 65 68 public boolean isReadOnly() { 69 return fFileStore.fetchInfo().getAttribute(EFS.ATTRIBUTE_READ_ONLY); 70 } 71 72 75 public Object getAdapter(Class adapter) { 76 return null; 77 } 78 } 79 | Popular Tags |