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

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

Introduction

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

Prototype

int getDefaultInt(String name);

Source Link

Document

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

Usage

From source file:org.eclipse.ptp.gig.views.GIGView.java

License:Open Source License

private void updateBankConflicts(GkleeLog gkleeLog, IProject project) {
    this.bankConflictTree.clearAll(true);
    Image image;//from  www .j a va 2 s .c  o  m
    final int rate = gkleeLog.getBankConflictRate();
    final IPreferenceStore preferenceStore = GIGPlugin.getDefault().getPreferenceStore();
    if (rate > preferenceStore.getDefaultInt(Messages.BANK_CONFLICT_HIGH)) {
        image = GIGPlugin.getImageDescriptor("icons/errorwarning_tab.gif").createImage(); //$NON-NLS-1$
    } else if (rate > preferenceStore.getDefaultInt(Messages.BANK_CONFLICT_LOW)) {
        image = GIGPlugin.getImageDescriptor("icons/icon_warning.gif").createImage(); //$NON-NLS-1$
    } else {
        image = GIGPlugin.getImageDescriptor("icons/no-error.gif").createImage(); //$NON-NLS-1$
    }
    this.bankConflictTab.setImage(image);
    gkleeLog.getBankConflictStats().setupTree(this.bankConflictTree, null);
    gkleeLog.getRrbc().setupTree(this.bankConflictTree, Messages.READ_READ_BANK_CONFLICT,
            Messages.NO + Messages.READ_READ_BANK_CONFLICT, Messages.READ_READ_BANK_CONFLICT, project);
    gkleeLog.getRwbc().setupTree(this.bankConflictTree, Messages.READ_WRITE_BANK_CONFLICT,
            Messages.NO + Messages.READ_WRITE_BANK_CONFLICT, Messages.READ_WRITE_BANK_CONFLICT, project);
    gkleeLog.getWwbc().setupTree(this.bankConflictTree, Messages.WRITE_WRITE_BANK_CONFLICT,
            Messages.NO + Messages.WRITE_WRITE_BANK_CONFLICT, Messages.WRITE_WRITE_BANK_CONFLICT, project);
}

From source file:org.eclipse.ptp.gig.views.GIGView.java

License:Open Source License

private void updateMemoryCoalescing(GkleeLog gkleeLog, IProject project) {
    this.memoryCoalescingTree.clearAll(true);
    Image image;//  w  w w. ja va2  s  .c o  m
    final IPreferenceStore preferenceStore = GIGPlugin.getDefault().getPreferenceStore();
    final int rate = gkleeLog.getMemoryCoalescingRate();
    if (rate < preferenceStore.getDefaultInt(Messages.MEMORY_COALESCING_HIGH)) {
        image = GIGPlugin.getImageDescriptor("icons/errorwarning_tab.gif").createImage(); //$NON-NLS-1$
    } else if (rate < preferenceStore.getDefaultInt(Messages.MEMORY_COALESCING_LOW)) {
        image = GIGPlugin.getImageDescriptor("icons/icon_warning.gif").createImage(); //$NON-NLS-1$
    } else {
        image = GIGPlugin.getImageDescriptor("icons/no-error.gif").createImage(); //$NON-NLS-1$
    }
    this.memoryCoalescingTab.setImage(image);
    gkleeLog.getMemoryCoalescingStats().setupTree(this.memoryCoalescingTree,
            gkleeLog.getMemoryCoalescingLocation());
    gkleeLog.getMemoryCoalescing().setupTree(this.memoryCoalescingTree,
            Messages.NONCOALESCED_GLOBAL_MEMORY_ACCESSES,
            Messages.NO + Messages.NONCOALESCED_GLOBAL_MEMORY_ACCESSES,
            Messages.NONCOALESCED_GLOBAL_MEMORY_ACCESS, project);
}

From source file:org.eclipse.ptp.gig.views.GIGView.java

License:Open Source License

