Example usage for org.eclipse.jface.preference IPreferenceStore getDefaultString

List of usage examples for org.eclipse.jface.preference IPreferenceStore getDefaultString

Introduction

In this page you can find the example usage for org.eclipse.jface.preference IPreferenceStore getDefaultString.

Prototype

String getDefaultString(String name);

Source Link

Document

Returns the default value for the string-valued preference with the given name.

Usage

From source file:org.cs3.pdt.graphicalviews.preferences.controls.NodeSizeRadioGroupFieldEditor.java

License:Open Source License

@Override
protected void doLoadDefault() {
    IPreferenceStore prefs = getPreferenceStore();

    widthMode = null;/*  w  w  w. ja  va2 s  . c o m*/
    numberOfLines = null;
    width = null;

    updateRadioGroupValue(getPreferenceStore().getString(NODE_SIZE));
    updateSizeTextBoxes(prefs.getDefaultString(NODE_SIZE_FIXED_WIDTH),
            prefs.getDefaultString(NODE_SIZE_NUMBER_OF_LINES));
}

From source file:org.csstudio.diirt.util.preferences.ChannelAccessPreferencePage.java

License:Open Source License

/**
 * Create contents of the preference page.
 * @param parent//from w  ww.j av a  2  s  . c o m
 */
@Override
public Control createContents(Composite parent) {

    IPreferenceStore store = getPreferenceStore();
    Composite container = new Composite(parent, SWT.NULL);

    container.setLayoutData(new GridData(GridData.FILL_BOTH));
    container.setLayout(new GridLayout());

    contextOuterGroup = new Group(container, SWT.NONE);

    contextOuterGroup.setText(Messages.CAPP_contextGroup_text);
    contextOuterGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
    contextOuterGroup.setLayout(new GridLayout());

    contextInnerGroup = new Composite(contextOuterGroup, SWT.DOUBLE_BUFFERED);

    contextInnerGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
    contextInnerGroup.setLayout(new GridLayout());

    //  JCA no more available since DIIRT 3.1.7 ---------------------------
    //pureJavaEditor = new RadioGroupFieldEditor(PREF_PURE_JAVA, Messages.CAPP_modeCaption_text, 2, AVAILABLE_MODES, contextInnerGroup, false);
    //
    //addField(pureJavaEditor, contextInnerGroup, true, () -> store.getDefaultString(PREF_PURE_JAVA), () -> store.getString(PREF_PURE_JAVA));
    //  -------------------------------------------------------------------

    addressListEditor = new StringFieldEditor(PREF_ADDR_LIST, Messages.CAPP_addressListCaption_text,
            contextInnerGroup);

    addField(addressListEditor, contextInnerGroup, true, () -> store.getDefaultString(PREF_ADDR_LIST),
            () -> store.getString(PREF_ADDR_LIST));

    autoAddressListEditor = new BooleanFieldEditor(PREF_AUTO_ADDR_LIST, Messages.CAPP_autoCheckButton_text,
            BooleanFieldEditor.SEPARATE_LABEL, contextInnerGroup);

    addField(autoAddressListEditor, contextInnerGroup, true, () -> store.getDefaultBoolean(PREF_AUTO_ADDR_LIST),
            () -> store.getBoolean(PREF_AUTO_ADDR_LIST));

    new Separator(contextInnerGroup).setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 2, 1));

    connectionTimeoutEditor = new DoubleFieldEditor(PREF_CONNECTION_TIMEOUT,
            Messages.CAPP_connectionTimeoutCaption_text, contextInnerGroup);

    connectionTimeoutEditor.setValidRange(0, 300);
    connectionTimeoutEditor.setTextLimit(32);
    connectionTimeoutEditor.getTextControl(contextInnerGroup).setLayoutData(createIntegerFieldEditorGridData());

    addField(connectionTimeoutEditor, contextInnerGroup, true,
            () -> store.getDefaultString(PREF_CONNECTION_TIMEOUT),
            () -> store.getString(PREF_CONNECTION_TIMEOUT));

    beaconPeriodEditor = new DoubleFieldEditor(PREF_BEACON_PERIOD, Messages.CAPP_beaconPeriodCaption_text,
            contextInnerGroup);

    beaconPeriodEditor.setValidRange(0, 300);
    beaconPeriodEditor.setTextLimit(32);
    beaconPeriodEditor.getTextControl(contextInnerGroup).setLayoutData(createIntegerFieldEditorGridData());

    addField(beaconPeriodEditor, contextInnerGroup, true, () -> store.getDefaultString(PREF_BEACON_PERIOD),
            () -> store.getString(PREF_BEACON_PERIOD));

    new Separator(contextInnerGroup).setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 2, 1));

    serverPortEditor = new IntegerFieldEditor(PREF_SERVER_PORT, Messages.CAPP_serverPortCaption_text,
            contextInnerGroup);

    serverPortEditor.setValidRange(1024, 65535);
    serverPortEditor.setTextLimit(32);
    serverPortEditor.getTextControl(contextInnerGroup).setLayoutData(createIntegerFieldEditorGridData());

    addField(serverPortEditor, contextInnerGroup, true, () -> store.getDefaultString(PREF_SERVER_PORT),
            () -> store.getString(PREF_SERVER_PORT));

    repeaterPortEditor = new IntegerFieldEditor(PREF_REPEATER_PORT, Messages.CAPP_repeaterPortCaption_text,
            contextInnerGroup);

    repeaterPortEditor.setValidRange(1024, 65535);
    repeaterPortEditor.setTextLimit(32);
    repeaterPortEditor.getTextControl(contextInnerGroup).setLayoutData(createIntegerFieldEditorGridData());

    addField(repeaterPortEditor, contextInnerGroup, true, () -> store.getDefaultString(PREF_REPEATER_PORT),
            () -> store.getString(PREF_REPEATER_PORT));

    new Separator(contextInnerGroup).setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 2, 1));

    maxArraySizeEditor = new IntegerFieldEditor(PREF_MAX_ARRAY_SIZE,
            Messages.CAPP_maxArraySizeSpinnerCaption_text, contextInnerGroup);

    maxArraySizeEditor.setValidRange(16384, Integer.MAX_VALUE);
    maxArraySizeEditor.setTextLimit(32);
    maxArraySizeEditor.getTextControl(contextInnerGroup).setLayoutData(createIntegerFieldEditorGridData());

    addField(maxArraySizeEditor, contextInnerGroup, true, () -> store.getDefaultString(PREF_MAX_ARRAY_SIZE),
            () -> store.getString(PREF_MAX_ARRAY_SIZE));

    optionsOuterGroup = new Group(container, SWT.NONE);

    optionsOuterGroup.setText(Messages.CAPP_optionsGroup_text);
    optionsOuterGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
    optionsOuterGroup.setLayout(new GridLayout());

    optionsInnerGroup = new Composite(optionsOuterGroup, SWT.DOUBLE_BUFFERED);

    optionsInnerGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
    optionsInnerGroup.setLayout(new GridLayout());

    monitorMaskEditor = new RadioGroupFieldEditor(PREF_MONITOR_MASK, Messages.CAPP_monitorMaskCaption_text, 4,
            AVAILABLE_MONITOR_MASKS, optionsInnerGroup, false);

    addField(monitorMaskEditor, optionsInnerGroup, true, () -> store.getDefaultString(PREF_MONITOR_MASK),
            () -> store.getString(PREF_MONITOR_MASK), e -> {

                customMaskEditor.setEnabled(MonitorMask.CUSTOM.name().equals(e.getNewValue()),
                        optionsInnerGroup);

                if (MonitorMask.VALUE.name().equals(e.getNewValue())) {
                    customMaskEditor.getTextControl(optionsInnerGroup)
                            .setText(Integer.toString(MonitorMask.VALUE.mask()));
                } else if (MonitorMask.ARCHIVE.name().equals(e.getNewValue())) {
                    customMaskEditor.getTextControl(optionsInnerGroup)
                            .setText(Integer.toString(MonitorMask.ARCHIVE.mask()));
                } else if (MonitorMask.ALARM.name().equals(e.getNewValue())) {
                    customMaskEditor.getTextControl(optionsInnerGroup)
                            .setText(Integer.toString(MonitorMask.ALARM.mask()));
                }

            });

    customMaskEditor = new IntegerFieldEditor(PREF_CUSTOM_MASK, "", optionsInnerGroup);

    customMaskEditor.setEnabled(MonitorMask.CUSTOM.name().equals(store.getString(PREF_MONITOR_MASK)),
            optionsInnerGroup);
    customMaskEditor.setValidRange(0, 65536);
    customMaskEditor.setTextLimit(32);
    customMaskEditor.getTextControl(optionsInnerGroup).setLayoutData(createIntegerFieldEditorGridData());

    addField(customMaskEditor, optionsInnerGroup, true, () -> store.getDefaultString(PREF_CUSTOM_MASK),
            () -> store.getString(PREF_CUSTOM_MASK));

    new Separator(optionsInnerGroup).setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 2, 1));

    variableArrayEditor = new RadioGroupFieldEditor(PREF_VARIABLE_LENGTH_ARRAY,
            Messages.CAPP_variableLengthArrayCaption_text, 3, AVAILABLE_VAR_ARRAY_SUPPORTS, optionsInnerGroup,
            false);

    addField(variableArrayEditor, optionsInnerGroup, true,
            () -> store.getDefaultString(PREF_VARIABLE_LENGTH_ARRAY),
            () -> store.getString(PREF_VARIABLE_LENGTH_ARRAY));

    new Separator(optionsInnerGroup).setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 2, 1));

    dbePropertySupportedEditor = new BooleanFieldEditor(PREF_DBE_PROPERTY_SUPPORTED,
            Messages.CAPP_dbePropertySupportedCheckBox_text, BooleanFieldEditor.SEPARATE_LABEL,
            optionsInnerGroup);

    addField(dbePropertySupportedEditor, optionsInnerGroup, true,
            () -> store.getDefaultBoolean(PREF_DBE_PROPERTY_SUPPORTED),
            () -> store.getBoolean(PREF_DBE_PROPERTY_SUPPORTED));

    honorZeropRecisionEditor = new BooleanFieldEditor(PREF_HONOR_ZERO_PRECISION,
            Messages.CAPP_honorCheckBox_text, BooleanFieldEditor.SEPARATE_LABEL, optionsInnerGroup);

    addField(honorZeropRecisionEditor, optionsInnerGroup, true,
            () -> store.getDefaultBoolean(PREF_HONOR_ZERO_PRECISION),
            () -> store.getBoolean(PREF_HONOR_ZERO_PRECISION));

    valueRTYPMonitorEditor = new BooleanFieldEditor(PREF_VALUE_RTYP_MONITOR,
            Messages.CAPP_valueOnlyCheckBox_text, BooleanFieldEditor.SEPARATE_LABEL, optionsInnerGroup);

    addField(valueRTYPMonitorEditor, optionsInnerGroup, true,
            () -> store.getDefaultBoolean(PREF_VALUE_RTYP_MONITOR),
            () -> store.getBoolean(PREF_VALUE_RTYP_MONITOR));

    initializeValues(store);

    return container;

}

