IDEMPIERE-2288 Load custom ToolbarButton Images (IAction) from OSGi Bundle

This commit is contained in:
jan thielemann 2014-11-19 13:51:54 -05:00
parent 6be4c15be0
commit 1ed3200c50
1 changed files with 14 additions and 12 deletions

View File

@ -56,19 +56,21 @@ public class Actions {
} }
if (aImage != null) if (aImage != null)
return aImage; return aImage;
String path = ACTION_IMAGES_PATH + actionId + "24.png"; IServiceHolder<IAction> action = Service.locator().locate(IAction.class, actionId, null);
InputStream inputStream = Actions.class.getClassLoader().getResourceAsStream(path); if (action.getService() != null) {
if (inputStream != null) { String path = ACTION_IMAGES_PATH + actionId + "24.png";
try { InputStream inputStream = action.getService().getClass().getClassLoader().getResourceAsStream(path);
aImage = new AImage(actionId, inputStream); if (inputStream != null) {
} catch (IOException e) { try {
} aImage = new AImage(actionId, inputStream);
} } catch (IOException e) {
if (aImage != null) { }
synchronized (imageCache) {
imageCache.put(actionId, aImage);
} }
if (aImage != null)
synchronized (imageCache) {
imageCache.put(actionId, aImage);
}
} }
return aImage; return aImage;
} }