List of usage examples for org.eclipse.jface.resource StringConverter asInt
public static int asInt(String value) throws DataFormatException
From source file:org.codecover.eclipse.preferences.RGBWithBoundaries.java
License:Open Source License
/** * Sets the values of this RGBWithBoundaries according to the given string, * which can be created by calling toString(). UpperBoundary & lowerBoundary * are set so lowerBoundary <= upperBoundary * /*from www . j ava2 s . c om*/ * @param string * an encoding of a RGBWithBoundaries * @throws DataFormatException * thrown, if stringformat doesn't fit */ public void setValues(String string) throws DataFormatException { String[] elements = string.split(SEPERATOR); if (elements.length == 3) { this.setValues(StringConverter.asRGB(elements[0]), StringConverter.asInt(elements[1]), StringConverter.asInt(elements[2])); } else { throw new DataFormatException("Invalid data format. " //$NON-NLS-1$ + string + " doesn't consist of three parts devided by \"" //$NON-NLS-1$ + SEPERATOR + "\""); //$NON-NLS-1$ } }