From source file:org.csstudio.diirt.util.preferences.DataSourcesPreferencePage.java

License:Open Source License

/**
 * Create contents of the preference page.
 *
 * @param parent/*ww  w. j  a  v  a  2s .  c  om*/
 */
@Override
public Control createContents(Composite parent) {

    IPreferenceStore store = getPreferenceStore();
    Composite container = new Composite(parent, SWT.NULL);

    container.setLayoutData(new GridData(GridData.FILL_BOTH));
    container.setLayout(new GridLayout());

    directoryEditor = new ConfigurationDirectoryFieldEditor(PREF_CONFIGURATION_DIRECTORY,
            Messages.DSPP_directoryCaption_text, container, store);

    directoryEditor.setChangeButtonText(Messages.DSPP_browseButton_text);
    directoryEditor.getTextControl(container).setEditable(false);
    directoryEditor.getTextControl(container)
            .setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));
    directoryEditor.getTextControl(container)
            .setForeground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_FOREGROUND));

    addField(directoryEditor, container, false, () -> store.getString(PREF_CONFIGURATION_DIRECTORY));

    Composite treeComposite = new Composite(container, SWT.NONE);
    GridData gd_treeComposite = new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1);

    gd_treeComposite.heightHint = -14;
    treeComposite.setLayoutData(gd_treeComposite);
    treeComposite.setLayout(new GridLayout());

    treeViewer = new TreeViewer(treeComposite);

    GridData gridData = new GridData(GridData.FILL_BOTH);

    gridData.heightHint = -16;
    treeViewer.getTree().setLayoutData(gridData);
    treeViewer.setLabelProvider(new FileTreeLabelProvider());
    treeViewer.setContentProvider(new FileTreeContentProvider());
    treeViewer.addDoubleClickListener(new IDoubleClickListener() {
        @Override
        public void doubleClick(DoubleClickEvent event) {

            TreeSelection selection = (TreeSelection) event.getSelection();
            File fileSelection = (File) selection.getFirstElement();

            try {
                if (fileSelection.isFile()) {
                    clearWarning();
                    Program.launch(fileSelection.getCanonicalPath());
                }
            } catch (IOException ex) {
                notifyWarning(NLS.bind(Messages.DSPP_resolveMessage, ex.getMessage()));
            }

        }
    });

    cdsOuterGroup = new Group(container, SWT.NONE);

    cdsOuterGroup.setText(Messages.DSPP_cdsGroup_text);
    cdsOuterGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1));
    cdsOuterGroup.setLayout(new GridLayout());

    cdsInnerGroup = new Composite(cdsOuterGroup, SWT.DOUBLE_BUFFERED);

    cdsInnerGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    cdsInnerGroup.setLayout(new GridLayout());

    defaultDataSourceEditor = new ComboFieldEditor(PREF_DEFAULT, Messages.DSPP_defaultDataSourceCaption_text,
            AVAILABLE_DATA_SOURCES, cdsInnerGroup);

    addField(defaultDataSourceEditor, cdsInnerGroup, true, () -> store.getDefaultString(PREF_DEFAULT),
            () -> store.getString(PREF_DEFAULT));

    delimiterEditor = new StringFieldEditor(PREF_DELIMITER, Messages.DSPP_delimiterCaption_text, cdsInnerGroup);

    delimiterEditor.getTextControl(cdsInnerGroup)
            .setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));

    addField(delimiterEditor, cdsInnerGroup, true, () -> store.getDefaultString(PREF_DELIMITER),
            () -> store.getString(PREF_DELIMITER));

    initializeValues(store);

    return container;

}

