use of com.intellij.lang.properties.psi.I18nizedTextGenerator in project intellij-community by JetBrains.
the class JavaI18nizeQuickFixDialog method getI18nizedText.
public String getI18nizedText() {
String propertyKey = StringUtil.escapeStringCharacters(getKey());
I18nizedTextGenerator textGenerator = myResourceBundleManager.getI18nizedTextGenerator();
if (textGenerator != null) {
return generateText(textGenerator, propertyKey, getPropertiesFile(), myLiteralExpression);
}
String templateName = getTemplateName();
LOG.assertTrue(templateName != null);
FileTemplate template = FileTemplateManager.getInstance(myProject).getCodeTemplate(templateName);
Map<String, String> attributes = new THashMap<>();
attributes.put(PROPERTY_KEY_OPTION_KEY, propertyKey);
attributes.put(RESOURCE_BUNDLE_OPTION_KEY, getResourceBundleText());
attributes.put(PROPERTY_VALUE_ATTR, StringUtil.escapeStringCharacters(myDefaultPropertyValue));
addAdditionalAttributes(attributes);
String text = null;
try {
text = template.getText(attributes);
} catch (IOException e) {
LOG.error(e);
}
return text;
}
Aggregations