this.componentName = componentName;
this.optionName = optionName;
this.currentValueIndex = currentValueIndex;
ResourceBundle resource = null;
try {
String location = componentName.substring(0, componentName.lastIndexOf('.'));
resource = ResourceBundle.getBundle(location + ".options", loc); //$NON-NLS-1$
} catch (MissingResourceException e) {
category = "Missing ressources entries for" + componentName + " options"; //$NON-NLS-1$ //$NON-NLS-2$
name = "Missing ressources entries for"+ componentName + " options"; //$NON-NLS-1$ //$NON-NLS-2$
description = "Missing ressources entries for" + componentName + " options"; //$NON-NLS-1$ //$NON-NLS-2$
possibleValues = CharOperation.NO_STRINGS;
id = -1;
}
if (resource == null) return;
try {
id = Integer.parseInt(resource.getString(optionName + ".number")); //$NON-NLS-1$
} catch (MissingResourceException e) {
id = -1;
} catch (NumberFormatException e) {
id = -1;
}
try {
category = resource.getString(optionName + ".category"); //$NON-NLS-1$
} catch (MissingResourceException e) {
category = "Missing ressources entries for" + componentName + " options"; //$NON-NLS-1$ //$NON-NLS-2$
}
try {
name = resource.getString(optionName + ".name"); //$NON-NLS-1$
} catch (MissingResourceException e) {
name = "Missing ressources entries for"+ componentName + " options"; //$NON-NLS-1$ //$NON-NLS-2$
}
try {
StringTokenizer tokenizer = new StringTokenizer(resource.getString(optionName + ".possibleValues"), "|"); //$NON-NLS-1$ //$NON-NLS-2$
int numberOfValues = Integer.parseInt(tokenizer.nextToken());
if(numberOfValues == -1){
possibleValues = NoDiscreteValue;
} else {
possibleValues = new String[numberOfValues];
int index = 0;
while (tokenizer.hasMoreTokens()) {
possibleValues[index] = tokenizer.nextToken();
index++;
}
}
} catch (MissingResourceException e) {
possibleValues = CharOperation.NO_STRINGS;
} catch (NoSuchElementException e) {
possibleValues = CharOperation.NO_STRINGS;
} catch (NumberFormatException e) {
possibleValues = CharOperation.NO_STRINGS;
}
try {
description = resource.getString(optionName + ".description"); //$NON-NLS-1$
} catch (MissingResourceException e) {
description = "Missing ressources entries for"+ componentName + " options"; //$NON-NLS-1$ //$NON-NLS-2$
}
}