X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CodeFormatterPreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CodeFormatterPreferencePage.java index bd714b3..ab22fb0 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CodeFormatterPreferencePage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CodeFormatterPreferencePage.java @@ -11,21 +11,18 @@ import java.util.ArrayList; import java.util.Hashtable; import net.sourceforge.phpdt.core.ICodeFormatter; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.ToolFactory; import net.sourceforge.phpdt.internal.ui.PHPUIMessages; import net.sourceforge.phpdt.internal.ui.dialog.StatusInfo; import net.sourceforge.phpdt.internal.ui.dialog.StatusUtil; import net.sourceforge.phpdt.internal.ui.util.TabFolderLayout; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; -import net.sourceforge.phpeclipse.phpeditor.PHPSourceViewerConfiguration; import org.eclipse.core.runtime.IStatus; import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.source.SourceViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; @@ -49,34 +46,35 @@ import org.eclipse.ui.IWorkbenchPreferencePage; public class CodeFormatterPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { // Preference store keys, see PHPCore.getOptions - 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_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 final String PREF_TAB_CHAR= PHPCore.FORMATTER_TAB_CHAR; - private static final String PREF_TAB_SIZE= PHPCore.FORMATTER_TAB_SIZE; + private static final String PREF_NEWLINE_OPENING_BRACES= JavaCore.FORMATTER_NEWLINE_OPENING_BRACE; + private static final String PREF_NEWLINE_CONTROL_STATEMENT= JavaCore.FORMATTER_NEWLINE_CONTROL; + private static final String PREF_NEWLINE_CLEAR_ALL= JavaCore.FORMATTER_CLEAR_BLANK_LINES; + // private static final String PREF_NEWLINE_ELSE_IF= PHPCore.FORMATTER_NEWLINE_ELSE_IF; + private static final String PREF_NEWLINE_EMPTY_BLOCK= JavaCore.FORMATTER_NEWLINE_EMPTY_BLOCK; + private static final String PREF_LINE_SPLIT= JavaCore.FORMATTER_LINE_SPLIT; + private static final String PREF_STYLE_COMPACT_ASSIGNEMENT= JavaCore.FORMATTER_COMPACT_ASSIGNMENT; + private static final String PREF_TAB_CHAR= JavaCore.FORMATTER_TAB_CHAR; + private static final String PREF_TAB_SIZE= JavaCore.FORMATTER_TAB_SIZE; // values - private static final String INSERT= PHPCore.INSERT; - private static final String DO_NOT_INSERT= PHPCore.DO_NOT_INSERT; + private static final String INSERT= JavaCore.INSERT; + private static final String DO_NOT_INSERT= JavaCore.DO_NOT_INSERT; - private static final String COMPACT= PHPCore.COMPACT; - private static final String NORMAL= PHPCore.NORMAL; + private static final String COMPACT= JavaCore.COMPACT; + private static final String NORMAL= JavaCore.NORMAL; - private static final String TAB= PHPCore.TAB; - private static final String SPACE= PHPCore.SPACE; + private static final String TAB= JavaCore.TAB; + private static final String SPACE= JavaCore.SPACE; - private static final String CLEAR_ALL= PHPCore.CLEAR_ALL; - private static final String PRESERVE_ONE= PHPCore.PRESERVE_ONE; + private static final String CLEAR_ALL= JavaCore.CLEAR_ALL; + private static final String PRESERVE_ONE= JavaCore.PRESERVE_ONE; 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 }; } @@ -86,7 +84,7 @@ public class CodeFormatterPreferencePage extends PreferencePage implements IWork * @deprecated Inline to avoid reference to preference page */ public static int getTabSize() { - String string= (String) PHPCore.getOptions().get(PREF_TAB_SIZE); + String string= (String) JavaCore.getOptions().get(PREF_TAB_SIZE); return getPositiveIntValue(string, 4); } @@ -95,7 +93,7 @@ public class CodeFormatterPreferencePage extends PreferencePage implements IWork * @deprecated Inline to avoid reference to preference page */ public static boolean isCompactingAssignment() { - return COMPACT.equals(PHPCore.getOptions().get(PREF_STYLE_COMPACT_ASSIGNEMENT)); + return COMPACT.equals(JavaCore.getOptions().get(PREF_STYLE_COMPACT_ASSIGNEMENT)); } /** @@ -103,7 +101,7 @@ public class CodeFormatterPreferencePage extends PreferencePage implements IWork * @deprecated Inline to avoid reference to preference page */ public static boolean useSpaces() { - return SPACE.equals(PHPCore.getOptions().get(PREF_TAB_CHAR)); + return SPACE.equals(JavaCore.getOptions().get(PREF_TAB_CHAR)); } @@ -169,7 +167,7 @@ public class CodeFormatterPreferencePage extends PreferencePage implements IWork setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore()); setDescription(PHPUIMessages.getString("CodeFormatterPreferencePage.description")); //$NON-NLS-1$ - fWorkingValues= PHPCore.getOptions(); + fWorkingValues= JavaCore.getOptions(); fCheckBoxes= new ArrayList(); fTextBoxes= new ArrayList(); @@ -243,8 +241,8 @@ public class CodeFormatterPreferencePage extends PreferencePage implements IWork 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); @@ -387,13 +385,13 @@ public class CodeFormatterPreferencePage extends PreferencePage implements IWork String[] allKeys= getAllKeys(); // preserve other options // store in JCore - Hashtable actualOptions= PHPCore.getOptions(); + Hashtable actualOptions= JavaCore.getOptions(); for (int i= 0; i < allKeys.length; i++) { String key= allKeys[i]; String val= (String) fWorkingValues.get(key); actualOptions.put(key, val); } - PHPCore.setOptions(actualOptions); + JavaCore.setOptions(actualOptions); PHPeclipsePlugin.getDefault().savePluginPreferences(); return super.performOk(); } @@ -402,7 +400,7 @@ public class CodeFormatterPreferencePage extends PreferencePage implements IWork * @see PreferencePage#performDefaults() */ protected void performDefaults() { - fWorkingValues= PHPCore.getDefaultOptions(); + fWorkingValues= JavaCore.getDefaultOptions(); updateControls(); super.performDefaults(); }