From source file:org.csstudio.diirt.util.preferences.DIIRTPreferencesPlugin.java

License:Open Source License

public static void copyChannelAccess(IPreferenceStore source, DIIRTPreferences destination) {

    destination.setDefaultBoolean(PREF_DBE_PROPERTY_SUPPORTED,
            source.getDefaultBoolean(PREF_DBE_PROPERTY_SUPPORTED));
    destination.setDefaultBoolean(PREF_HONOR_ZERO_PRECISION,
            source.getDefaultBoolean(PREF_HONOR_ZERO_PRECISION));
    destination.setDefaultString(PREF_MONITOR_MASK, source.getDefaultString(PREF_MONITOR_MASK));
    destination.setDefaultInteger(PREF_CUSTOM_MASK, source.getDefaultInt(PREF_CUSTOM_MASK));
    destination.setDefaultBoolean(PREF_VALUE_RTYP_MONITOR, source.getDefaultBoolean(PREF_VALUE_RTYP_MONITOR));
    destination.setDefaultString(PREF_VARIABLE_LENGTH_ARRAY,
            source.getDefaultString(PREF_VARIABLE_LENGTH_ARRAY));
    destination.setDefaultString(PREF_ADDR_LIST, source.getDefaultString(PREF_ADDR_LIST));
    destination.setDefaultBoolean(PREF_AUTO_ADDR_LIST, source.getDefaultBoolean(PREF_AUTO_ADDR_LIST));
    destination.setDefaultDouble(PREF_BEACON_PERIOD, source.getDefaultDouble(PREF_BEACON_PERIOD));
    destination.setDefaultDouble(PREF_CONNECTION_TIMEOUT, source.getDefaultDouble(PREF_CONNECTION_TIMEOUT));
    destination.setDefaultInteger(PREF_MAX_ARRAY_SIZE, source.getDefaultInt(PREF_MAX_ARRAY_SIZE));
    destination.setDefaultInteger(PREF_REPEATER_PORT, source.getDefaultInt(PREF_REPEATER_PORT));
    destination.setDefaultInteger(PREF_SERVER_PORT, source.getDefaultInt(PREF_SERVER_PORT));

    destination.setBoolean(PREF_DBE_PROPERTY_SUPPORTED, source.getBoolean(PREF_DBE_PROPERTY_SUPPORTED));
    destination.setBoolean(PREF_HONOR_ZERO_PRECISION, source.getBoolean(PREF_HONOR_ZERO_PRECISION));
    destination.setString(PREF_MONITOR_MASK, source.getString(PREF_MONITOR_MASK));
    destination.setInteger(PREF_CUSTOM_MASK, source.getInt(PREF_CUSTOM_MASK));
    destination.setBoolean(PREF_VALUE_RTYP_MONITOR, source.getBoolean(PREF_VALUE_RTYP_MONITOR));
    destination.setString(PREF_VARIABLE_LENGTH_ARRAY, source.getString(PREF_VARIABLE_LENGTH_ARRAY));
    destination.setString(PREF_ADDR_LIST, source.getString(PREF_ADDR_LIST));
    destination.setBoolean(PREF_AUTO_ADDR_LIST, source.getBoolean(PREF_AUTO_ADDR_LIST));
    destination.setDouble(PREF_BEACON_PERIOD, source.getDouble(PREF_BEACON_PERIOD));
    destination.setDouble(PREF_CONNECTION_TIMEOUT, source.getDouble(PREF_CONNECTION_TIMEOUT));
    destination.setInteger(PREF_MAX_ARRAY_SIZE, source.getInt(PREF_MAX_ARRAY_SIZE));
    destination.setInteger(PREF_REPEATER_PORT, source.getInt(PREF_REPEATER_PORT));
    destination.setInteger(PREF_SERVER_PORT, source.getInt(PREF_SERVER_PORT));

}

