private Color getColor(Object element, boolean forground) { IWorkbenchAdapter2 adapter = getAdapter2(element); if (adapter == null) { return null; } RGB descriptor = forground ? adapter.getForeground(element) : adapter.getBackground(element); if (descriptor == null) { return null; } try { return resourceManager.createColor(ColorDescriptor.createFrom(descriptor)); } catch (Exception e) { Log.log(e); return null; } }
/* (non-Javadoc) * @see org.eclipse.jface.viewers.IFontProvider#getFont(java.lang.Object) */ public Font getFont(Object element) { IWorkbenchAdapter2 adapter = getAdapter2(element); if (adapter == null) { return null; } FontData descriptor = adapter.getFont(element); if (descriptor == null) { return null; } try { return resourceManager.createFont(FontDescriptor.createFrom(descriptor)); } catch (Exception e) { Log.log(e); return null; } }