A massive organize imports and formatting of the sources using default Eclipse code...
[phpeclipse.git] / net.sourceforge.phpeclipse.xml.ui / src / net / sourceforge / phpeclipse / xml / ui / internal / text / AbstractDocumentProvider.java
index 67489c2..10d4fee 100644 (file)
@@ -8,7 +8,7 @@
  * Contributors:
  *     Igor Malinin - initial contribution
  *
- * $Id: AbstractDocumentProvider.java,v 1.2 2005-05-06 00:55:41 stefanbjarni Exp $
+ * $Id: AbstractDocumentProvider.java,v 1.3 2006-10-21 23:14:13 pombredanne Exp $
  */
 
 package net.sourceforge.phpeclipse.xml.ui.internal.text;
@@ -21,7 +21,6 @@ import net.sourceforge.phpeclipse.ui.editor.I18NDocumentProvider;
 
 import org.eclipse.jface.text.rules.IWhitespaceDetector;
 
-
 /**
  * 
  * 
@@ -37,41 +36,41 @@ public abstract class AbstractDocumentProvider extends I18NDocumentProvider {
                return "UTF-8";
        }
 
-       public String getDeclaredEncoding( InputStream in ) throws IOException {
-               if ( !in.markSupported() ) {
-                       in = new BufferedInputStream( in, 512 );
+       public String getDeclaredEncoding(InputStream in) throws IOException {
+               if (!in.markSupported()) {
+                       in = new BufferedInputStream(in, 512);
                }
 
-               in.mark( 512 );
-               String encoding = super.getDeclaredEncoding( in );
-               if ( encoding != null ) {
+               in.mark(512);
+               String encoding = super.getDeclaredEncoding(in);
+               if (encoding != null) {
                        return encoding;
                }
 
                in.reset();
 
                // check Prolog-Start <?xml
-               if ( !skipXMLDecl(in) ) {
+               if (!skipXMLDecl(in)) {
                        return null;
                }
 
                // detect 'encoding'
-               skipEncoding( in );
+               skipEncoding(in);
 
                // read encoding
                int delimiter;
 
-               while ( true ) {
+               while (true) {
                        int ch = in.read();
-                       if ( ch < 0 ) {
+                       if (ch < 0) {
                                return null;
                        }
 
-                       if ( detector.isWhitespace((char) ch) ) {
+                       if (detector.isWhitespace((char) ch)) {
                                continue;
                        }
 
-                       if ( ch == '"' || ch == '\'' ) {
+                       if (ch == '"' || ch == '\'') {
                                delimiter = ch;
                                break;
                        }
@@ -81,89 +80,86 @@ public abstract class AbstractDocumentProvider extends I18NDocumentProvider {
 
                StringBuffer buf = new StringBuffer();
 
-               while ( true ) {
+               while (true) {
                        int ch = in.read();
-                       if ( ch < 0 ) {
+                       if (ch < 0) {
                                return null;
                        }
 
-                       if ( ch == delimiter ) {
+                       if (ch == delimiter) {
                                break;
                        }
 
-                       buf.append( (char) ch );
+                       buf.append((char) ch);
                }
 
                return buf.toString();
        }
 
-       private boolean skipXMLDecl( InputStream in ) throws IOException {
+       private boolean skipXMLDecl(InputStream in) throws IOException {
                int ch = in.read();
-               if ( ch != '<' ) {
+               if (ch != '<') {
                        return false;
                }
 
                ch = in.read();
-               if ( ch != '?' ) {
+               if (ch != '?') {
                        return false;
                }
 
                ch = in.read();
-               if ( ch != 'x' ) {
+               if (ch != 'x') {
                        return false;
                }
 
                ch = in.read();
-               if ( ch != 'm' ) {
+               if (ch != 'm') {
                        return false;
                }
 
                ch = in.read();
-               if ( ch != 'l' ) {
+               if (ch != 'l') {
                        return false;
                }
 
                return true;
        }
 
-       private boolean skipEncoding( InputStream in ) throws IOException {
+       private boolean skipEncoding(InputStream in) throws IOException {
                int ch = in.read();
 
                boolean whitespace = false;
 
-               while ( true ) {
-                       if ( ch < 0 ) {
+               while (true) {
+                       if (ch < 0) {
                                return false;
                        }
 
-                       if ( detector.isWhitespace((char) ch) ) {
+                       if (detector.isWhitespace((char) ch)) {
                                ch = in.read();
                                whitespace = true;
                                continue;
                        }
 
-                       if ( ch == '?' || ch == '<' ) {
+                       if (ch == '?' || ch == '<') {
                                return false;
                        }
 
-                       if ( ch != 'e' ) {
+                       if (ch != 'e') {
                                ch = in.read();
                                whitespace = false;
                                continue;
                        }
 
-                       if ( !whitespace ) {
+                       if (!whitespace) {
                                ch = in.read();
                                continue;
                        }
 
-                       if ( (ch = in.read()) == 'n' &&
-                                       (ch = in.read()) == 'c' &&
-                                       (ch = in.read()) == 'o' &&
-                                       (ch = in.read()) == 'd' &&
-                                       (ch = in.read()) == 'i' &&
-                                       (ch = in.read()) == 'n' &&
-                                       (ch = in.read()) == 'g' ) {
+                       if ((ch = in.read()) == 'n' && (ch = in.read()) == 'c'
+                                       && (ch = in.read()) == 'o' && (ch = in.read()) == 'd'
+                                       && (ch = in.read()) == 'i' && (ch = in.read()) == 'n'
+                                       && (ch = in.read()) == 'g') {
                                break;
                        }
 
@@ -171,17 +167,17 @@ public abstract class AbstractDocumentProvider extends I18NDocumentProvider {
                }
 
                // '='
-               while ( true ) {
+               while (true) {
                        ch = in.read();
-                       if ( ch < 0 ) {
+                       if (ch < 0) {
                                return false;
                        }
 
-                       if ( detector.isWhitespace((char) ch) ) {
+                       if (detector.isWhitespace((char) ch)) {
                                continue;
                        }
 
-                       if ( ch == '=' ) {
+                       if (ch == '=') {
                                break;
                        }