Bug was introduced when working on the RSE paths. I have fixed it and this fixes...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / builder / ExternalStorageDocumentProvider.java
index ea8aae0..c1d2ad5 100644 (file)
@@ -1,7 +1,3 @@
-/*
- * Created on 06.09.2003
- *
- */
 package net.sourceforge.phpeclipse.builder;
 
 import java.io.ByteArrayInputStream;
@@ -23,37 +19,42 @@ import org.eclipse.ui.editors.text.StorageDocumentProvider;
  */
 public class ExternalStorageDocumentProvider extends StorageDocumentProvider {
 
-        /* (non-Javadoc)
-               * @see org.eclipse.ui.texteditor.AbstractDocumentProvider#doSaveDocument(org.eclipse.core.runtime.IProgressMonitor, java.lang.Object, org.eclipse.jface.text.IDocument, boolean)
-               */
-        protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite)
-                       throws CoreException {
-                       if (element instanceof ExternalEditorInput) {
-                                ExternalEditorInput external = (ExternalEditorInput) element;
-                                FileStorage storage = (FileStorage)external.getStorage();
-                                String encoding = getEncoding(element);
-                                if (encoding == null)
-                                               encoding = getDefaultEncoding();
-                                try {
-                                               InputStream stream = new ByteArrayInputStream(document.get().getBytes(encoding));
-                                               try {
-                                                        // inform about the upcoming content change
-                                                        fireElementStateChanging(element);
-                                                        storage.setContents(stream, overwrite, true, monitor);
-                                               } catch (RuntimeException e) {
-                                                        // inform about failure
-                                                        fireElementStateChangeFailed(element);
-                                                        throw e;
-                                               }
-                                } catch (IOException e) {
-                                               IStatus s = new Status(IStatus.ERROR, PHPeclipsePlugin.PLUGIN_ID, IStatus.OK, e.getMessage(), e);
-                                               throw new CoreException(s);
-                                }
-
-                       } else {
-                                super.doSaveDocument(monitor, element, document, overwrite);
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.ui.texteditor.AbstractDocumentProvider#doSaveDocument(org.eclipse.core.runtime.IProgressMonitor,
+        *      java.lang.Object, org.eclipse.jface.text.IDocument, boolean)
+        */
+       protected void doSaveDocument(IProgressMonitor monitor, Object element,
+                       IDocument document, boolean overwrite) throws CoreException {
+               if (element instanceof ExternalEditorInput) {
+                       ExternalEditorInput external = (ExternalEditorInput) element;
+                       FileStorage storage = (FileStorage) external.getStorage();
+                       String encoding = getEncoding(element);
+                       if (encoding == null)
+                               encoding = getDefaultEncoding();
+                       try {
+                               InputStream stream = new ByteArrayInputStream(document.get()
+                                               .getBytes(encoding));
+                               try {
+                                       // inform about the upcoming content change
+                                       fireElementStateChanging(element);
+                                       storage.setContents(stream, overwrite, true, monitor);
+                               } catch (RuntimeException e) {
+                                       // inform about failure
+                                       fireElementStateChangeFailed(element);
+                                       throw e;
+                               }
+                       } catch (IOException e) {
+                               IStatus s = new Status(IStatus.ERROR,
+                                               PHPeclipsePlugin.PLUGIN_ID, IStatus.OK, e.getMessage(),
+                                               e);
+                               throw new CoreException(s);
                        }
-        }
 
-}
+               } else {
+                       super.doSaveDocument(monitor, element, document, overwrite);
+               }
+       }
 
+}