From source file:org.csstudio.diirt.util.preferences.DIIRTPreferencesPlugin.java

License:Open Source License

public static void copyDataSources(IPreferenceStore source, DIIRTPreferences destination) {

    destination.setDefaultString(PREF_DEFAULT, source.getDefaultString(PREF_DEFAULT));
    destination.setDefaultString(PREF_DELIMITER, source.getDefaultString(PREF_DELIMITER));

    destination.setString(PREF_DEFAULT, source.getString(PREF_DEFAULT));
    destination.setString(PREF_DELIMITER, source.getString(PREF_DELIMITER));

}

From source file:org.drools.eclipse.preferences.DroolsPreferencePage.java

License:Apache License

private void initializeDefaults() {
    IPreferenceStore store = getPreferenceStore();
    buildAllCheckBox.setSelection(store.getDefaultBoolean(IDroolsConstants.BUILD_ALL));
    collapseEditorCheckBox.setSelection(store.getDefaultBoolean(IDroolsConstants.EDITOR_FOLDING));
    cacheParsedRulesCheckBox.setSelection(store.getDefaultBoolean(IDroolsConstants.CACHE_PARSED_RULES));
    String skin = store.getDefaultString(IDroolsConstants.SKIN);
    int index = 0;
    if ("BPMN".equals(skin)) {
        index = 1;//from w  w  w.jav a2 s . c  o  m
    }
    processSkinCombo.select(index);
    allowNodeCustomizationCheckBox
            .setSelection(store.getDefaultBoolean(IDroolsConstants.ALLOW_NODE_CUSTOMIZATION));
    internalAPICombo.select(store.getDefaultInt(IDroolsConstants.ALLOW_NODE_CUSTOMIZATION));
}

