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

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

Introduction

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

Prototype

boolean getDefaultBoolean(String name);

Source Link

Document

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

Usage

From source file:org.eclipse.team.examples.pessimistic.ui.PessimisticPreferencesPage.java

License:Open Source License

protected void performDefaults() {
    IPreferenceStore store = getPreferenceStore();

    filesAreEditedCombo.select(getEditOptionIndex(
            store.getDefaultInt(IPessimisticFilesystemConstants.PREF_CHECKED_IN_FILES_EDITED)));
    filesAreEditedNoPromptCombo.select(getEditNoPromptOptionIndex(
            store.getDefaultInt(IPessimisticFilesystemConstants.PREF_CHECKED_IN_FILES_EDITED_NOPROMPT)));
    filesAreSavedCombo.select(getSaveOptionIndex(
            store.getDefaultInt(IPessimisticFilesystemConstants.PREF_CHECKED_IN_FILES_SAVED)));
    addToControlCombo.select(getAddToControlOptionIndex(
            store.getDefaultInt(IPessimisticFilesystemConstants.PREF_ADD_TO_CONTROL)));
    failValidateEdit//from w w w . j a v  a 2 s.co m
            .setSelection(store.getDefaultBoolean(IPessimisticFilesystemConstants.PREF_FAIL_VALIDATE_EDIT));
    changeFileContents.setSelection(
            store.getDefaultBoolean(IPessimisticFilesystemConstants.PREF_TOUCH_DURING_VALIDATE_EDIT));
    super.performDefaults();
}

From source file:org.eclipse.test.internal.performance.results.ui.PerformanceResultsPreferencePage.java

License:Open Source License

/**
 * Initializes states of the controls using default values in the preference
 * store.//from   ww  w  . j  av  a 2  s  . co  m
 */
private void initializeDefaults() {
    IPreferenceStore store = getPreferenceStore();

    // Init default database values
    this.dbConnectionCheckBox.setSelection(store.getDefaultBoolean(PRE_DATABASE_CONNECTION));
    this.dbRelengRadioButton.setSelection(false);
    this.dbLocalRadioButton.setSelection(false);
    final boolean dbLocal = store.getDefaultBoolean(PRE_DATABASE_LOCAL);
    if (dbLocal) {
        this.dbLocalRadioButton.setSelection(true);
    } else {
        this.dbRelengRadioButton.setSelection(true);
    }
    this.databaseLocationCombo.removeAll();
    this.databaseLocationCombo.setText(store.getString(PRE_DATABASE_LOCATION));
    updateDatabaseGroup();

    // Init eclipse version
    this.mVersionRadioButton.setSelection(false);
    this.dVersionRadionButton.setSelection(false);
    int version = store.getDefaultInt(PRE_ECLIPSE_VERSION);
    if (version == ECLIPSE_MAINTENANCE_VERSION) {
        this.mVersionRadioButton.setSelection(true);
    } else {
        this.dVersionRadionButton.setSelection(true);
    }
    updateBrowseButtonToolTip(version);

    // Milestones
    this.milestonesCombo.removeAll();
    String prefix = PRE_MILESTONE_BUILDS + "." + version;
    String milestone = store.getDefaultString(prefix + "0");
    int index = 0;
    while (milestone != null && milestone.length() > 0) {
        this.milestonesCombo.add(milestone);
        milestone = store.getDefaultString(prefix + index);
    }

    // Init default default dimension
    String defaultDimension = store.getDefaultString(PRE_DEFAULT_DIMENSION);
    this.defaultDimensionCombo.setText(defaultDimension);

    // Init default generated dimensions
    this.resultsDimensionsList.add(store.getDefaultString(PRE_RESULTS_DIMENSION + ".0"));
    this.resultsDimensionsList.add(store.getDefaultString(PRE_RESULTS_DIMENSION + ".1"));
}

From source file:org.eclipse.ui.examples.readmetool.ReadmePreferencePage.java

License:Open Source License

