Change visibility to private for net.sourceforge.phpeclipse.xdebug.php.model.XDebugEl...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / builder / FileStorage.java
index 1080cd9..4bb9ac8 100644 (file)
@@ -1,9 +1,3 @@
-/*
- * Created on 06.09.2003
- *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
 package net.sourceforge.phpeclipse.builder;
 
 import java.io.File;
@@ -30,96 +24,114 @@ import org.eclipse.core.runtime.Status;
  */
 
 /**
- *
+ * 
  * @see IStorage
  */
 public class FileStorage extends PlatformObject implements IStorage {
-        private boolean forceReadOnly;
-        private final IPath path;
-        private final File file;
-
-        /**
-               * Two FileStorages are equal if their IPaths are equal.
-               * @see java.lang.Object#equals(java.lang.Object)
-               */
-        public boolean equals(Object obj) {
-                       if (this == obj)
-                                return true;
-                       if (!(obj instanceof FileStorage))
-                                return false;
-                       FileStorage other = (FileStorage) obj;
-                       return path.equals(other.path);
-        }
-
-        /* (non-Javadoc)
-               * @see org.eclipse.core.resources.IStorage#getContents()
-               */
-        public InputStream getContents() throws CoreException {
-                       try {
-                                return new FileInputStream(file);
-                       } catch (FileNotFoundException e) {
-                                throw new CoreException(new Status(IStatus.ERROR, PHPeclipsePlugin.PLUGIN_ID, IStatus.ERROR, e.toString(), e));
-                       }
-        }
-
-        /* (non-Javadoc)
-               * @see org.eclipse.core.resources.IStorage#getFullPath()
-               */
-        public IPath getFullPath() {
-                       return this.path;
-        }
-
-        /* (non-Javadoc)
-               * @see org.eclipse.core.resources.IStorage#getName()
-               */
-        public String getName() {
-                       return this.path.lastSegment();
-        }
-
-        /* (non-Javadoc)
-               * @see org.eclipse.core.resources.IStorage#isReadOnly()
-               */
-        public boolean isReadOnly() {
-                       return forceReadOnly || !file.canWrite();
-        }
-
-        /**
-               * Method FileStorage.
-               * @param path
-               */
-        public FileStorage(IPath path) {
-                       this.path = path;
-                       this.file = path.toFile();
-        }
-
-        /* (non-Javadoc)
-               * @see java.lang.Object#toString()
-               */
-        public String toString() {
-                       return path.toOSString();
-        }
-
-        /**
-               * @param stream
-               * @param overwrite
-               * @param b
-               * @param monitor
-               */
-        public void setContents(InputStream stream, boolean overwrite, boolean b, IProgressMonitor monitor) throws CoreException {
-                       try {
-                               StreamUtil.transferStreams(stream, new FileOutputStream(file));
-                       } catch (FileNotFoundException e) {
-                                throw new CoreException(new Status(IStatus.ERROR, PHPeclipsePlugin.PLUGIN_ID, IStatus.ERROR, e.toString(), e));
-                       } catch (IOException e) {
-                                throw new CoreException(new Status(IStatus.ERROR, PHPeclipsePlugin.PLUGIN_ID, IStatus.ERROR, e.toString(), e));
-                       }
-        }
-
-        /**
-               * Some document providers (notably CompilationUnitDocumentProvider)
-               * can't handle read/write storage.
-               */
-        public void setReadOnly() {
-                       forceReadOnly = true;
-        }
+       private boolean forceReadOnly;
+
+       private final IPath path;
+
+       private final File file;
+
+       /**
+        * Two FileStorages are equal if their IPaths are equal.
+        * 
+        * @see java.lang.Object#equals(java.lang.Object)
+        */
+       public boolean equals(Object obj) {
+               if (this == obj)
+                       return true;
+               if (!(obj instanceof FileStorage))
+                       return false;
+               FileStorage other = (FileStorage) obj;
+               return path.equals(other.path);
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.core.resources.IStorage#getContents()
+        */
+       public InputStream getContents() throws CoreException {
+               try {
+                       return new FileInputStream(file);
+               } catch (FileNotFoundException e) {
+                       throw new CoreException(new Status(IStatus.ERROR,
+                                       PHPeclipsePlugin.PLUGIN_ID, IStatus.ERROR, e.toString(), e));
+               }
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.core.resources.IStorage#getFullPath()
+        */
+       public IPath getFullPath() {
+               return this.path;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.core.resources.IStorage#getName()
+        */
+       public String getName() {
+               return this.path.lastSegment();
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.core.resources.IStorage#isReadOnly()
+        */
+       public boolean isReadOnly() {
+               return forceReadOnly || !file.canWrite();
+       }
+
+       /**
+        * Method FileStorage.
+        * 
+        * @param path
+        */
+       public FileStorage(IPath path) {
+               this.path = path;
+               this.file = path.toFile();
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see java.lang.Object#toString()
+        */
+       public String toString() {
+               return path.toOSString();
+       }
+
+       /**
+        * @param stream
+        * @param overwrite
+        * @param b
+        * @param monitor
+        */
+       public void setContents(InputStream stream, boolean overwrite, boolean b,
+                       IProgressMonitor monitor) throws CoreException {
+               try {
+                       StreamUtil.transferStreams(stream, new FileOutputStream(file));
+               } catch (FileNotFoundException e) {
+                       throw new CoreException(new Status(IStatus.ERROR,
+                                       PHPeclipsePlugin.PLUGIN_ID, IStatus.ERROR, e.toString(), e));
+               } catch (IOException e) {
+                       throw new CoreException(new Status(IStatus.ERROR,
+                                       PHPeclipsePlugin.PLUGIN_ID, IStatus.ERROR, e.toString(), e));
+               }
+       }
+
+       /**
+        * Some document providers (notably CompilationUnitDocumentProvider) can't
+        * handle read/write storage.
+        */
+       public void setReadOnly() {
+               forceReadOnly = true;
+       }
 }