Example usage for org.eclipse.jface.dialogs IDialogSettings getFloat

List of usage examples for org.eclipse.jface.dialogs IDialogSettings getFloat

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogSettings getFloat.

Prototype

float getFloat(String key) throws NumberFormatException;

Source Link

Document

Convenience API.

Usage

From source file:com.bdaum.zoom.operations.internal.gen.AbstractGalleryGenerator.java

License:Open Source License

private static float getFloatSetting(IDialogSettings section, String key) {
    try {/*from  www.ja  va  2s.c o m*/
        return section.getFloat(key);
    } catch (Exception e) {
        return Float.NaN;
    }
}

From source file:com.nokia.cdt.internal.debug.launch.ui.FilesBlock.java

License:Open Source License

private float restoreColumnWeight(IDialogSettings settings, String qualifier, int col) {
    try {//from   www.  ja  v a  2 s.  com
        return settings.getFloat(qualifier + ".column" + col); //$NON-NLS-1$
    } catch (NumberFormatException e) {
        return 1 / 3F;
    }

}

From source file:net.tourbook.common.util.Util.java

License:Open Source License

/**
 * @param state/*from www.  j  ava 2 s. c  o m*/
 * @param key
 * @param defaultValue
 * @return Returns a float value from {@link IDialogSettings}. When the key is not found, the
 *         default value is returned.
 */
public static float getStateFloat(final IDialogSettings state, final String key, final float defaultValue) {

    if (state == null) {
        return defaultValue;
    }

    try {
        return state.get(key) == null ? defaultValue : state.getFloat(key);
    } catch (final NumberFormatException e) {
        return defaultValue;
    }
}

From source file:net.tourbook.util.Util.java

License:Open Source License

/**
 * @param state/*ww w .  j av a2s .  c o m*/
 * @param key
 * @param defaultValue
 * @return Returns a float value from {@link IDialogSettings}. When the key is not found, the
 *         default value is returned.
 */
public static float getStateFloat(final IDialogSettings state, final String key, final float defaultValue) {
    try {
        return state.get(key) == null ? defaultValue : state.getFloat(key);
    } catch (final NumberFormatException e) {
        return defaultValue;
    }
}

From source file:org.eclipse.php.internal.debug.ui.preferences.phps.InstalledPHPsBlock.java

License:Open Source License

private float restoreColumnWeight(final IDialogSettings settings, final String qualifier, final int col) {
    try {//from   www .j  a  va 2  s . com
        return settings.getFloat(qualifier + ".column" + col); //$NON-NLS-1$
    } catch (final NumberFormatException e) {
        switch (col) {
        case 1:
            return 2 / 8F;
        default:
            return 3 / 8F;
        }
    }

}

From source file:org.erlide.ui.prefs.RuntimePreferencePage.java

License:Open Source License

private float restoreColumnWeight(final IDialogSettings settings, final String qualifier, final int col) {
    try {/*from w  w  w.  j  a v a2 s . c  o m*/
        return settings.getFloat(qualifier + ".column" + col); //$NON-NLS-1$
    } catch (final NumberFormatException e) {
        return 1 / 3F;
    }

}

From source file:org.kalypso.contribs.eclipse.jface.dialog.DialogSettingsUtils.java

License:Open Source License

/**
 * Calls {@link IDialogSettings#getFloat(String)} but catches the {@link NumberFormatException} (e.g. if the key does
 * not exist) and returns the defaultValue.
 * /*from   w ww  .j  ava 2 s. c o m*/
 * @param defaultValue
 *          Returned, if the settings do not contain a float for the given key.
 */
public static float getFloat(final IDialogSettings dialogSettings, final String key, final float defaultValue) {
    try {
        return dialogSettings.getFloat(key);
    } catch (final NumberFormatException e) {
        // ignored
    }

    return defaultValue;
}