General question when developing a eclipse plugin which is exported as a product and deployable plug-in (jar).
Where is the best place to create resources (Colors etc.) and dispose them? Tried it in the start()
of the Activator
class. Problem is i cant get the Display
object there.
Also tried it in ApplicationWorkbenchWindowAdvisor
where i can Access the Display via PlatformUI.getWorkbench().getDisplay()
. This class gets only called when the plug-in is exported as a product.
For colors and fonts you can use the 'org.eclipse.ui.themes' extension point. Eclipse will then manage these resources for you. This also allows the user to customize the values in 'Preferences > General > Appearance > Colors and Fonts'.
To get a colors and fonts defined using the extension point use:
ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
Color color = theme.getColorRegistry().get("color id");
Font font = theme.getFontRegistry().get("font id");