Changeset 3882


Ignore:
Timestamp:
Jul 28, 2008, 12:23:54 AM (12 years ago)
Author:
yura
Message:
File:
1 edited

Legend:

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

    r3881 r3882  
    22
    33import java.util.ArrayList;
    4 import java.util.List;
    54
    65import org.eclipse.core.resources.IProject;
     
    98import org.eclipse.core.runtime.CoreException;
    109import org.eclipse.core.runtime.IAdaptable;
     10import org.eclipse.jface.dialogs.ControlEnableState;
    1111import org.eclipse.jface.dialogs.Dialog;
    1212import org.eclipse.jface.dialogs.MessageDialog;
    13 import org.eclipse.jface.preference.FieldEditor;
    1413import org.eclipse.jface.preference.FieldEditorPreferencePage;
    1514import org.eclipse.jface.preference.IPreferenceStore;
     
    4039    private SelectionListener projectSpecificListner;
    4140    private ModifiableBooleanFieldEditor projectPropertiesField;
    42     private final List<FieldEditor> fields;
     41    private ControlEnableState fBlockEnableState;
    4342
    4443    protected IPreferenceStore store;
     
    4948        store = RfpUI.getPluginPreferenceStore();
    5049        setPreferenceStore(store);
    51         fields = new ArrayList<FieldEditor>();
    5250    }
    5351
     
    5957
    6058    protected abstract void loadDefaults ();
    61 
    62     protected void addField (FieldEditor field) {
    63         super.addField(field);
    64         if (field != projectPropertiesField)
    65             fields.add(field);
     59   
     60    private void enableFields () {
     61        if (fBlockEnableState != null) {
     62            fBlockEnableState.restore();
     63            fBlockEnableState= null;
     64        }
     65    }
     66
     67    private void disableFields () {
     68        if (fBlockEnableState == null)
     69            fBlockEnableState= ControlEnableState.disable(getFieldEditorParent());
    6670    }
    6771
     
    6973        super.performDefaults();
    7074        if (projectSpecificListner != null) {
    71             for (FieldEditor field : fields)
    72                 field.setEnabled(false, codeStyle);
     75            disableFields();
    7376            loadDefaults();
    7477        }
     
    98101                public void widgetSelected (SelectionEvent e) {
    99102                    if (projectPropertiesField.getBooleanValue())
    100                         for (FieldEditor field : fields)
    101                             field.setEnabled(true, codeStyle);
     103                        enableFields();
    102104                    else
    103105                        performDefaults();
     
    157159        final Composite parent = getFieldEditorParent();
    158160
    159         Composite mainComposite = new Composite(parent, SWT.NONE);
     161        Composite mainComposite = parent;//new Composite(parent, SWT.NONE);
    160162        GridLayout layout = new GridLayout();
    161163        layout.marginHeight = 0;
Note: See TracChangeset for help on using the changeset viewer.