/**
 * Initializes states of the controls using default values
 * in the preference store.//from  w w  w .j  a  v  a 2s .  c  om
 */
private void initializeDefaults() {
    IPreferenceStore store = getPreferenceStore();
    checkBox1.setSelection(store.getDefaultBoolean(IReadmeConstants.PRE_CHECK1));
    checkBox2.setSelection(store.getDefaultBoolean(IReadmeConstants.PRE_CHECK2));
    checkBox3.setSelection(store.getDefaultBoolean(IReadmeConstants.PRE_CHECK3));

    radioButton1.setSelection(false);
    radioButton2.setSelection(false);
    radioButton3.setSelection(false);
    int choice = store.getDefaultInt(IReadmeConstants.PRE_RADIO_CHOICE);
    switch (choice) {
    case 1:
        radioButton1.setSelection(true);
        break;
    case 2:
        radioButton2.setSelection(true);
        break;
    case 3:
        radioButton3.setSelection(true);
        break;
    }
    textField.setText(store.getDefaultString(IReadmeConstants.PRE_TEXT));
}

From source file:org.eclipse.ui.internal.activities.ExtensionActivityRegistry.java

License:Open Source License

private void load() throws IOException {
    if (activityRequirementBindingDefinitions == null) {
        activityRequirementBindingDefinitions = new ArrayList();
    } else {/*  www.  java2s . co  m*/
        activityRequirementBindingDefinitions.clear();
    }

    if (activityDefinitions == null) {
        activityDefinitions = new ArrayList();
    } else {
        activityDefinitions.clear();
    }

    if (activityPatternBindingDefinitions == null) {
        activityPatternBindingDefinitions = new ArrayList();
    } else {
        activityPatternBindingDefinitions.clear();
    }

    if (categoryActivityBindingDefinitions == null) {
        categoryActivityBindingDefinitions = new ArrayList();
    } else {
        categoryActivityBindingDefinitions.clear();
    }

    if (categoryDefinitions == null) {
        categoryDefinitions = new ArrayList();
    } else {
        categoryDefinitions.clear();
    }

    if (defaultEnabledActivities == null) {
        defaultEnabledActivities = new ArrayList();
    } else {
        defaultEnabledActivities.clear();
    }

    IConfigurationElement[] configurationElements = extensionRegistry
            .getConfigurationElementsFor(Persistence.PACKAGE_FULL);

    for (int i = 0; i < configurationElements.length; i++) {
        IConfigurationElement configurationElement = configurationElements[i];
        String name = configurationElement.getName();

        if (Persistence.TAG_ACTIVITY_REQUIREMENT_BINDING.equals(name)) {
            readActivityRequirementBindingDefinition(configurationElement);
        } else if (Persistence.TAG_ACTIVITY.equals(name)) {
            readActivityDefinition(configurationElement);
        } else if (Persistence.TAG_ACTIVITY_PATTERN_BINDING.equals(name)) {
            readActivityPatternBindingDefinition(configurationElement);
        } else if (Persistence.TAG_CATEGORY_ACTIVITY_BINDING.equals(name)) {
            readCategoryActivityBindingDefinition(configurationElement);
        } else if (Persistence.TAG_CATEGORY.equals(name)) {
            readCategoryDefinition(configurationElement);
        } else if (Persistence.TAG_DEFAULT_ENABLEMENT.equals(name)) {
            readDefaultEnablement(configurationElement);
        }
    }

    // merge enablement overrides from plugin_customization.ini
    IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
    for (Iterator i = activityDefinitions.iterator(); i.hasNext();) {
        ActivityDefinition activityDef = (ActivityDefinition) i.next();
        String id = activityDef.getId();
        String preferenceKey = createPreferenceKey(id);
        if ("".equals(store.getDefaultString(preferenceKey))) //$NON-NLS-1$
            continue;
        if (store.getDefaultBoolean(preferenceKey)) {
            if (!defaultEnabledActivities.contains(id) && activityDef.getEnabledWhen() == null)
                defaultEnabledActivities.add(id);
        } else {
            defaultEnabledActivities.remove(id);
        }
    }

    // Removal of all defaultEnabledActivites which target to expression
    // controlled activities.
    for (int i = 0; i < defaultEnabledActivities.size();) {
        String id = (String) defaultEnabledActivities.get(i);
        ActivityDefinition activityDef = getActivityDefinitionById(id);
        if (activityDef != null && activityDef.getEnabledWhen() != null) {
            defaultEnabledActivities.remove(i);
            StatusManager.getManager().handle(new Status(IStatus.WARNING, PlatformUI.PLUGIN_ID,
                    "Default enabled activity declarations will be ignored (id: " + id + ")")); //$NON-NLS-1$ //$NON-NLS-2$
        } else {
            i++;
        }
    }

    // remove all requirement bindings that reference expression-bound activities
    for (Iterator i = activityRequirementBindingDefinitions.iterator(); i.hasNext();) {
        ActivityRequirementBindingDefinition bindingDef = (ActivityRequirementBindingDefinition) i.next();
        ActivityDefinition activityDef = getActivityDefinitionById(bindingDef.getRequiredActivityId());
        if (activityDef != null && activityDef.getEnabledWhen() != null) {
            i.remove();
            StatusManager.getManager().handle(new Status(IStatus.WARNING, PlatformUI.PLUGIN_ID,
                    "Expression activity cannot have requirements (id: " + activityDef.getId() + ")")); //$NON-NLS-1$ //$NON-NLS-2$
            continue;
        }

        activityDef = getActivityDefinitionById(bindingDef.getActivityId());
        if (activityDef != null && activityDef.getEnabledWhen() != null) {
            i.remove();
            StatusManager.getManager().handle(new Status(IStatus.WARNING, PlatformUI.PLUGIN_ID,
                    "Expression activity cannot be required (id: " + activityDef.getId() + ")")); //$NON-NLS-1$ //$NON-NLS-2$
        }
    }

    boolean activityRegistryChanged = false;

    if (!activityRequirementBindingDefinitions.equals(super.activityRequirementBindingDefinitions)) {
        super.activityRequirementBindingDefinitions = Collections
                .unmodifiableList(new ArrayList(activityRequirementBindingDefinitions));
        activityRegistryChanged = true;
    }

    if (!activityDefinitions.equals(super.activityDefinitions)) {
        super.activityDefinitions = Collections.unmodifiableList(new ArrayList(activityDefinitions));
        activityRegistryChanged = true;
    }

    if (!activityPatternBindingDefinitions.equals(super.activityPatternBindingDefinitions)) {
        super.activityPatternBindingDefinitions = Collections
                .unmodifiableList(new ArrayList(activityPatternBindingDefinitions));
        activityRegistryChanged = true;
    }

    if (!categoryActivityBindingDefinitions.equals(super.categoryActivityBindingDefinitions)) {
        super.categoryActivityBindingDefinitions = Collections
                .unmodifiableList(new ArrayList(categoryActivityBindingDefinitions));
        activityRegistryChanged = true;
    }

    if (!categoryDefinitions.equals(super.categoryDefinitions)) {
        super.categoryDefinitions = Collections.unmodifiableList(new ArrayList(categoryDefinitions));
        activityRegistryChanged = true;
    }

    if (!defaultEnabledActivities.equals(super.defaultEnabledActivities)) {
        super.defaultEnabledActivities = Collections.unmodifiableList(new ArrayList(defaultEnabledActivities));
        activityRegistryChanged = true;
    }

    if (activityRegistryChanged) {
        fireActivityRegistryChanged();
    }
}

