org.eclipse.jface.resource.ColorDescriptor Java Examples
The following examples show how to use
org.eclipse.jface.resource.ColorDescriptor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LineInput.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@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; }
Example #2
Source File: CopiedWorkbenchLabelProvider.java From Pydev with Eclipse Public License 1.0 | 6 votes |
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; } }
Example #3
Source File: SWTGraphics.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@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 ) ); } }
Example #4
Source File: SWTGraphics.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@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 ) ); } }
Example #5
Source File: ColorUpdater.java From neoscada with Eclipse Public License 1.0 | 5 votes |
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 (); }
Example #6
Source File: WorkbenchLabelProvider.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
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)); }
Example #7
Source File: WorkbenchLabelProvider.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
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)); }
Example #8
Source File: Draw2DGraphics.java From neoscada with Eclipse Public License 1.0 | 4 votes |
@Override public void setForeground ( final RGB color ) { this.g.setForegroundColor ( (Color)this.resourceManager.get ( ColorDescriptor.createFrom ( color ) ) ); }
Example #9
Source File: Draw2DGraphics.java From neoscada with Eclipse Public License 1.0 | 4 votes |
@Override public void setBackground ( final RGB color ) { this.g.setBackgroundColor ( (Color)this.resourceManager.get ( ColorDescriptor.createFrom ( color ) ) ); }
Example #10
Source File: JUnitTestRunListener.java From eclipse-extras with Eclipse Public License 1.0 | 4 votes |
private Color getColor( RGB rgb ) { return resourceManager.createColor( ColorDescriptor.createFrom( rgb ) ); }