From source file:org.drools.eclipse.task.preferences.DroolsTaskPreferencePage.java

License:Apache License

private void initializeDefaults() {
    IPreferenceStore store = getPreferenceStore();
    ipAddressText.setText(store.getDefaultString(DroolsTaskConstants.SERVER_IP_ADDRESS));
    portText.setText(store.getDefaultInt(DroolsTaskConstants.SERVER_PORT) + "");
    languageText.setText(store.getDefaultString(DroolsTaskConstants.LANGUAGE));
}

From source file:org.ebayopensource.vjet.eclipse.internal.debug.ui.pref.VjetStepFilterPreferencePage.java

License:Open Source License

/**
 * Returns all of the committed filters//from   ww  w . jav a  2s .c o  m
 * 
 * @return an array of committed filters
 * @since 3.2
 */
protected Filter[] getAllStoredFilters(boolean defaults) {
    Filter[] filters = null;
    String[] activefilters, inactivefilters;
    IPreferenceStore store = getPreferenceStore();
    if (defaults) {
        activefilters = ScriptDebugOptionsManager
                .parseList(store.getDefaultString(IDLTKDebugUIPreferenceConstants.PREF_ACTIVE_FILTERS_LIST));
        inactivefilters = ScriptDebugOptionsManager
                .parseList(store.getDefaultString(IDLTKDebugUIPreferenceConstants.PREF_INACTIVE_FILTERS_LIST));
    } else {
        activefilters = ScriptDebugOptionsManager
                .parseList(store.getString(IDLTKDebugUIPreferenceConstants.PREF_ACTIVE_FILTERS_LIST));
        inactivefilters = ScriptDebugOptionsManager
                .parseList(store.getString(IDLTKDebugUIPreferenceConstants.PREF_INACTIVE_FILTERS_LIST));
    }
    filters = new Filter[activefilters.length + inactivefilters.length];
    for (int i = 0; i < activefilters.length; i++) {
        String[] split = activefilters[i].split(VjetSmartStepEvaluator.MODIFIER_SPLITTER); //$NON-NLS-1$
        if (split.length == 1) {
            filters[i] = new Filter(split[0], true, 0);
        } else {
            filters[i] = new Filter(split[0], true, (new Integer(split[1])).intValue());
        }
    }
    for (int i = 0; i < inactivefilters.length; i++) {
        String[] split = inactivefilters[i].split(VjetSmartStepEvaluator.MODIFIER_SPLITTER); //$NON-NLS-1$
        if (split.length == 1) {
            filters[i + activefilters.length] = new Filter(split[0], false, 0);
        } else {
            filters[i + activefilters.length] = new Filter(split[0], false, (new Integer(split[1])).intValue());
        }
    }
    return filters;
}