From source file:org.eclipse.ui.internal.dialogs.EditorsPreferencePage.java

License:Open Source License

protected void performDefaults() {
    IPreferenceStore store = getPreferenceStore();
    showMultipleEditorTabs.setSelection(
            getAPIPreferenceStore().getDefaultBoolean(IWorkbenchPreferenceConstants.SHOW_MULTIPLE_EDITOR_TABS));
    allowInplaceEditor.setSelection(!getAPIPreferenceStore()
            .getDefaultBoolean(IWorkbenchPreferenceConstants.DISABLE_OPEN_EDITOR_IN_PLACE));
    useIPersistableEditor.setSelection(store.getDefaultBoolean(IPreferenceConstants.USE_IPERSISTABLE_EDITORS));
    promptWhenStillOpenEditor.setSelection(getAPIPreferenceStore()
            .getDefaultBoolean(IWorkbenchPreferenceConstants.PROMPT_WHEN_SAVEABLE_STILL_OPEN));
    reuseEditors.setSelection(store.getDefaultBoolean(IPreferenceConstants.REUSE_EDITORS_BOOLEAN));
    dirtyEditorReuseGroup.setEnabled(reuseEditors.getSelection());
    openNewEditor.setSelection(!store.getDefaultBoolean(IPreferenceConstants.REUSE_DIRTY_EDITORS));
    openNewEditor.setEnabled(reuseEditors.getSelection());
    promptToReuseEditor.setSelection(store.getDefaultBoolean(IPreferenceConstants.REUSE_DIRTY_EDITORS));
    promptToReuseEditor.setEnabled(reuseEditors.getSelection());
    reuseEditorsThreshold.loadDefault();
    reuseEditorsThreshold.getLabelControl(editorReuseThresholdGroup).setEnabled(reuseEditors.getSelection());
    reuseEditorsThreshold.getTextControl(editorReuseThresholdGroup).setEnabled(reuseEditors.getSelection());
    recentFilesEditor.loadDefault();//from  ww  w.  j av a2 s. c om
}

