intial version
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / PHPLanguagePreferencePage.java
index fed2faf..7ed7c1f 100644 (file)
@@ -17,60 +17,60 @@ import org.eclipse.swt.widgets.Label;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchPreferencePage;
 
-public class PHPLanguagePreferencePage extends PreferencePage implements IWorkbenchPreferencePage  {
-       private ArrayList RadioButtons = new ArrayList();
+public class PHPLanguagePreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+  private ArrayList RadioButtons = new ArrayList();
 
-       protected Control createContents(Composite parent) {
-               Composite lingoComposite= new Composite(parent, SWT.NULL);
-               lingoComposite.setLayout(new GridLayout());
-               Group lingoGroup= new Group(lingoComposite, SWT.NONE);
-               lingoGroup.setText(PHPPreferencesMessages.getString("PHPLanguagePreferencePage.preflingo"));
-               lingoGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-               lingoGroup.setLayout(new GridLayout());
-               Label lg = new Label(lingoGroup, SWT.WRAP);
-               lg.setText(PHPPreferencesMessages.getString("PHPLanguagePreferencePage.choose"));
-               addRadioButton(lingoGroup, PHPPreferencesMessages.getString("PHPLanguagePreferencePage.english"), IPreferenceConstants.RESOURCE_BUNDLE, IPreferenceConstants.RESOURCE_BUNDLE_EN_GB);  //$NON-NLS-1$
-               addRadioButton(lingoGroup, PHPPreferencesMessages.getString("PHPLanguagePreferencePage.german"), IPreferenceConstants.RESOURCE_BUNDLE, IPreferenceConstants.RESOURCE_BUNDLE_DE); //$NON-NLS-1$
-               addRadioButton(lingoGroup, PHPPreferencesMessages.getString("PHPLanguagePreferencePage.french"), IPreferenceConstants.RESOURCE_BUNDLE, IPreferenceConstants.RESOURCE_BUNDLE_FR); //$NON-NLS-1$
-               return lingoComposite;
-       }
-       public void init(IWorkbench arg0) {
-       }
-       private Button addRadioButton(Composite parent, String label, String key, String value) { 
-               GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
-               Button button= new Button(parent, SWT.RADIO);
-               button.setText(label);
-               button.setData(new String[] { key, value });
-               button.setLayoutData(gd);
-               button.setSelection(value.equals(PHPeclipsePlugin.getDefault().getPreferenceStore().getString(key)));
-               RadioButtons.add(button);
-               return button;
-       }               
-       
-       protected void performDefaults() {
-               IPreferenceStore store= getPreferenceStore();
-               for (int i= 0; i < RadioButtons.size(); i++) {
-                       Button button= (Button) RadioButtons.get(i);
-                       String[] info= (String[]) button.getData();
-                       button.setSelection(info[1].equals(store.getDefaultString(info[0])));
-               }
-               super.performDefaults();
-       }
+  protected Control createContents(Composite parent) {
+    Composite lingoComposite = new Composite(parent, SWT.NULL);
+    lingoComposite.setLayout(new GridLayout());
+    Group lingoGroup = new Group(lingoComposite, SWT.NONE);
+    lingoGroup.setText(PHPPreferencesMessages.getString("PHPLanguagePreferencePage.preflingo"));
+    lingoGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+    lingoGroup.setLayout(new GridLayout());
+    Label lg = new Label(lingoGroup, SWT.WRAP);
+    lg.setText(PHPPreferencesMessages.getString("PHPLanguagePreferencePage.choose"));
+    addRadioButton(lingoGroup, PHPPreferencesMessages.getString("PHPLanguagePreferencePage.english"), IPreferenceConstants.RESOURCE_BUNDLE, IPreferenceConstants.RESOURCE_BUNDLE_EN_GB); //$NON-NLS-1$
+    addRadioButton(lingoGroup, PHPPreferencesMessages.getString("PHPLanguagePreferencePage.german"), IPreferenceConstants.RESOURCE_BUNDLE, IPreferenceConstants.RESOURCE_BUNDLE_DE); //$NON-NLS-1$
+    addRadioButton(lingoGroup, PHPPreferencesMessages.getString("PHPLanguagePreferencePage.french"), IPreferenceConstants.RESOURCE_BUNDLE, IPreferenceConstants.RESOURCE_BUNDLE_FR); //$NON-NLS-1$
+    addRadioButton(lingoGroup, PHPPreferencesMessages.getString("PHPLanguagePreferencePage.spanish"), IPreferenceConstants.RESOURCE_BUNDLE, IPreferenceConstants.RESOURCE_BUNDLE_ES); //$NON-NLS-1$
+    return lingoComposite;
+  }
+  public void init(IWorkbench arg0) {
+  }
+  private Button addRadioButton(Composite parent, String label, String key, String value) {
+    GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+    Button button = new Button(parent, SWT.RADIO);
+    button.setText(label);
+    button.setData(new String[] { key, value });
+    button.setLayoutData(gd);
+    button.setSelection(value.equals(PHPeclipsePlugin.getDefault().getPreferenceStore().getString(key)));
+    RadioButtons.add(button);
+    return button;
+  }
 
-       public boolean performOk() {
-               IPreferenceStore store= PHPeclipsePlugin.getDefault().getPreferenceStore();
-               for (int i= 0; i < RadioButtons.size(); i++) {
-                       Button button= (Button) RadioButtons.get(i);
-                       if (button.getSelection()) {
-                               String[] info= (String[]) button.getData();
-                               store.setValue(info[0], info[1]);
-                       }
-               }
-               PHPeclipsePlugin.getDefault().savePluginPreferences();
-               PHPPreferencesMessages.setResourceBundle(
-                       PHPeclipsePlugin.getDefault().getPreferenceStore().getString(IPreferenceConstants.RESOURCE_BUNDLE));
-                       
-               return super.performOk();
-       }
-}
+  protected void performDefaults() {
+    IPreferenceStore store = getPreferenceStore();
+    for (int i = 0; i < RadioButtons.size(); i++) {
+      Button button = (Button) RadioButtons.get(i);
+      String[] info = (String[]) button.getData();
+      button.setSelection(info[1].equals(store.getDefaultString(info[0])));
+    }
+    super.performDefaults();
+  }
 
+  public boolean performOk() {
+    IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
+    for (int i = 0; i < RadioButtons.size(); i++) {
+      Button button = (Button) RadioButtons.get(i);
+      if (button.getSelection()) {
+        String[] info = (String[]) button.getData();
+        store.setValue(info[0], info[1]);
+      }
+    }
+    PHPeclipsePlugin.getDefault().savePluginPreferences();
+    PHPPreferencesMessages.setResourceBundle(
+      PHPeclipsePlugin.getDefault().getPreferenceStore().getString(IPreferenceConstants.RESOURCE_BUNDLE));
+
+    return super.performOk();
+  }
+}
\ No newline at end of file