Refactory: remove unused classes, imports, fields and methods.
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / formatter / CodeFormatter.java
index e7d7075..4d7ed3e 100644 (file)
@@ -15,10 +15,10 @@ import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.StringReader;
 import java.util.Hashtable;
-import java.util.Locale;
+//import java.util.Locale;
 import java.util.Map;
 
-import javax.swing.text.html.Option;
+//import javax.swing.text.html.Option;
 
 import net.sourceforge.phpdt.core.ICodeFormatter;
 import net.sourceforge.phpdt.core.compiler.CharOperation;
@@ -148,9 +148,9 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter {
         * 
         * @deprecated Use CodeFormatter(ConfigurableOption[]) instead
         */
-       public CodeFormatter() {
-               this((Map) null);
-       }
+//     public CodeFormatter() {
+//             this((Map) null);
+//     }
 
        /**
         * Creates a new instance of Code Formatter using the given settings.
@@ -1261,40 +1261,40 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter {
         * 
         * @deprecated backport 1.0 internal functionality
         */
-       public static ConfigurableOption[] getDefaultOptions(Locale locale) {
-               String componentName = CodeFormatter.class.getName();
-               FormatterOptions options = new FormatterOptions();
-               return new ConfigurableOption[] {
-                               new ConfigurableOption(componentName, "newline.openingBrace",
-                                               locale, options.newLineBeforeOpeningBraceMode ? 0 : 1),
-                               //$NON-NLS-1$
-                               new ConfigurableOption(componentName,
-                                               "newline.controlStatement", locale,
-                                               options.newlineInControlStatementMode ? 0 : 1),
-                               //$NON-NLS-1$
-                               new ConfigurableOption(componentName, "newline.clearAll",
-                                               locale, options.clearAllBlankLinesMode ? 0 : 1),
-                               //$NON-NLS-1$
-                               // new ConfigurableOption(componentName, "newline.elseIf",
-                               // locale,
-                               // options.compactElseIfMode ? 0 : 1), //$NON-NLS-1$
-                               new ConfigurableOption(componentName, "newline.emptyBlock",
-                                               locale, options.newLineInEmptyBlockMode ? 0 : 1),
-                               //$NON-NLS-1$
-                               new ConfigurableOption(componentName, "line.split", locale,
-                                               options.maxLineLength),
-                               //$NON-NLS-1$
-                               new ConfigurableOption(componentName,
-                                               "style.compactAssignment", locale,
-                                               options.compactAssignmentMode ? 0 : 1),
-                               //$NON-NLS-1$
-                               new ConfigurableOption(componentName, "tabulation.char",
-                                               locale, options.indentWithTab ? 0 : 1),
-                               //$NON-NLS-1$
-                               new ConfigurableOption(componentName,
-                                               "tabulation.size", locale, options.tabSize) //$NON-NLS-1$
-               };
-       }
+//     public static ConfigurableOption[] getDefaultOptions(Locale locale) {
+//             String componentName = CodeFormatter.class.getName();
+//             FormatterOptions options = new FormatterOptions();
+//             return new ConfigurableOption[] {
+//                             new ConfigurableOption(componentName, "newline.openingBrace",
+//                                             locale, options.newLineBeforeOpeningBraceMode ? 0 : 1),
+//                             //$NON-NLS-1$
+//                             new ConfigurableOption(componentName,
+//                                             "newline.controlStatement", locale,
+//                                             options.newlineInControlStatementMode ? 0 : 1),
+//                             //$NON-NLS-1$
+//                             new ConfigurableOption(componentName, "newline.clearAll",
+//                                             locale, options.clearAllBlankLinesMode ? 0 : 1),
+//                             //$NON-NLS-1$
+//                             // new ConfigurableOption(componentName, "newline.elseIf",
+//                             // locale,
+//                             // options.compactElseIfMode ? 0 : 1), //$NON-NLS-1$
+//                             new ConfigurableOption(componentName, "newline.emptyBlock",
+//                                             locale, options.newLineInEmptyBlockMode ? 0 : 1),
+//                             //$NON-NLS-1$
+//                             new ConfigurableOption(componentName, "line.split", locale,
+//                                             options.maxLineLength),
+//                             //$NON-NLS-1$
+//                             new ConfigurableOption(componentName,
+//                                             "style.compactAssignment", locale,
+//                                             options.compactAssignmentMode ? 0 : 1),
+//                             //$NON-NLS-1$
+//                             new ConfigurableOption(componentName, "tabulation.char",
+//                                             locale, options.indentWithTab ? 0 : 1),
+//                             //$NON-NLS-1$
+//                             new ConfigurableOption(componentName,
+//                                             "tabulation.size", locale, options.tabSize) //$NON-NLS-1$
+//             };
+//     }
 
        /**
         * Returns the array of mapped positions. Returns null is no positions have
@@ -1322,106 +1322,106 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter {
         * @param token
         *            the token of which the priority is requested
         */
-       private static int getTokenPriority(int token) {
-               switch (token) {
-               case TokenNameextends:
-                       // case TokenNameimplements :
-                       // case TokenNamethrows :
-                       return 10;
-               case TokenNameSEMICOLON:
-                       // ;
-                       return 20;
-               case TokenNameCOMMA:
-                       // ,
-                       return 25;
-               case TokenNameEQUAL:
-                       // =
-                       return 30;
-               case TokenNameAND_AND:
-                       // &&
-               case TokenNameOR_OR:
-                       // ||
-                       return 40;
-               case TokenNameQUESTION:
-                       // ?
-               case TokenNameCOLON:
-                       // :
-                       return 50; // it's better cutting on ?: than on ;
-               case TokenNameEQUAL_EQUAL:
-                       // ==
-               case TokenNameEQUAL_EQUAL_EQUAL:
-                       // ===
-               case TokenNameNOT_EQUAL:
-                       // !=
-               case TokenNameNOT_EQUAL_EQUAL:
-                       // !=
-                       return 60;
-               case TokenNameLESS:
-                       // <
-               case TokenNameLESS_EQUAL:
-                       // <=
-               case TokenNameGREATER:
-                       // >
-               case TokenNameGREATER_EQUAL:
-                       // >=
-                       // case TokenNameinstanceof : // instanceof
-                       return 70;
-               case TokenNamePLUS:
-                       // +
-               case TokenNameMINUS:
-                       // -
-                       return 80;
-               case TokenNameMULTIPLY:
-                       // *
-               case TokenNameDIVIDE:
-                       // /
-               case TokenNameREMAINDER:
-                       // %
-                       return 90;
-               case TokenNameLEFT_SHIFT:
-                       // <<
-               case TokenNameRIGHT_SHIFT:
-                       // >>
-                       // case TokenNameUNSIGNED_RIGHT_SHIFT : // >>>
-                       return 100;
-               case TokenNameAND:
-                       // &
-               case TokenNameOR:
-                       // |
-               case TokenNameXOR:
-                       // ^
-                       return 110;
-               case TokenNameMULTIPLY_EQUAL:
-                       // *=
-               case TokenNameDIVIDE_EQUAL:
-                       // /=
-               case TokenNameREMAINDER_EQUAL:
-                       // %=
-               case TokenNamePLUS_EQUAL:
-                       // +=
-               case TokenNameMINUS_EQUAL:
-                       // -=
-               case TokenNameLEFT_SHIFT_EQUAL:
-                       // <<=
-               case TokenNameRIGHT_SHIFT_EQUAL:
-                       // >>=
-                       // case TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL : // >>>=
-               case TokenNameAND_EQUAL:
-                       // &=
-               case TokenNameXOR_EQUAL:
-                       // ^=
-               case TokenNameOR_EQUAL:
-                       // .=
-               case TokenNameDOT_EQUAL:
-                       // |=
-                       return 120;
-               case TokenNameDOT:
-                       // .
-                       return 130;
-               default:
-                       return Integer.MAX_VALUE;
-               }
-       }
+//     private static int getTokenPriority(int token) {
+//             switch (token) {
+//             case TokenNameextends:
+//                     // case TokenNameimplements :
+//                     // case TokenNamethrows :
+//                     return 10;
+//             case TokenNameSEMICOLON:
+//                     // ;
+//                     return 20;
+//             case TokenNameCOMMA:
+//                     // ,
+//                     return 25;
+//             case TokenNameEQUAL:
+//                     // =
+//                     return 30;
+//             case TokenNameAND_AND:
+//                     // &&
+//             case TokenNameOR_OR:
+//                     // ||
+//                     return 40;
+//             case TokenNameQUESTION:
+//                     // ?
+//             case TokenNameCOLON:
+//                     // :
+//                     return 50; // it's better cutting on ?: than on ;
+//             case TokenNameEQUAL_EQUAL:
+//                     // ==
+//             case TokenNameEQUAL_EQUAL_EQUAL:
+//                     // ===
+//             case TokenNameNOT_EQUAL:
+//                     // !=
+//             case TokenNameNOT_EQUAL_EQUAL:
+//                     // !=
+//                     return 60;
+//             case TokenNameLESS:
+//                     // <
+//             case TokenNameLESS_EQUAL:
+//                     // <=
+//             case TokenNameGREATER:
+//                     // >
+//             case TokenNameGREATER_EQUAL:
+//                     // >=
+//                     // case TokenNameinstanceof : // instanceof
+//                     return 70;
+//             case TokenNamePLUS:
+//                     // +
+//             case TokenNameMINUS:
+//                     // -
+//                     return 80;
+//             case TokenNameMULTIPLY:
+//                     // *
+//             case TokenNameDIVIDE:
+//                     // /
+//             case TokenNameREMAINDER:
+//                     // %
+//                     return 90;
+//             case TokenNameLEFT_SHIFT:
+//                     // <<
+//             case TokenNameRIGHT_SHIFT:
+//                     // >>
+//                     // case TokenNameUNSIGNED_RIGHT_SHIFT : // >>>
+//                     return 100;
+//             case TokenNameAND:
+//                     // &
+//             case TokenNameOR:
+//                     // |
+//             case TokenNameXOR:
+//                     // ^
+//                     return 110;
+//             case TokenNameMULTIPLY_EQUAL:
+//                     // *=
+//             case TokenNameDIVIDE_EQUAL:
+//                     // /=
+//             case TokenNameREMAINDER_EQUAL:
+//                     // %=
+//             case TokenNamePLUS_EQUAL:
+//                     // +=
+//             case TokenNameMINUS_EQUAL:
+//                     // -=
+//             case TokenNameLEFT_SHIFT_EQUAL:
+//                     // <<=
+//             case TokenNameRIGHT_SHIFT_EQUAL:
+//                     // >>=
+//                     // case TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL : // >>>=
+//             case TokenNameAND_EQUAL:
+//                     // &=
+//             case TokenNameXOR_EQUAL:
+//                     // ^=
+//             case TokenNameOR_EQUAL:
+//                     // .=
+//             case TokenNameDOT_EQUAL:
+//                     // |=
+//                     return 120;
+//             case TokenNameDOT:
+//                     // .
+//                     return 130;
+//             default:
+//                     return Integer.MAX_VALUE;
+//             }
+//     }
 
        /**
         * Handles the exception raised when an invalid token is encountered.
@@ -2065,16 +2065,16 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter {
         * Pops the top statement of the stack if it is a <code>BLOCK</code> or a
         * <code>NONINDENT_BLOCK</code>.
         */
-       private int popBlock() {
-               int delta = 0;
-               if ((constructionsCount > 0)
-                               && ((constructions[constructionsCount - 1] == BLOCK) || (constructions[constructionsCount - 1] == NONINDENT_BLOCK))) {
-                       if (constructions[constructionsCount - 1] == BLOCK)
-                               delta--;
-                       constructionsCount--;
-               }
-               return delta;
-       }
+//     private int popBlock() {
+//             int delta = 0;
+//             if ((constructionsCount > 0)
+//                             && ((constructions[constructionsCount - 1] == BLOCK) || (constructions[constructionsCount - 1] == NONINDENT_BLOCK))) {
+//                     if (constructions[constructionsCount - 1] == BLOCK)
+//                             delta--;
+//                     constructionsCount--;
+//             }
+//             return delta;
+//     }
 
        /**
         * Pops elements until the stack is empty or the top element is
@@ -2084,16 +2084,16 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter {
         * @param token
         *            the token to be left as the top of the stack
         */
-       private int popExclusiveUntil(int token) {
-               int delta = 0;
-               int startCount = constructionsCount;
-               for (int i = startCount - 1; i >= 0 && constructions[i] != token; i--) {
-                       if (constructions[i] != NONINDENT_BLOCK)
-                               delta--;
-                       constructionsCount--;
-               }
-               return delta;
-       }
+//     private int popExclusiveUntil(int token) {
+//             int delta = 0;
+//             int startCount = constructionsCount;
+//             for (int i = startCount - 1; i >= 0 && constructions[i] != token; i--) {
+//                     if (constructions[i] != NONINDENT_BLOCK)
+//                             delta--;
+//                     constructionsCount--;
+//             }
+//             return delta;
+//     }
 
        /**
         * Pops elements until the stack is empty or the top element is a
@@ -2211,16 +2211,16 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter {
                return 1;
        }
 
-       private static boolean separateFirstArgumentOn(int currentToken) {
-               // return (currentToken == TokenNameCOMMA || currentToken ==
-               // TokenNameSEMICOLON);
-               return currentToken != TokenNameif && currentToken != TokenNameLPAREN
-                               && currentToken != TokenNameNOT
-                               && currentToken != TokenNamewhile
-                               && currentToken != TokenNamefor
-                               && currentToken != TokenNameforeach
-                               && currentToken != TokenNameswitch;
-       }
+//     private static boolean separateFirstArgumentOn(int currentToken) {
+//             // return (currentToken == TokenNameCOMMA || currentToken ==
+//             // TokenNameSEMICOLON);
+//             return currentToken != TokenNameif && currentToken != TokenNameLPAREN
+//                             && currentToken != TokenNameNOT
+//                             && currentToken != TokenNamewhile
+//                             && currentToken != TokenNamefor
+//                             && currentToken != TokenNameforeach
+//                             && currentToken != TokenNameswitch;
+//     }
 
        /**
         * Set the positions to map. The mapped positions should be retrieved using
@@ -2256,9 +2256,9 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter {
         * @return an object containing the operator and all the substrings or null
         *         if the string cannot be split
         */
-       public SplitLine split(String stringToSplit) {
-               return split(stringToSplit, 0);
-       }
+//     public SplitLine split(String stringToSplit) {
+//             return split(stringToSplit, 0);
+//     }
 
        /**
         * Splits <code>stringToSplit</code> on the top level token <br>