Refactory: remove unused classes, imports, fields and methods.
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.sql / src / net / sourceforge / phpdt / sql / preferences / PreferencesPage.java
index 55129f0..2f93e5f 100644 (file)
@@ -1,8 +1,6 @@
 package net.sourceforge.phpdt.sql.preferences;
 
 
-import net.sourceforge.phpdt.sql.PHPEclipseSQLPlugin;
-
 import org.eclipse.jface.preference.ColorFieldEditor;
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.preference.PreferenceConverter;
@@ -10,7 +8,6 @@ import org.eclipse.jface.preference.PreferencePage;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.FontData;
 import org.eclipse.swt.graphics.RGB;
 import org.eclipse.swt.layout.GridData;
@@ -23,6 +20,8 @@ import org.eclipse.swt.widgets.Label;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchPreferencePage;
 
+import net.sourceforge.phpdt.sql.Messages;
+import net.sourceforge.phpdt.sql.PHPEclipseSQLPlugin;
 import net.sourceforge.phpdt.sql.editors.ColorManager;
 import net.sourceforge.phpdt.sql.editors.SQLColorConstants;
 
@@ -61,23 +60,23 @@ public class PreferencesPage extends PreferencePage
        private void initializeColorDefaults(IPreferenceStore store) {
                RGB BACKGROUND = new RGB(255, 255, 255);
                RGB COMMENT = new RGB(88, 148, 64);
-               RGB IDENTIFIER = new RGB(0, 0, 0);
                RGB KEYWORD = new RGB(126, 0, 75);
                RGB STRING = new RGB(0, 0, 255);
                RGB NUMERIC = new RGB(255, 0, 0);
                RGB DEFAULT = new RGB(0, 0, 0);
                PreferenceConverter.setDefault(store,
-                       "quantum.background.color", BACKGROUND);
-               PreferenceConverter.setDefault(store,
-                       "quantum.text.color", DEFAULT);
+                                                                         "phpeclipse.sql.background.color",BACKGROUND);
+               PreferenceConverter.setDefault(store, 
+                                                                          "phpeclipse.sql.text.color", DEFAULT);
                PreferenceConverter.setDefault(store,
-                       "quantum.keyword.color", KEYWORD);
+                                                                         "phpeclipse.sql.keyword.color",KEYWORD); //$NON-NLS-1$
                PreferenceConverter.setDefault(store,
-                       "quantum.comment.color", COMMENT);
+                                                                         "phpeclipse.sql.comment.color",COMMENT); //$NON-NLS-1$
                PreferenceConverter.setDefault(store,
-                       "quantum.string.color", STRING);
+                                                                         "phpeclipse.sql.string.color",STRING); //$NON-NLS-1$
                PreferenceConverter.setDefault(store,
-                       "quantum.numeric.color", NUMERIC);
+                                                                         "phpeclipse.sql.numeric.color",
+                                                                         NUMERIC);
        }
 
        protected void performDefaults() {
@@ -100,12 +99,12 @@ public class PreferencesPage extends PreferencePage
         * Save the preferences to the preference store.
         */
        public boolean performOk() {
-               PreferenceConverter.setValue(getPreferenceStore(), "quantum.font", fontData);
-               getPreferenceStore().setValue("quantum.text.bold", textFlag);
-               getPreferenceStore().setValue("quantum.keyword.bold", keywordFlag);
-               getPreferenceStore().setValue("quantum.string.bold", stringFlag);
-               getPreferenceStore().setValue("quantum.comment.bold", commentFlag);
-               getPreferenceStore().setValue("quantum.numeric.bold", numericFlag);
+               PreferenceConverter.setValue(getPreferenceStore(), "phpeclipse.sql.font", fontData);
+               getPreferenceStore().setValue("phpeclipse.sql.text.bold", textFlag); //$NON-NLS-1$
+               getPreferenceStore().setValue("phpeclipse.sql.keyword.bold", keywordFlag); //$NON-NLS-1$
+               getPreferenceStore().setValue("phpeclipse.sql.string.bold", stringFlag); //$NON-NLS-1$
+               getPreferenceStore().setValue("phpeclipse.sql.comment.bold", commentFlag); //$NON-NLS-1$
+               getPreferenceStore().setValue("phpeclipse.sql.numeric.bold", numericFlag); //$NON-NLS-1$
                backgroundColorEditor.store();
                textColorEditor.store();
                keywordColorEditor.store();
@@ -121,14 +120,21 @@ public class PreferencesPage extends PreferencePage
                innerLayout.numColumns = 4;
                main.setLayout(innerLayout);
 
-               fontData = PreferenceConverter.getFontData(getPreferenceStore(), "quantum.font");
-               textFlag = getPreferenceStore().getBoolean("quantum.text.bold");
-               keywordFlag = getPreferenceStore().getBoolean("quantum.keyword.bold");
-               stringFlag = getPreferenceStore().getBoolean("quantum.string.bold");
-               commentFlag = getPreferenceStore().getBoolean("quantum.comment.bold");
-               numericFlag = getPreferenceStore().getBoolean("quantum.numeric.bold");
-               
-               fontDialog = new FontDialog(workbench.getActiveWorkbenchWindow().getShell());
+               fontData =
+               PreferenceConverter.getFontData(
+                                                                          getPreferenceStore(),
+                                                                          "phpeclipse.sql.font");
+               textFlag = getPreferenceStore().getBoolean("phpeclipse.sql.text.bold");
+               keywordFlag =
+               getPreferenceStore().getBoolean("phpeclipse.sql.keyword.bold");
+               stringFlag = getPreferenceStore().getBoolean("phpeclipse.sql.string.bold");
+               commentFlag =
+               getPreferenceStore().getBoolean("phpeclipse.sql.comment.bold");
+               numericFlag =
+               getPreferenceStore().getBoolean("phpeclipse.sql.numeric.bold");
+
+               fontDialog =
+               new FontDialog(workbench.getActiveWorkbenchWindow().getShell());
                Button fontButton = new Button(main, SWT.PUSH);
                fontButton.setText("Pick Font");
                fontButton.addSelectionListener(new SelectionListener() {
@@ -146,7 +152,7 @@ public class PreferencesPage extends PreferencePage
                        }
                });
                Button defaultButton = new Button(main, SWT.PUSH);
-               defaultButton.setText("Default Font");
+               defaultButton.setText(Messages.getString("PreferencesPage.DefaultFont")); //$NON-NLS-1$
                defaultButton.addSelectionListener(new SelectionListener() {
                        public void widgetDefaultSelected(SelectionEvent e) {
                        }
@@ -169,11 +175,11 @@ public class PreferencesPage extends PreferencePage
                layoutData.horizontalSpan = 2;
                comp.setLayoutData(layoutData);
                
-               Color defaultColor = manager.getColor(SQLColorConstants.DEFAULT);
+               manager.getColor(SQLColorConstants.DEFAULT);
                backgroundColorEditor =
-                       new ColorFieldEditor(
-                               "quantum.background.color",
-                               "Background Color",
+               new ColorFieldEditor(
+                                                       "phpeclipse.sql.background.color", //$NON-NLS-1$
+                               Messages.getString("PreferencesPage.BackgroundColor"), //$NON-NLS-1$
                                comp);                          
 
                Composite temp = new Composite(main, SWT.NULL);
@@ -186,13 +192,13 @@ public class PreferencesPage extends PreferencePage
                
                textColorEditor =
                        new ColorFieldEditor(
-                               "quantum.text.color",
-                               "Default Text Color",
+                                                       "phpeclipse.sql.text.color", //$NON-NLS-1$
+                               Messages.getString("PreferencesPage.DefaultTextColor"), //$NON-NLS-1$
                                comp);                          
 
                boldText = new Button(main, SWT.CHECK);
                boldText.setSelection(textFlag);
-               boldText.setText("Bold");
+               boldText.setText(Messages.getString("PreferencesPage.Bold")); //$NON-NLS-1$
                boldText.addSelectionListener(new SelectionListener() {
                        public void widgetDefaultSelected(SelectionEvent e) {
                        }
@@ -208,13 +214,13 @@ public class PreferencesPage extends PreferencePage
 
                keywordColorEditor =
                        new ColorFieldEditor(
-                               "quantum.keyword.color",
-                               "Keyword Text Color",
+                                                       "phpeclipse.sql.keyword.color", //$NON-NLS-1$
+                               Messages.getString("PreferencesPage.KeywordTextColor"), //$NON-NLS-1$
                                comp);
 
                boldKeyword = new Button(main, SWT.CHECK);
                boldKeyword.setSelection(keywordFlag);
-               boldKeyword.setText("Bold");
+               boldKeyword.setText(Messages.getString("PreferencesPage.Bold")); //$NON-NLS-1$
                boldKeyword.addSelectionListener(new SelectionListener() {
                        public void widgetDefaultSelected(SelectionEvent e) {
                        }
@@ -230,13 +236,13 @@ public class PreferencesPage extends PreferencePage
 
                commentColorEditor =
                        new ColorFieldEditor(
-                               "quantum.comment.color",
-                               "Comment Text Color",
+                                                       "phpeclipse.sql.comment.color", //$NON-NLS-1$
+                               Messages.getString("PreferencesPage.CommentTextColor"), //$NON-NLS-1$
                                comp);
 
                boldComment = new Button(main, SWT.CHECK);
                boldComment.setSelection(commentFlag);
-               boldComment.setText("Bold");
+               boldComment.setText(Messages.getString("PreferencesPage.Bold")); //$NON-NLS-1$
                boldComment.addSelectionListener(new SelectionListener() {
                        public void widgetDefaultSelected(SelectionEvent e) {
                        }
@@ -252,13 +258,13 @@ public class PreferencesPage extends PreferencePage
 
                stringColorEditor =
                        new ColorFieldEditor(
-                               "quantum.string.color",
-                               "String Text Color",
+                                                       "phpeclipse.sql.string.color", //$NON-NLS-1$
+                               Messages.getString("PreferencesPage.StringTextColor"), //$NON-NLS-1$
                                comp);
 
                boldString = new Button(main, SWT.CHECK);
                boldString.setSelection(stringFlag);
-               boldString.setText("Bold");
+               boldString.setText(Messages.getString("PreferencesPage.Bold")); //$NON-NLS-1$
                boldString.addSelectionListener(new SelectionListener() {
                        public void widgetDefaultSelected(SelectionEvent e) {
                        }
@@ -274,13 +280,13 @@ public class PreferencesPage extends PreferencePage
 
                numericColorEditor =
                        new ColorFieldEditor(
-                               "quantum.numeric.color",
-                               "Numeric Text Color",
+                                                       "phpeclipse.sql.numeric.color", //$NON-NLS-1$
+                               Messages.getString("PreferencesPage.NumericTextColor"), //$NON-NLS-1$
                                comp);
 
                boldNumeric = new Button(main, SWT.CHECK);
                boldNumeric.setSelection(numericFlag);
-               boldNumeric.setText("Bold");
+               boldNumeric.setText(Messages.getString("PreferencesPage.Bold")); //$NON-NLS-1$
                boldNumeric.addSelectionListener(new SelectionListener() {
                        public void widgetDefaultSelected(SelectionEvent e) {
                        }
@@ -317,17 +323,17 @@ public class PreferencesPage extends PreferencePage
        }
        public void updateFontDisplay() {
                if (fontData == null) {
-                       fontDisplay.setText("Font: default");
+                       fontDisplay.setText(Messages.getString("PreferencesPage.Font_Default")); //$NON-NLS-1$
                } else {
-                       String style = "regular";
+                       String style = Messages.getString("PreferencesPage.regular"); //$NON-NLS-1$
                        if (fontData.getStyle() == SWT.BOLD) {
-                               style = "bold";
+                               style = Messages.getString("PreferencesPage.bold"); //$NON-NLS-1$
                        } else if (fontData.getStyle() == SWT.ITALIC) {
-                               style = "italic";
+                               style = Messages.getString("PreferencesPage.italic"); //$NON-NLS-1$
                        } else if (fontData.getStyle() == (SWT.BOLD | SWT.ITALIC)) {
-                               style = "bold italic";
+                               style = Messages.getString("PreferencesPage.boldItalic"); //$NON-NLS-1$
                        }
-                       fontDisplay.setText("Font: " + fontData.getName() + '-' + style + '-' + fontData.getHeight());
+                       fontDisplay.setText(Messages.getString("PreferencesPage.FontPrompt") + fontData.getName() + '-' + style + '-' + fontData.getHeight()); //$NON-NLS-1$
                }
        }
        public void updateFlags() {