Community
Participate
Working Groups
The constructor of ElementTreeSelectionDialog only accespt ILabelProvider instances. This prevents clients from using an IStyledLabelProvider. I suggest to change the constructor to accept IBaseLabelProvider. This would also enable styled label providers.
But doesn't the dialog itself need to understand the label provider protocol to make use of it? And this dialog needs a getText/getImage which aren't in the base label provider. PW
(In reply to Paul Webster from comment #1) > But doesn't the dialog itself need to understand the label provider protocol > to make use of it? > > And this dialog needs a getText/getImage which aren't in the base label > provider. > > PW I can't find where the dialog itself uses the label provide. The 'fLabelProvider' field that gets assigned the label provider in the constructor is only used in createTreeViewer(). Moreover, I currently have a hack in place to enable styled labels and can't find any bad side effects: I pass a dummy label provider (getText() would always return "") to the constructor and set the styled label provider in an overridden createTreeiewer() after the super implementation created the viewer. If the label provider was used elsewhere in the dialog that would have become apparent.
Can you provide a sample plugin where you pass in a IStyledLabelProvider and it does something to the list? PW
(In reply to Paul Webster from comment #3) > Can you provide a sample plugin where you pass in a IStyledLabelProvider and > it does something to the list? > > PW I'm afraid, I don't understand you. The constructor wouldn't accept an IStyledLabelProvider. What exactly do you want me to do? BTW, this is about the *ElementTreeSelectionDialog*, there is no 'list', it is a tree.
I'm asking for an example where you change the method signature and then an example that shows it being used. PW
Created attachment 238364 [details] Example for an ElementTreeSelectionDialog that uses a styled label provider (In reply to Paul Webster from comment #5) > I'm asking for an example where you change the method signature and then an > example that shows it being used. The attached zip contais a plug-in with a SampleHandler and a command that contributes to the main menu. The SampleHandler opens an ElementTreeSelectionDialog that shows the local file system where each file is decorated with its size.
Rüdiger, thanks for the sample that clarifies things. This looks risky. Just changing the constructor is binary incompatible, which is a no go. Adding a second constructor appears to work, but I'm concerned about source incompatibilities (possible complaints about ambiguous calls)? https://git.eclipse.org/r/19992 Rüdiger, does the change set do what you expect? PW
(In reply to Paul Webster from comment #7) > Rüdiger, thanks for the sample that clarifies things. > > This looks risky. Just changing the constructor is binary incompatible, > which is a no go. Adding a second constructor appears to work, but I'm > concerned about source incompatibilities (possible complaints about > ambiguous calls)? > > https://git.eclipse.org/r/19992 > > Rüdiger, does the change set do what you expect? > > PW Yes, the change set would serve my needs. I played around a bit trying to provoke the compiler to complain about ambiguous calls. From what I understand this isn't an issue here.
Released as http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=2c6ce9332d46d4c6c527ad12b6d15de4c335c09c PW
In 4.4.0.I20140120-2000 PW