Example usage for org.eclipse.jface.preference FieldEditor load

List of usage examples for org.eclipse.jface.preference FieldEditor load

Introduction

In this page you can find the example usage for org.eclipse.jface.preference FieldEditor load.

Prototype

public void load() 

Source Link

Document

Initializes this field editor with the preference value from the preference store.

Usage

From source file:org.rubypeople.rdt.debug.ui.launchConfigurations.RubyConnectTab.java

License:Open Source License

/**
 * Updates the connection argument field editors from the specified
 * configuration/*from   w w w.ja va 2s . c  o  m*/
 * 
 * @param config
 *            the config to load from
 */
private void updateConnectionFromConfig(ILaunchConfiguration config) {
    String id = null;
    try {
        id = config.getAttribute(IRubyLaunchConfigurationConstants.ATTR_VM_CONNECTOR,
                RubyRuntime.getDefaultVMConnector().getIdentifier());
        fConnectorCombo.setText(RubyRuntime.getVMConnector(id).getName());
        handleConnectorComboModified();

        Map<String, Object> attrMap = config.getAttribute(IRubyLaunchConfigurationConstants.ATTR_CONNECT_MAP,
                (Map) null);
        if (attrMap == null) {
            return;
        }
        Iterator<String> keys = attrMap.keySet().iterator();
        while (keys.hasNext()) {
            String key = keys.next();
            Object arg = fArgumentMap.get(key);
            FieldEditor editor = (FieldEditor) fFieldEditorMap.get(key);
            if (arg != null && editor != null) {
                String value = (String) attrMap.get(key);
                if (arg instanceof String) {
                    //                     || arg instanceof Connector.SelectedArgument) {
                    editor.getPreferenceStore().setValue(key, value);
                    //               } else if (arg instanceof Connector.BooleanArgument) {
                    //                  editor.getPreferenceStore().setValue(key,
                    //                        Boolean.valueOf(value).booleanValue());
                } else if (arg instanceof Integer) {
                    editor.getPreferenceStore().setValue(key, new Integer(value).intValue());
                }
                editor.load();
            }
        }
    } catch (CoreException ce) {
        RdtDebugUiPlugin.log(ce);
    }
}

From source file:org.soyatec.tooling.gef.properties.ViewPropertyTab.java

License:Open Source License

public boolean refresh() {
    if (!super.refresh()) {
        return false;
    }/*  w  w w .j  a va  2  s .c o  m*/
    if (control == null || control.isDisposed()) {
        return false;
    }
    if (model == null) {
        final Control[] children = control.getChildren();
        for (final Control child : children) {
            child.setVisible(false);
            final Object layoutData = child.getLayoutData();
            if (layoutData instanceof GridData) {
                ((GridData) layoutData).exclude = true;
            }
        }
    } else {
        final Set<Entry<EStructuralFeature, FieldEditor>> entrySet = editorMap.entrySet();
        final List<FieldEditor> visibleEditors = new ArrayList<FieldEditor>();
        for (final Entry<EStructuralFeature, FieldEditor> entry : entrySet) {
            final EStructuralFeature feature = entry.getKey();
            final FieldEditor editor = entry.getValue();
            final boolean enabled = isFeatureVisible(model, feature);
            editor.setEnabled(enabled, getEditorParent(feature));
            if (enabled) {
                visibleEditors.add(editor);
            }
        }

        final Control[] children = control.getChildren();
        for (final Control child : children) {
            child.setVisible(child.isEnabled());
            final Object layoutData = child.getLayoutData();
            if (layoutData instanceof GridData) {
                ((GridData) layoutData).exclude = !child.isVisible();
            }
        }
        gradientGroup.setVisible(model instanceof GradientShape);
        ((GridData) gradientGroup.getLayoutData()).exclude = !(model instanceof GradientShape);

        // load values for editors
        for (final FieldEditor editor : visibleEditors) {
            editor.load();
        }
    }
    control.layout();
    control.getParent().layout();
    control.getParent().getParent().layout();
    return true;
}

From source file:org.universaal.tools.packaging.tool.preferences.GroupFieldEditor.java

License:Apache License

@Override
protected void doLoad() {
    if (members != null) {
        for (FieldEditor editor : members) {
            editor.load();
        }/* ww  w  .  j a  va 2  s . co m*/
    }
}

From source file:org2.eclipse.php.internal.debug.ui.preferences.PHPDebugPropertyPreferencePage.java

License:Open Source License

private void initFieldEditors() {
    FieldEditor editor;
    for (int i = 0; i < this.fFieldEditors.size(); i++) {
        editor = (FieldEditor) this.fFieldEditors.get(i);
        editor.setPreferenceStore(this.getPreferenceStore());
        editor.load();
    }/*w w  w.j  a v a2  s .c o m*/
}

From source file:org2.eclipse.php.internal.debug.ui.preferences.PHPLaunchingPreferencePage.java

License:Open Source License

/**
 * Initializes the field editors to their values
 * // w  ww . j  ava  2 s . c o m
 * @since 3.2
 */
private void initFieldEditors() {
    FieldEditor editor;
    for (int i = 0; i < this.fFieldEditors.size(); i++) {
        editor = (FieldEditor) this.fFieldEditors.get(i);
        editor.setPreferenceStore(this.getPreferenceStore());
        editor.load();
    }
}