コード例 #1
0
 private void updateIcons() {
   if (widget instanceof MenuItem) {
     MenuItem item = (MenuItem) widget;
     LocalResourceManager m = new LocalResourceManager(JFaceResources.getResources());
     item.setImage(icon == null ? null : m.createImage(icon));
     disposeOldImages();
     localResourceManager = m;
   } else if (widget instanceof ToolItem) {
     ToolItem item = (ToolItem) widget;
     LocalResourceManager m = new LocalResourceManager(JFaceResources.getResources());
     // TODO: [bm] dis/hot images of item
     //			item.setDisabledImage(disabledIcon == null ? null : m
     //					.createImage(disabledIcon));
     //			item.setHotImage(hoverIcon == null ? null : m
     //					.createImage(hoverIcon));
     item.setImage(icon == null ? null : m.createImage(icon));
     disposeOldImages();
     localResourceManager = m;
   }
 }
コード例 #2
0
 private void disposeOldImages() {
   if (localResourceManager != null) {
     localResourceManager.dispose();
     localResourceManager = null;
   }
 }