use of com.amalto.workbench.detailtabs.sections.model.annotationinfo.langinfo.LanguageInfo in project tmdm-studio-se by Talend.
the class LangInfoCellEditor method parseInput.
private LanguageInfo[] parseInput() {
if (getValue() == null || !(getValue() instanceof String))
return new LanguageInfo[0];
List<LanguageInfo> results = new ArrayList<LanguageInfo>();
String expression = (String) getValue();
boolean find = false;
Matcher match = Pattern.compile(REGEXP_METACHARACTERS).matcher(expression);
while (match.find()) {
find = true;
String countryISOCode = match.group(1).trim().toLowerCase();
String desc = match.group(2).trim();
String country = Util.iso2lang.get(countryISOCode);
if (country != null)
results.add(new LanguageInfo(country, countryISOCode, desc));
}
if (// $NON-NLS-1$
!find && !expression.equals(""))
// $NON-NLS-1$//$NON-NLS-2$
results.add(new LanguageInfo("English", "en", expression));
return results.toArray(new LanguageInfo[0]);
}
Aggregations