From source file:org.eclipse.ui.internal.dialogs.GlobalizationPreferencePage.java

License:Open Source License

/**
 * The default button has been pressed.// www . java  2  s  . c  om
 */
@Override
protected void performDefaults() {
    IPreferenceStore store = getPreferenceStore();
    nlExtensionsField.setStringValue(store.getDefaultString(IPreferenceConstants.NL_EXTENSIONS));
    layoutDirection = store.getDefaultInt(IPreferenceConstants.LAYOUT_DIRECTION);
    bidiSupport = store.getDefaultBoolean(IPreferenceConstants.BIDI_SUPPORT);
    textDirection = store.getDefaultString(IPreferenceConstants.TEXT_DIRECTION);
    layoutDirectionCombo.select(getLayoutDirectionIndex(layoutDirection));
    bidiSupportClickButton.setSelection(bidiSupport);
    textDirectionCombo.select(getTextDirectionIndex(textDirection));
    textDirectionCombo.setEnabled(bidiSupport);

    super.performDefaults();
}

From source file:org.eclipse.ui.internal.dialogs.PerspectivesPreferencePage.java

License:Open Source License

/**
 * The default button has been pressed.//  w w w .  j  av a2s .c  om
 */
protected void performDefaults() {
    //Project perspective preferences
    IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();

    openViewMode = store.getDefaultInt(IPreferenceConstants.OPEN_VIEW_MODE);
    // Open view as float no longer supported
    if (openViewMode == IPreferenceConstants.OVM_FLOAT) {
        openViewMode = IPreferenceConstants.OVM_FAST;
    }
    openEmbedButton.setSelection(openViewMode == IPreferenceConstants.OVM_EMBED);
    openFastButton.setSelection(openViewMode == IPreferenceConstants.OVM_FAST);

    if (isFVBConfigured)
        fvbHideButton.setSelection(store.getDefaultBoolean(IPreferenceConstants.FVB_HIDE));

    openPerspMode = store.getDefaultInt(IPreferenceConstants.OPEN_PERSP_MODE);
    openSameWindowButton.setSelection(IPreferenceConstants.OPM_ACTIVE_PAGE == openPerspMode);
    openNewWindowButton.setSelection(IPreferenceConstants.OPM_NEW_WINDOW == openPerspMode);

    String currentDefault = perspectiveRegistry.getDefaultPerspective();

    int index = indexOf(currentDefault);
    if (index >= 0) {
        defaultPerspectiveId = currentDefault;
        updatePerspectivesTable();
        perspectivesTable.setSelection(index);
    }

    String newDefault = PrefUtil.getAPIPreferenceStore()
            .getDefaultString(IWorkbenchPreferenceConstants.DEFAULT_PERSPECTIVE_ID);

    IPerspectiveDescriptor desc = null;
    if (newDefault != null) {
        desc = workbench.getPerspectiveRegistry().findPerspectiveWithId(newDefault);
    }
    if (desc == null) {
        newDefault = workbench.getPerspectiveRegistry().getDefaultPerspective();
    }

    defaultPerspectiveId = newDefault;
    updatePerspectivesTable();

}

