Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 529547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:06:12+00:00 2026-05-13T09:06:12+00:00

Is there an example out there for using IDecorationContext for label decorations? By the

  • 0

Is there an example out there for using IDecorationContext for label decorations?

By the looks of it, IDecorationContext class seems to provide some sort of contextual decoration support, but for the life of me, I can not find any sample code using this feature…

Has anybody actually used decoration context feature and if so, what use cases did it solve?


PS: I am looking for a way to apply image decorations to object labels and depending on where the object is displayed, the base icon size varies (e.g. traditional “small” icons in table- and tree items and larger icons for content headers).

The decorations applied to the original icons should choose appropriate size decorations accordingly.

IDecorationContext seems to fit the bill for what I need it for, but the documentation is as sparse as one can expect from a minor feature of an open source library and there are no examples to be found.

Googling for the “IDecorationContext” did not reveal anything interesting either, so I turn to StackOverflow crowd wisdom in hopes next guy getting the question would be able to get their answer faster 😉

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:06:12+00:00Added an answer on May 13, 2026 at 9:06 am

    I did not use IDecorationContext, but you can see it used in org.eclipse.jface.viewers.LabelDecorator.

    It is also discussed in this thread (even if there are no answer, that can at least give you a starting point)

    My current approach is to extend org.eclipse.ui.decorators using a
    ILightweightLabelDecorator to add a replace overlay to the respective
    icons:

    public class ProjectLabelDecorator extends LabelProvider 
       implements ILightweightLabelDecorator {
    
       ...
    
       public void decorate(Object element, IDecoration decoration) {
          if (element instanceof IFolder) {
             IFolder folder = (IFolder) element;
         try {
                if (folder.getProject().hasNature("rttdt.nature")) {
                    if (ProjectNature.isTestcase(folder)) {
                       IDecorationContext context = 
                          decoration.getDecorationContext();
                       if (context instanceof DecorationContext) {
                          ((DecorationContext) context).putProperty(
                             IDecoration.ENABLE_REPLACE, Boolean.TRUE);
                       }
                       decoration.addOverlay(fTestcaseOverlay,
                          IDecoration.REPLACE);
                    }
             } catch (CoreException e) {
             }
          }
       }
    
       ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any code example teaching how to zoom in and out in a
is there an out-of-box way to spell out an int in C#? For example
is there any example on using java method to call rhino-javascript function and return
I want to use a graph database using php. Can you point out some
Anybody aware of a best practices or example project out there that uses ASP.NET
Given a class, org.eclipse.ui.views.navigator.ResourceNavigator for example, how do I find out which jar file
Consider this example C# code (irrelevant pieces left out): using System.Diagnostics.Process; var process =
I'm using with-out-str to capture some data that is printed to stdout. Problem is
Can we represent Conway's game of life using graphs? And is there any example
I know this seems like I should have immediately found the one example out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.