/**
* Opens an input stream to a file contained in a plugin. This includes NL lookup.
*/
public static InputStream openFromProducer(Bundle pluginDesc, String file, String locale) {
IHelpContentProducer producer = getContentProducer(pluginDesc.getSymbolicName());
if (producer == null) {
return null;
}
if (locale == null || locale.length() <= 0) {
locale = Platform.getNL();
}
Locale l;
if (locale.length() >= 5) {
l = new Locale(locale.substring(0, 2), locale.substring(3, 5));
} else if (locale.length() >= 2) {
l = new Locale(locale.substring(0, 2), ""); //$NON-NLS-1$
} else {
l = Locale.getDefault();
}
return producer.getInputStream(pluginDesc.getSymbolicName(), file, l);
}