@Override public final Object createResource(Device device) throws DeviceResourceException { return createColor(device); }
@Override public final void destroyResource(Object previouslyCreatedObject) { destroyColor((Color)previouslyCreatedObject); } }
private Color getColor( RGB rgb ) { return resourceManager.createColor( ColorDescriptor.createFrom( rgb ) ); }
/** * Returns the color descriptor associated with the given symbolic color * name. If this name does not exist within the registry the supplied * default value will be used. * * @param symbolicName * @param defaultValue * @return the color descriptor associated with the given symbolic color * name or the default * @since 1.1 */ public ColorDescriptor getColorDescriptor(String symbolicName, ColorDescriptor defaultValue) { RGB rgb = getRGB(symbolicName); if (rgb == null) return defaultValue; return ColorDescriptor.createFrom(rgb); }
/** * Returns the color descriptor associated with the given symbolic color * name. If this name does not exist within the registry the supplied * default value will be used. * * @param symbolicName * @param defaultValue * @return the color descriptor associated with the given symbolic color * name or the default * @since 3.4 */ public ColorDescriptor getColorDescriptor(String symbolicName, ColorDescriptor defaultValue) { RGB rgb = getRGB(symbolicName); if (rgb == null) return defaultValue; return ColorDescriptor.createFrom(rgb); }
@Override public final void destroyResource(Object previouslyCreatedObject) { destroyColor((Color)previouslyCreatedObject); } }
@Override public final Object createResource(Device device) throws DeviceResourceException { return createColor(device); }
/** * Returns the color descriptor associated with the given symbolic color * name. If this name does not exist within the registry the supplied * default value will be used. * * @param symbolicName * @param defaultValue * @return the color descriptor associated with the given symbolic color * name or the default * @since 3.4 */ public ColorDescriptor getColorDescriptor(String symbolicName, ColorDescriptor defaultValue) { RGB rgb = getRGB(symbolicName); if (rgb == null) return defaultValue; return ColorDescriptor.createFrom(rgb); }
public final void destroyResource(Object previouslyCreatedObject) { destroyColor((Color)previouslyCreatedObject); } }
public final Object createResource(Device device) throws DeviceResourceException { return createColor(device); }
private ColorDescriptor createEditorColorDescriptor(String key) { return ColorDescriptor.createFrom(PreferenceConverter.getColor( EditorsUI.getPreferenceStore(), key)); }
@Override public void setBackground ( final RGB color ) { if ( color != null ) { this.gc.setBackground ( (Color)this.resourceManager.get ( ColorDescriptor.createFrom ( color ) ) ); } else { this.gc.setBackground ( this.gc.getDevice ().getSystemColor ( SWT.COLOR_WIDGET_BACKGROUND ) ); } }
@Override public void setForeground ( final RGB color ) { if ( color != null ) { this.gc.setForeground ( (Color)this.resourceManager.get ( ColorDescriptor.createFrom ( color ) ) ); } else { this.gc.setForeground ( this.gc.getDevice ().getSystemColor ( SWT.COLOR_WIDGET_FOREGROUND ) ); } }
@Override public void setBackground ( final RGB color ) { if ( color != null ) { this.gc.setBackground ( (Color)this.resourceManager.get ( ColorDescriptor.createFrom ( color ) ) ); } else { this.gc.setBackground ( this.gc.getDevice ().getSystemColor ( SWT.COLOR_WIDGET_BACKGROUND ) ); } }
@Override public void setForeground ( final RGB color ) { if ( color != null ) { this.gc.setForeground ( (Color)this.resourceManager.get ( ColorDescriptor.createFrom ( color ) ) ); } else { this.gc.setForeground ( this.gc.getDevice ().getSystemColor ( SWT.COLOR_WIDGET_FOREGROUND ) ); } }
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; } return (Color) getResourceManager().get( ColorDescriptor.createFrom(descriptor)); } }