[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform] Re: How to get default font in Table

Ed,

Would you mind filing a bug against platform/ui and CC me to see whether we have ideas to provide something in 3.4?

Ed Merks schrieb:
Tom,

It's easy, though not self evident. I suppose it's documented somewhere in that documentation I never read. :-)

It also seems a little dangerous to use a global registry for a particular column viewer. You'd certainly need to be careful to create

Certainly right. I most of the time work only with the standard fonts and set them up when my plugin-starts using the global-registry but the key is prefixed with my own plugin-id :-)


a key that's unique to this particular column viewer wouldn't you? (Especially for code that might be reused a lot and have different fonts in different places.) And then I'm not certain if this registry gets cleaned up when my viewer is deleted, so it might accumulate viewer-specific garbage.


No. A registry is cleared only when the display is closed. You can clear viewer resources in IBaseLabelProvider#dispose() which is called when a Viewer is disposed or in 3.3 the ViewerColumn it is attached to.


I'll bet there isn't a single IFontLabelProvider implementation that doesn't need to keep track of the default font for what it's viewing, so I would have hoped for something more "built-in". One problem I see in this regard is that while an IContentProvider has an inputChanged so it knows the viewer that's using it, the ILabelProvider has no such mechanism (that I know of).

Well the new JFace-API for Viewers knows exactly for which Viewer it's working because it gets passes a ViewerCell which holds all informations about the control its working for see CellLabelProvider#update(ViewerCell)


Tom