private void updateWarpDivergence(GkleeLog gkleeLog, IProject project) {
    this.warpDivergenceTree.clearAll(true);
    Image image;// ww  w  .  j a v  a2s  .com
    final int rate = gkleeLog.getWarpDivergenceRate();
    final IPreferenceStore preferenceStore = GIGPlugin.getDefault().getPreferenceStore();
    if (rate > preferenceStore.getDefaultInt(Messages.WARP_DIVERGENCE_HIGH)) {
        image = GIGPlugin.getImageDescriptor("icons/errorwarning_tab.gif").createImage(); //$NON-NLS-1$
    } else if (rate > preferenceStore.getDefaultInt(Messages.WARP_DIVERGENCE_LOW)) {
        image = GIGPlugin.getImageDescriptor("icons/icon_warning.gif").createImage(); //$NON-NLS-1$
    } else {
        image = GIGPlugin.getImageDescriptor("icons/no-error.gif").createImage(); //$NON-NLS-1$
    }
    this.warpDivergenceTab.setImage(image);
    gkleeLog.getWarpDivergenceStats().setupTree(this.warpDivergenceTree, null);
    TreeItem treeItem, subTreeItem, subSubTreeItem;
    final List<WarpDivergence> warpDivergences = gkleeLog.getWarpDivergences();
    final int size = warpDivergences.size();
    for (int i = 0; i < size; i++) {
        final WarpDivergence warpDivergence = warpDivergences.get(i);
        treeItem = new TreeItem(this.warpDivergenceTree, SWT.NONE);
        final List<int[]> sets = warpDivergence.getSets();
        if (sets.size() > 1) {
            treeItem.setText(
                    String.format(Messages.WARP_DIVERGES_INTO_FOLLOWING_SETS, warpDivergence.getWarpNumber()));
            for (int j = 0; j < sets.size(); j++) {
                subTreeItem = new TreeItem(treeItem, SWT.NONE);
                subTreeItem.setText(String.format(Messages.SET, j));
                final StringBuilder stringBuilder = new StringBuilder();
                final int[] set = sets.get(j);
                for (final int element : set) {
                    stringBuilder.append(element + ", "); //$NON-NLS-1$
                }
                subSubTreeItem = new TreeItem(subTreeItem, SWT.NONE);
                subSubTreeItem.setText(stringBuilder.toString());
            }
        } else {
            treeItem.setText(String.format(Messages.WARP_DOES_NOT_DIVERGE, warpDivergence.getWarpNumber()));
        }
    }
}

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/* w ww .j av  a2 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.// w w w.  ja  v a  2  s.  c om
 */
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  www . j  a v a  2s.co m
 */
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.dialogs.GlobalizationPreferencePage.java

License:Open Source License

/**
 * The default button has been pressed./*from  w ww  .  j a  v  a  2 s.c  o m*/
 */
@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.//from  w w w  .j  a va  2s . 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.texteditor.ChainedPreferenceStore.java

License:Open Source License

public int getDefaultInt(String name) {
    IPreferenceStore visibleStore = getVisibleStore(name);
    if (visibleStore != null)
        return visibleStore.getDefaultInt(name);
    return INT_DEFAULT_DEFAULT;
}

From source file:org.emftext.language.xpath3.resource.xpath3.ui.Xpath3ContentAssistPreferencePage.java

License:Open Source License

protected void performDefaults() {
    IPreferenceStore preferenceStore = getPreferenceStore();
    assistEnabled = preferenceStore.getDefaultBoolean(
            org.emftext.language.xpath3.resource.xpath3.ui.Xpath3PreferenceConstants.EDITOR_CONTENT_ASSIST_ENABLED);
    activationDelay = preferenceStore.getDefaultInt(
            org.emftext.language.xpath3.resource.xpath3.ui.Xpath3PreferenceConstants.EDITOR_CONTENT_ASSIST_DELAY);
    activationTriggers = preferenceStore.getDefaultString(
            org.emftext.language.xpath3.resource.xpath3.ui.Xpath3PreferenceConstants.EDITOR_CONTENT_ASSIST_TRIGGERS);
    // defaults in widgets
    btnActivate.setEnabled(assistEnabled);
    btnActivate.setSelection(assistEnabled);
    txtDelay.setEnabled(assistEnabled);/* w  w w.j  a  v a  2  s  . c  o  m*/
    txtDelay.setText(String.valueOf(activationDelay));
    txtTriggers.setEnabled(assistEnabled);
    txtTriggers.setText(activationTriggers);
}