Java 类org.eclipse.jface.resource.ColorDescriptor 实例源码

项目:neoscada    文件:LineInput.java   
@Override
public Image getPreview ( final int width, final int height )
{
    final Point p = new Point ( width, height );
    final Image img = this.previews.get ( p );
    if ( img == null )
    {
        RGB rgb = getLineRenderer ().getLineColor ();
        if ( rgb == null )
        {
            rgb = DEFAULT_COLOR;
        }
        final Color color = (Color)this.resourceManager.get ( ColorDescriptor.createFrom ( rgb ) );
        final Image newImage = makePreview ( Display.getDefault (), getLineRenderer ().getLineAttributes (), color, p );
        this.previews.put ( p, newImage );
        return newImage;
    }
    return img;

}
项目:Pydev    文件:CopiedWorkbenchLabelProvider.java   
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;
    }

}
项目:neoscada    文件:SWTGraphics.java   
@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 ) );
    }
}
项目:neoscada    文件:SWTGraphics.java   
@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 ) );
    }
}
项目:neoscada    文件:ColorUpdater.java   
public ColorUpdater ( final String name, final ResourceManager manager, final ColorDescriptor defaultColor )
{
    this.name = name;
    this.manager = manager;
    this.defaultColor = defaultColor;
    JFaceResources.getColorRegistry ().addListener ( this );
    refresh ();
}
项目:translationstudio8    文件:WorkbenchLabelProvider.java   
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));
}
项目:tmxeditor8    文件:WorkbenchLabelProvider.java   
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));
}
项目:neoscada    文件:Draw2DGraphics.java   
@Override
public void setForeground ( final RGB color )
{
    this.g.setForegroundColor ( (Color)this.resourceManager.get ( ColorDescriptor.createFrom ( color ) ) );
}
项目:neoscada    文件:Draw2DGraphics.java   
@Override
public void setBackground ( final RGB color )
{
    this.g.setBackgroundColor ( (Color)this.resourceManager.get ( ColorDescriptor.createFrom ( color ) ) );
}
项目:eclipse-extras    文件:JUnitTestRunListener.java   
private Color getColor( RGB rgb ) {
  return resourceManager.createColor( ColorDescriptor.createFrom( rgb ) );
}
项目:smaccm    文件:VariablesView.java   
public void dispose() {
    colorManager.destroy(ColorDescriptor.createFrom(cellBackgroundColor));
}