From source file:org.ebayopensource.vjet.eclipse.internal.ui.preferences.VJOMembersOrderPreferencePage.java

License:Open Source License

protected void performDefaults() {
    IPreferenceStore prefs = DLTKUIPlugin.getDefault().getPreferenceStore();
    String str = prefs.getDefaultString(PREF_OUTLINE_SORT_OPTION);
    if (str != null)
        fSortOrderList.setElements(parseList(str));
    else/*from   www  . j  a  v  a 2s  .  c  o m*/
        fSortOrderList.setElements(parseList(ALL_SORTMEMBER_ENTRIES));

    str = prefs.getDefaultString(PREF_VISIBILITY_SORT_OPTION);
    if (str != null)
        fVisibilityOrderList.setElements(parseList(str));
    else
        fVisibilityOrderList.setElements(parseList(ALL_VISIBILITY_ENTRIES));

    fUseVisibilitySortField.setSelection(prefs.getDefaultBoolean(PREF_USE_VISIBILITY_SORT_OPTION));

    super.performDefaults();
}

From source file:org.eclipse.ajdt.ui.tests.preferences.AJCompilerPreferencePageTest.java

License:Open Source License

/**
 * Want to test that the defaults being used in the AJCompilerPreferencePage
 * (via Window > Preferences) is the same as in the CompilerPreferencePage
 * (via right click > Preferences).//from   w  w  w. j a  v a2s.  co m
 *
 */
public void testSetDefaults() throws Exception {
    IPreferenceStore prefStore = AspectJUIPlugin.getDefault().getPreferenceStore();
    AJCompilerPreferencePage.initDefaults(prefStore);
    AJCompilerPreferencePage.setProjectDefaults(projectNode);

    String[] keys = projectNode.keys();
    for (int i = 0; i < keys.length; i++) {
        String key = keys[i];
        String compilerDefault = projectNode.get(key, ""); //$NON-NLS-1$
        String storeDefault = prefStore.getDefaultString(key);
        assertEquals("default settings should be the same for key " + key, storeDefault, compilerDefault); //$NON-NLS-1$
    }
}