Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[Dltk-dev] API extension to org.eclipse.dltk.ui.modelLabelProvider : give renderFlags to image provider

Hello DTLK team. I would like to ask for an API extension to the
org.eclipse.dltk.ui.modelLabelProvider extension point, as used by
ScriptElementImageProvider. Currently this extension only allows a
contributor to give a ILabelProvider, which is used like this in
ScriptElementImageProvider:

       public ImageDescriptor getBaseImageDescriptor(IModelElement
element, int renderFlags) {
...
               ILabelProvider provider = getContributedLabelProvider(element);
               if (provider != null) {
                       Image img = provider.getImage(element);

The problem here is that the contributed label provider does not have
access to renderFlags (for example SMALL_SIZE vs BIG_SIZE), and thus
cannot contribute a different image (or different overlays) according
to these flags. My request is an API change that would allow the label
provider to also receive the renderFlags in a getImage call. This is
fairly annoying limitation that is almost impossible to workaround: In
my IDE implementation (DDT) the label provider actually uses Java
reflection to look into the stack trace to figure which class is
requesting the label (yes, a very ugly hack indeed!), to then figure
out whether a SMALL_SIZE or BIG_SIZE is appropriate...

Cheers!
-- 
Bruno Medeiros


Back to the top