/** * Converts the given value into an SWT RGB color value. * Returns the given default value if the * value does not represent an RGB color value. * * @param value the value to be converted * @param dflt the default value * @return the value as a RGB color value, or the default value */ public static RGB asRGB(String value, RGB dflt) { try { return asRGB(value); } catch (DataFormatException e) { return dflt; } }
protected int asInt(String string, int defaultValue) { if (string != null) { return StringConverter.asInt(string, defaultValue); } return defaultValue; }
/** * Converts a font data array to a string. The string representation is * that of asString(FontData) seperated by ';' * * @param value The font data. * @return The string representation of the font data arra. */ public static String asString(FontData[] value) { StringBuffer buffer = new StringBuffer(); for (int i = 0; i < value.length; i++) { buffer.append(asString(value[i])); if (i != value.length - 1) { buffer.append(FONT_SEPARATOR); } } return buffer.toString(); }
i= StringConverter.asInt(s, IMarker.SEVERITY_INFO); info.setSeverity(i); b= StringConverter.asBoolean(s, false); info.setTextPreferenceValue(b); b= StringConverter.asBoolean(s, false); info.setHighlightPreferenceValue(b); b= StringConverter.asBoolean(s, false); info.setOverviewRulerPreferenceValue(b); b= StringConverter.asBoolean(s, true); info.setVerticalRulerPreferenceValue(b); RGB rgb= StringConverter.asRGB(s); info.setColorPreferenceValue(rgb == null ? new RGB(0,0,0) : rgb); i= StringConverter.asInt(s, 0); info.setPresentationLayer(i); b= StringConverter.asBoolean(s, false); info.setContributesToHeader(b); b= StringConverter.asBoolean(s, false); info.setShowInNextPrevDropdownToolbarAction(b); b= StringConverter.asBoolean(s, false); info.setIsGoToNextNavigationTarget(b);
String osname = System.getProperty("os.name").trim(); //$NON-NLS-1$ String wsname = Util.getWS(); osname = StringConverter.removeWhiteSpaces(osname).toLowerCase(); wsname = StringConverter.removeWhiteSpaces(wsname).toLowerCase(); String OSLocation = location; String WSLocation = location;
protected boolean asBoolean(String string, boolean defaultValue) { if (string != null) { return StringConverter.asBoolean(string, defaultValue); } return defaultValue; }
/** * Converts the given value into an SWT point. * Returns the given default value if the * value does not represent a point. * * @param value the value to be converted * @param dflt the default value * @return the value as a point, or the default value */ public static Point asPoint(String value, Point dflt) { try { return asPoint(value); } catch (DataFormatException e) { return dflt; } }
/** * Converts the given value into an SWT rectangle. * Returns the given default value if the * value does not represent a rectangle. * * @param value the value to be converted * @param dflt the default value * @return the value as a rectangle, or the default value */ public static Rectangle asRectangle(String value, Rectangle dflt) { try { return asRectangle(value); } catch (DataFormatException e) { return dflt; } }
i= StringConverter.asInt(s, IMarker.SEVERITY_INFO); info.setSeverity(i); b= StringConverter.asBoolean(s, false); info.setTextPreferenceValue(b); b= StringConverter.asBoolean(s, false); info.setHighlightPreferenceValue(b); b= StringConverter.asBoolean(s, false); info.setOverviewRulerPreferenceValue(b); b= StringConverter.asBoolean(s, true); info.setVerticalRulerPreferenceValue(b); RGB rgb= StringConverter.asRGB(s); info.setColorPreferenceValue(rgb == null ? new RGB(0,0,0) : rgb); i= StringConverter.asInt(s, 0); info.setPresentationLayer(i); b= StringConverter.asBoolean(s, false); info.setContributesToHeader(b); b= StringConverter.asBoolean(s, false); info.setShowInNextPrevDropdownToolbarAction(b); b= StringConverter.asBoolean(s, false); info.setIsGoToNextNavigationTarget(b);
String osname = System.getProperty("os.name").trim(); //$NON-NLS-1$ String wsname = Util.getWS(); osname = StringConverter.removeWhiteSpaces(osname).toLowerCase(); wsname = StringConverter.removeWhiteSpaces(wsname).toLowerCase(); String OSLocation = location; String WSLocation = location;
protected boolean asBoolean(String string, boolean defaultValue) { if (string != null) { return StringConverter.asBoolean(string, defaultValue); } return defaultValue; }
/** * Converts the given value into an SWT point. * Returns the given default value if the * value does not represent a point. * * @param value the value to be converted * @param dflt the default value * @return the value as a point, or the default value */ public static Point asPoint(String value, Point dflt) { try { return asPoint(value); } catch (DataFormatException e) { return dflt; } }
/** * Converts the given value into an SWT rectangle. * Returns the given default value if the * value does not represent a rectangle. * * @param value the value to be converted * @param dflt the default value * @return the value as a rectangle, or the default value */ public static Rectangle asRectangle(String value, Rectangle dflt) { try { return asRectangle(value); } catch (DataFormatException e) { return dflt; } }
/** * Converts the given value into an SWT RGB color value. * Returns the given default value if the * value does not represent an RGB color value. * * @param value the value to be converted * @param dflt the default value * @return the value as a RGB color value, or the default value */ public static RGB asRGB(String value, RGB dflt) { try { return asRGB(value); } catch (DataFormatException e) { return dflt; } }
/** * Converts a font data array to a string. The string representation is * that of asString(FontData) seperated by ';' * * @param value The font data. * @return The string representation of the font data arra. * @since 3.0 */ public static String asString(FontData[] value) { StringBuffer buffer = new StringBuffer(); for (int i = 0; i < value.length; i++) { buffer.append(asString(value[i])); if (i != value.length - 1) { buffer.append(FONT_SEPARATOR); } } return buffer.toString(); }
private static int asInt(String string, int defaultValue) { if (string != null) { return StringConverter.asInt(string, defaultValue); } return defaultValue; }
private void setErrorMessage(String errorMessage) { if (errorMessageText != null && !errorMessageText.isDisposed()) { errorMessageText.setText(errorMessage == null ? " \n " //$NON-NLS-1$ : errorMessage); boolean hasError = errorMessage != null && (StringConverter.removeWhiteSpaces(errorMessage)) .length() > 0; errorMessageText.setEnabled(hasError); errorMessageText.setVisible(hasError); errorMessageText.getParent().update(); Control button = getButton(IDialogConstants.OK_ID); if (button != null) { button.setEnabled(errorMessage == null); } } }
private boolean asBoolean(String string, boolean defaultValue) { if (string != null) { return StringConverter.asBoolean(string, defaultValue); } return defaultValue; }
/** * Converts the given value into an SWT point. * Returns the given default value if the * value does not represent a point. * * @param value the value to be converted * @param dflt the default value * @return the value as a point, or the default value */ public static Point asPoint(String value, Point dflt) { try { return asPoint(value); } catch (DataFormatException e) { return dflt; } }
/** * Converts the given value into an SWT rectangle. * Returns the given default value if the * value does not represent a rectangle. * * @param value the value to be converted * @param dflt the default value * @return the value as a rectangle, or the default value */ public static Rectangle asRectangle(String value, Rectangle dflt) { try { return asRectangle(value); } catch (DataFormatException e) { return dflt; } }