0

I have a use case that i have to make one project name bold out of 2 project name in the project explorer like below.

Project1

Project2

Please let me know for any idea.

Thanks in Advance.

Sunil
  • 33
  • 5

2 Answers2

1

Use the decorator extension point

<extension
       point="org.eclipse.ui.decorators">
    <decorator
        lightweight="true"
        label="Label Decorator"
        class="yourPackage.BoldDecorator"
        state="true"
        id="your.decorator.id">
     <description>
        Some description
     </description>
  </decorator>
</extension>

and implement a ILightweightLabelDecorator

public class BoldDecorator implements ILightweightLabelDecorator {

    @Override
    public void decorate(Object element, IDecoration decoration) {
        Font boldFont = JFaceResources.getFontRegistry()
                              .getBold(JFaceResources.DEFAULT_FONT);
        decoration.setFont(boldFont);
    }

    @Override
    public void addListener(ILabelProviderListener listener) {
    }

    @Override
    public void dispose() {
    }

    @Override
    public boolean isLabelProperty(Object element, String property) {
        return false;
    }

    @Override
    public void removeListener(ILabelProviderListener listener) {
    }
}

The result will be

BoldDecorator

René Link
  • 48,224
  • 13
  • 108
  • 140
-1

Is it possible to make project name bold in the project explorer?

Yes, but this is not standard behaviour; you must write a plug-in which does that.

Pétur Ingi Egilsson
  • 4,368
  • 5
  • 44
  • 72