Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-ui-dev] OverlayDecoratorIcon, Image parameter and dispose

Hi,
 
the code in question should return a descriptor, not create any images, so what the right class to use?
org.eclipse.jface.viewers.DecorationOverlayIcon requires an image as argument, so it is not suitable in this case. Egit has org.eclipse.egit.ui.internal.DecorationOverlayDescriptor but this is not accessible for Platform UI. There is also org.eclipse.ui.internal.OverlayIcon and org.eclipse.ui.internal.ide.misc.OverlayIcon which seem to implement parts from org.eclipse.egit.ui.internal.DecorationOverlayDescriptor.
 
Should we have a copy of org.eclipse.egit.ui.internal.DecorationOverlayDescriptor in JFace (org.eclipse.jface.viewers.DecorationOverlayDescriptor)?
 
Kind regards,
Andrey Loskutov

http://google.com/+AndreyLoskutov
 
 
Gesendet: Dienstag, 11. Oktober 2016 um 13:58 Uhr
Von: "Mickael Istria" <mistria@xxxxxxxxxx>
An: "Eclipse Platform UI component developers list." <platform-ui-dev@xxxxxxxxxxx>
Betreff: [platform-ui-dev] OverlayDecoratorIcon, Image parameter and dispose

Hi all,

In https://git.eclipse.org/r/82899 , I wrote this piece of code:

  @Override
  protected ImageDescriptor decorateImage(ImageDescriptor input, Object element) {
    ImageDescriptor res = super.decorateImage(input, element);
    // ...
    if (overlay != null) {
      Image baseImage = res.createImage();
      res = new DecorationOverlayIcon(baseImage, overlay, IDecoration.BOTTOM_LEFT);
    }
    return res;
  }


I have multiple questions about that:
* Am I responsible of disposing the "baseImage", as it seems to be used by the DecorationOverlayIcon? Or does the DecorationOverlayIcon take
* If I'm responsible of disposing the image, when should I do it? If I dispose it just after creation of the DecorationOverlayIcon, I get failure later (when the DecorationOverlayIcon tries to create its image); and from this method, I don't see how to get the lifecycle of the image to dispose it at the right time?
* Maybe there's something better to use for that?

Thanks in advance
--
Mickael Istria
Eclipse developer for Red Hat Developers
My blog - My Tweets
_______________________________________________ platform-ui-dev mailing list platform-ui-dev@xxxxxxxxxxx To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/platform-ui-dev

Back to the top