Changeset 3881 for devel-tools


Ignore:
Timestamp:
Jul 27, 2008, 8:20:17 PM (12 years ago)
Author:
yura
Message:
 
Location:
devel-tools/trunk/eclipse/org.refal.rfpdt.ui/src/org/refal/rfpdt/ui/preferences
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • devel-tools/trunk/eclipse/org.refal.rfpdt.ui/src/org/refal/rfpdt/ui/preferences/CodeStylePreferencePage.java

    r3880 r3881  
    44import org.refal.rfpdt.ui.preferences.SyntaxColoringPreferencePage.ModifiableIntegerFieldEditor;
    55
    6 public class CodeStylePreferencePage extends CompilerPreferencePage {
     6public class CodeStylePreferencePage extends PropertiesAndPreferencePage {
    77    private ModifiableBooleanFieldEditor booleanFieldEditor;
    88    private ModifiableIntegerFieldEditor integerFieldEditor;
     
    2626    }
    2727
    28     protected void enableFields () {
    29         booleanFieldEditor.setEnabled(true, codeStyle);
    30         integerFieldEditor.setEnabled(true, codeStyle);
    31     }
    32 
    33     protected void disableFields () {
    34         booleanFieldEditor.setEnabled(false, codeStyle);
    35         integerFieldEditor.setEnabled(false, codeStyle);
     28    protected void loadDefaults () {
    3629        booleanFieldEditor.setBooleanValue(store.getBoolean(booleanFieldEditor.getPreferenceName()));
    3730        integerFieldEditor.setIntValue(store.getInt(integerFieldEditor.getPreferenceName()));
  • devel-tools/trunk/eclipse/org.refal.rfpdt.ui/src/org/refal/rfpdt/ui/preferences/CompilerPreferencePage.java

    r3880 r3881  
    2828    }
    2929
    30     protected void enableFields () {
    31         varNamesFieldEditor.setEnabled(true, codeStyle);
    32         lineNumbersFieldEditor.setEnabled(true, codeStyle);
    33         sourceFieldEditor.setEnabled(true, codeStyle);
    34     }
    35 
    36     protected void disableFields () {
    37         varNamesFieldEditor.setEnabled(false, codeStyle);
    38         lineNumbersFieldEditor.setEnabled(false, codeStyle);
    39         sourceFieldEditor.setEnabled(false, codeStyle);
     30    protected void loadDefaults () {
    4031        varNamesFieldEditor.setBooleanValue(store.getBoolean(varNamesFieldEditor.getPreferenceName()));
    4132        lineNumbersFieldEditor.setBooleanValue(store.getBoolean(lineNumbersFieldEditor.getPreferenceName()));
  • devel-tools/trunk/eclipse/org.refal.rfpdt.ui/src/org/refal/rfpdt/ui/preferences/PropertiesAndPreferencePage.java

    r3880 r3881  
    22
    33import java.util.ArrayList;
     4import java.util.List;
    45
    56import org.eclipse.core.resources.IProject;
     
    1011import org.eclipse.jface.dialogs.Dialog;
    1112import org.eclipse.jface.dialogs.MessageDialog;
     13import org.eclipse.jface.preference.FieldEditor;
    1214import org.eclipse.jface.preference.FieldEditorPreferencePage;
    1315import org.eclipse.jface.preference.IPreferenceStore;
     
    3840    private SelectionListener projectSpecificListner;
    3941    private ModifiableBooleanFieldEditor projectPropertiesField;
     42    private final List<FieldEditor> fields;
    4043
    4144    protected IPreferenceStore store;
     
    4649        store = RfpUI.getPluginPreferenceStore();
    4750        setPreferenceStore(store);
     51        fields = new ArrayList<FieldEditor>();
    4852    }
    4953
     
    5458    protected abstract void createFields ();
    5559
    56     protected abstract void enableFields ();
     60    protected abstract void loadDefaults ();
    5761
    58     protected abstract void disableFields ();
     62    protected void addField (FieldEditor field) {
     63        super.addField(field);
     64        if (field != projectPropertiesField)
     65            fields.add(field);
     66    }
    5967
    6068    protected void performDefaults () {
    6169        super.performDefaults();
    62         if (projectSpecificListner != null)
    63             disableFields();
     70        if (projectSpecificListner != null) {
     71            for (FieldEditor field : fields)
     72                field.setEnabled(false, codeStyle);
     73            loadDefaults();
     74        }
    6475    }
    6576
     
    8798                public void widgetSelected (SelectionEvent e) {
    8899                    if (projectPropertiesField.getBooleanValue())
    89                         enableFields();
     100                        for (FieldEditor field : fields)
     101                            field.setEnabled(true, codeStyle);
    90102                    else
    91103                        performDefaults();
Note: See TracChangeset for help on using the changeset viewer.