private String getBundleString(String key, ResourceBundle bundle) { if (bundle != null) { try { return bundle.getString(key); } catch (MissingResourceException e) { return '!' + key + '!'; } } return TextTemplateMessages.getString(key); // default messages } }
private boolean getBooleanValue(NamedNodeMap attributes, String attribute, boolean defaultValue) throws SAXException { Node enabledNode= attributes.getNamedItem(attribute); if (enabledNode == null) return defaultValue; else if (enabledNode.getNodeValue().equals(Boolean.toString(true))) return true; else if (enabledNode.getNodeValue().equals(Boolean.toString(false))) return false; else throw new SAXException(TextTemplateMessages.getString("TemplateReaderWriter.error.illegal_boolean_attribute")); //$NON-NLS-1$ }
private String getStringValue(NamedNodeMap attributes, String name) throws SAXException { String val= getStringValue(attributes, name, null); if (val == null) throw new SAXException(TextTemplateMessages.getString("TemplateReaderWriter.error.missing_attribute")); //$NON-NLS-1$ return val; }
public static String getFormattedString(String key, Object[] args) { return MessageFormat.format(getString(key), args); } }
public static String getFormattedString(String key, Object arg) { return MessageFormat.format(getString(key), new Object[] { arg }); }
String PLUGIN_ID= "org.eclipse.jface.text"; //$NON-NLS-1$ ILog log= Platform.getLog(Platform.getBundle(PLUGIN_ID)); String message= NLS.bind(TextTemplateMessages.getString("TemplateReaderWriter.duplicate.id"), id); //$NON-NLS-1$ log.log(new Status(IStatus.WARNING, PLUGIN_ID, IStatus.OK, message, null)); } else { throw new IOException(TextTemplateMessages.getString("TemplateReaderWriter.error.missing_attribute")); //$NON-NLS-1$