[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-ui-dev] NavigatorContent override and getStyledText

Hi, this is my first post to this list so please forgive me if there is a better way of asking these questions. This question relates to the Navigator UI.

 

I am looking into how to create a pipelined content provider that overrides org.eclipse.ui.navigator.resourceContent. When working with it I realize that if more than one content provider exists for a parent, only the label provider for the content provider with the highest priority gets called for getStyledText, because NavigatorContentServiceLabelProvider.findStyledText contains the following: (NavigatorContentServiceLabelProvider.java:184)

 

 

if (text != null) {

   return new StyledString(text);

}

 

that will be called for the default label provider. At the same time, the iterator loop in getStyledText will continue until the text is not null (which means the loop will terminate early with the empty string before my label provider got the chance to answer. The WorkbenchLabelProvider will answer here and return null, but since it does not implement IStyledLabelProvider it will be wrapped in an empty StyledString by the code above. I am not sure how this is supposed to work. I can set my priority higher in the plugin.xml, but then I will break another content provider’s labels.

 

Is there a better way of doing this? I can see the possibility to implement an IWorkbenchAdapter for the item and get WorkbenchLabelProvider to provide something non-null, but that seems a bit awkward.

 

Cheers

// Rickard