*/
// Do not add a new line between ELSE and IF, if the option elseIfOnSameLine is true.
// Fix for 1ETLWPZ: IVJCOM:ALL - incorrect "else if" formatting
- if (pendingNewlineAfterParen
- && previousCompilableToken == TokenNameelse
- && token == TokenNameif
- && options.compactElseIfMode) {
- pendingNewlineAfterParen = false;
- pendingNewLines = 0;
- indentationLevel += pop(TokenNameelse);
- // because else if is now one single statement,
- // the indentation level after it is increased by one and not by 2
- // (else = 1 indent, if = 1 indent, but else if = 1 indent, not 2).
- }
+// if (pendingNewlineAfterParen
+// && previousCompilableToken == TokenNameelse
+// && token == TokenNameif
+// && options.compactElseIfMode) {
+// pendingNewlineAfterParen = false;
+// pendingNewLines = 0;
+// indentationLevel += pop(TokenNameelse);
+// // because else if is now one single statement,
+// // the indentation level after it is increased by one and not by 2
+// // (else = 1 indent, if = 1 indent, but else if = 1 indent, not 2).
+// }
// Add a newline & indent to the formatted source string if
// a for/if-else/while statement was scanned and there is no block
// following it.
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.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$
/**
* Option IDs
*/
- public static final String OPTION_InsertNewlineBeforeOpeningBrace = "net.sourceforge.phpdt.core.formatter.newline.openingBrace"; //$NON-NLS-1$
- public static final String OPTION_InsertNewlineInControlStatement = "net.sourceforge.phpdt.core.formatter.newline.controlStatement"; //$NON-NLS-1$
- public static final String OPTION_InsertNewLineBetweenElseAndIf = "net.sourceforge.phpdt.core.formatter.newline.elseIf"; //$NON-NLS-1$
- public static final String OPTION_InsertNewLineInEmptyBlock = "net.sourceforge.phpdt.core.formatter.newline.emptyBlock"; //$NON-NLS-1$
- public static final String OPTION_ClearAllBlankLines = "net.sourceforge.phpdt.core.formatter.newline.clearAll"; //$NON-NLS-1$
- public static final String OPTION_SplitLineExceedingLength = "net.sourceforge.phpdt.core.formatter.lineSplit"; //$NON-NLS-1$
- public static final String OPTION_CompactAssignment = "net.sourceforge.phpdt.core.formatter.style.assignment"; //$NON-NLS-1$
- public static final String OPTION_TabulationChar = "net.sourceforge.phpdt.core.formatter.tabulation.char"; //$NON-NLS-1$
- public static final String OPTION_TabulationSize = "net.sourceforge.phpdt.core.formatter.tabulation.size"; //$NON-NLS-1$
+ public static final String OPTION_InsertNewlineBeforeOpeningBrace = "net.sourceforge.phpeclipse.core.formatter.newline.openingBrace"; //$NON-NLS-1$
+ public static final String OPTION_InsertNewlineInControlStatement = "net.sourceforge.phpeclipse.core.formatter.newline.controlStatement"; //$NON-NLS-1$
+ // public static final String OPTION_InsertNewLineBetweenElseAndIf = "net.sourceforge.phpeclipse.core.formatter.newline.elseIf"; //$NON-NLS-1$
+ public static final String OPTION_InsertNewLineInEmptyBlock = "net.sourceforge.phpeclipse.core.formatter.newline.emptyBlock"; //$NON-NLS-1$
+ public static final String OPTION_ClearAllBlankLines = "net.sourceforge.phpeclipse.core.formatter.newline.clearAll"; //$NON-NLS-1$
+ public static final String OPTION_SplitLineExceedingLength = "net.sourceforge.phpeclipse.core.formatter.lineSplit"; //$NON-NLS-1$
+ public static final String OPTION_CompactAssignment = "net.sourceforge.phpeclipse.core.formatter.style.assignment"; //$NON-NLS-1$
+ public static final String OPTION_TabulationChar = "net.sourceforge.phpeclipse.core.formatter.tabulation.char"; //$NON-NLS-1$
+ public static final String OPTION_TabulationSize = "net.sourceforge.phpeclipse.core.formatter.tabulation.size"; //$NON-NLS-1$
public static final String INSERT = "insert"; //$NON-NLS-1$
public static final String DO_NOT_INSERT = "do not insert"; //$NON-NLS-1$
public int tabSize = 4; // n spaces for one tab
public boolean indentWithTab = true;
- public boolean compactElseIfMode = true;
+ //public boolean compactElseIfMode = true;
// if true, else and if are kept on the same line.
public boolean newLineInEmptyBlockMode = true;
// if false, no new line in {} if it's empty.
}
continue;
}
- if (optionID.equals(OPTION_InsertNewLineBetweenElseAndIf)) {
- if (optionValue.equals(INSERT)) {
- this.compactElseIfMode = false;
- } else if (optionValue.equals(DO_NOT_INSERT)) {
- this.compactElseIfMode = true;
- }
- continue;
- }
+// if (optionID.equals(OPTION_InsertNewLineBetweenElseAndIf)) {
+// if (optionValue.equals(INSERT)) {
+// this.compactElseIfMode = false;
+// } else if (optionValue.equals(DO_NOT_INSERT)) {
+// this.compactElseIfMode = true;
+// }
+// continue;
+// }
if (optionID.equals(OPTION_InsertNewLineInEmptyBlock)) {
if (optionValue.equals(INSERT)) {
this.newLineInEmptyBlockMode = true;
public boolean isCompactingAssignment() {
return compactAssignmentMode;
}
- public boolean isCompactingElseIf() {
- return compactElseIfMode;
- }
+// public boolean isCompactingElseIf() {
+// return compactElseIfMode;
+// }
public boolean isUsingTabForIndenting() {
return indentWithTab;
}
/**
* @deprecated - should use a Map when creating the options.
*/
- public void setCompactElseIfMode(boolean flag) {
- compactElseIfMode = flag;
- }
+// public void setCompactElseIfMode(boolean flag) {
+// compactElseIfMode = flag;
+// }
}
private static final String PREF_NEWLINE_OPENING_BRACES= PHPCore.FORMATTER_NEWLINE_OPENING_BRACE;
private static final String PREF_NEWLINE_CONTROL_STATEMENT= PHPCore.FORMATTER_NEWLINE_CONTROL;
private static final String PREF_NEWLINE_CLEAR_ALL= PHPCore.FORMATTER_CLEAR_BLANK_LINES;
- private static final String PREF_NEWLINE_ELSE_IF= PHPCore.FORMATTER_NEWLINE_ELSE_IF;
+ // private static final String PREF_NEWLINE_ELSE_IF= PHPCore.FORMATTER_NEWLINE_ELSE_IF;
private static final String PREF_NEWLINE_EMPTY_BLOCK= PHPCore.FORMATTER_NEWLINE_EMPTY_BLOCK;
private static final String PREF_LINE_SPLIT= PHPCore.FORMATTER_LINE_SPLIT;
private static final String PREF_STYLE_COMPACT_ASSIGNEMENT= PHPCore.FORMATTER_COMPACT_ASSIGNMENT;
private static String[] getAllKeys() {
return new String[] {
PREF_NEWLINE_OPENING_BRACES, PREF_NEWLINE_CONTROL_STATEMENT, PREF_NEWLINE_CLEAR_ALL,
- PREF_NEWLINE_ELSE_IF, PREF_NEWLINE_EMPTY_BLOCK, PREF_LINE_SPLIT,
+ // PREF_NEWLINE_ELSE_IF,
+ PREF_NEWLINE_EMPTY_BLOCK, PREF_LINE_SPLIT,
PREF_STYLE_COMPACT_ASSIGNEMENT, PREF_TAB_CHAR, PREF_TAB_SIZE
};
}
label= PHPUIMessages.getString("CodeFormatterPreferencePage.newline_clear_lines"); //$NON-NLS-1$
addCheckBox(newlineComposite, label, PREF_NEWLINE_CLEAR_ALL, new String[] { CLEAR_ALL, PRESERVE_ONE } );
- label= PHPUIMessages.getString("CodeFormatterPreferencePage.newline_else_if.label"); //$NON-NLS-1$
- addCheckBox(newlineComposite, label, PREF_NEWLINE_ELSE_IF, insertNotInsert);
+// label= PHPUIMessages.getString("CodeFormatterPreferencePage.newline_else_if.label"); //$NON-NLS-1$
+// addCheckBox(newlineComposite, label, PREF_NEWLINE_ELSE_IF, insertNotInsert);
label= PHPUIMessages.getString("CodeFormatterPreferencePage.newline_empty_block.label"); //$NON-NLS-1$
addCheckBox(newlineComposite, label, PREF_NEWLINE_EMPTY_BLOCK, insertNotInsert);