From source file:org.eclipse.ui.internal.dialogs.ViewsPreferencePage.java

License:Open Source License

@Override
protected void performDefaults() {
    ((PreferencePageEnhancer) Tweaklets.get(PreferencePageEnhancer.KEY)).performDefaults();
    engine.setTheme(defaultTheme, true);
    if (engine.getActiveTheme() != null) {
        themeIdCombo.setSelection(new StructuredSelection(engine.getActiveTheme()));
    }//from  ww  w.  j a v a 2 s.  co  m
    IPreferenceStore apiStore = PrefUtil.getAPIPreferenceStore();
    enableAnimations.setSelection(apiStore.getDefaultBoolean(IWorkbenchPreferenceConstants.ENABLE_ANIMATIONS));
    useColoredLabels.setSelection(apiStore.getDefaultBoolean(IWorkbenchPreferenceConstants.USE_COLORED_LABELS));
    super.performDefaults();
}

From source file:org.eclipse.ui.internal.dialogs.WorkbenchPreferencePage.java

License:Open Source License

/**
 * The default button has been pressed.//ww w.  ja v  a2 s . c  om
 */
protected void performDefaults() {
    IPreferenceStore store = getPreferenceStore();
    saveInterval.loadDefault();
    stickyCycleButton.setSelection(store.getBoolean(IPreferenceConstants.STICKY_CYCLE));
    openOnSingleClick = store.getDefaultBoolean(IPreferenceConstants.OPEN_ON_SINGLE_CLICK);
    selectOnHover = store.getDefaultBoolean(IPreferenceConstants.SELECT_ON_HOVER);
    openAfterDelay = store.getDefaultBoolean(IPreferenceConstants.OPEN_AFTER_DELAY);
    singleClickButton.setSelection(openOnSingleClick);
    doubleClickButton.setSelection(!openOnSingleClick);
    selectOnHoverButton.setSelection(selectOnHover);
    openAfterDelayButton.setSelection(openAfterDelay);
    selectOnHoverButton.setEnabled(openOnSingleClick);
    openAfterDelayButton.setEnabled(openOnSingleClick);
    stickyCycleButton.setSelection(store.getDefaultBoolean(IPreferenceConstants.STICKY_CYCLE));
    showUserDialogButton.setSelection(store.getDefaultBoolean(IPreferenceConstants.RUN_IN_BACKGROUND));
    showHeapStatusButton.setSelection(PrefUtil.getAPIPreferenceStore()
            .getDefaultBoolean(IWorkbenchPreferenceConstants.SHOW_MEMORY_MONITOR));

    super.performDefaults();
}

From source file:org.eclipse.ui.internal.ide.application.dialogs.IDEStartupPreferencePage.java

License:Open Source License

/**
 * The default button has been pressed.//from  w  w  w .j a  v  a  2 s . c om
 */
protected void performDefaults() {
    IPreferenceStore store = getIDEPreferenceStore();

    refreshButton.setSelection(store.getDefaultBoolean(IDEInternalPreferences.REFRESH_WORKSPACE_ON_STARTUP));
    exitPromptButton
            .setSelection(store.getDefaultBoolean(IDEInternalPreferences.EXIT_PROMPT_ON_CLOSE_LAST_WINDOW));

    super.performDefaults();
}