Merge in Tycho-ification work
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / colors / ColorSetting.java
1 /*******************************************************************************
2 * Copyright (c) 2010 Ericsson
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.tmf.ui.views.colors;
14
15 import org.eclipse.linuxtools.tmf.filter.model.ITmfFilterTreeNode;
16 import org.eclipse.swt.SWT;
17 import org.eclipse.swt.graphics.Color;
18 import org.eclipse.swt.graphics.RGB;
19 import org.eclipse.swt.widgets.Display;
20 import org.eclipse.ui.themes.ColorUtil;
21
22 public class ColorSetting {
23
24 private RGB fForegroundRGB;
25 private RGB fBackgroundRGB;
26 private Color fForegroundColor;
27 private Color fBackgroundColor;
28 private Color fDimmedForegroundColor;
29 private Color fDimmedBackgroundColor;
30 private int fTickColorIndex;
31 private ITmfFilterTreeNode fFilter;
32
33 public ColorSetting(RGB foreground, RGB background, int tickColorIndex, ITmfFilterTreeNode filter) {
34 fForegroundRGB = foreground;
35 fBackgroundRGB = background;
36 fTickColorIndex = tickColorIndex;
37 fFilter = filter;
38 Display display = Display.getDefault();
39 fForegroundColor = new Color(display, fForegroundRGB);
40 fBackgroundColor = new Color(display, fBackgroundRGB);
41 fDimmedForegroundColor = new Color(display, ColorUtil.blend(
42 fForegroundRGB, fBackgroundRGB));
43 fDimmedBackgroundColor = new Color(display, ColorUtil.blend(
44 fBackgroundRGB, display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB()));
45 }
46
47 /**
48 * @return the foreground
49 */
50 public RGB getForegroundRGB() {
51 return fForegroundRGB;
52 }
53
54 /**
55 * @param foreground the foreground to set
56 */
57 public void setForegroundRGB(RGB foreground) {
58 fForegroundRGB = foreground;
59 fForegroundColor.dispose();
60 fDimmedForegroundColor.dispose();
61 Display display = Display.getDefault();
62 fForegroundColor = new Color(display, fForegroundRGB);
63 fDimmedForegroundColor = new Color(display, ColorUtil.blend(
64 fForegroundRGB, fBackgroundRGB));
65 }
66
67 /**
68 * @return the background
69 */
70 public RGB getBackgroundRGB() {
71 return fBackgroundRGB;
72 }
73
74 /**
75 * @param background the background to set
76 */
77 public void setBackgroundRGB(RGB background) {
78 fBackgroundRGB = background;
79 fBackgroundColor.dispose();
80 fDimmedBackgroundColor.dispose();
81 Display display = Display.getDefault();
82 fBackgroundColor = new Color(display, fBackgroundRGB);
83 fDimmedBackgroundColor = new Color(display, ColorUtil.blend(
84 fBackgroundRGB, display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB()));
85 }
86
87 /**
88 * @return the tick color index (0-15)
89 * @see org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.widgets.TraceColorScheme
90 */
91 public int getTickColorIndex() {
92 return fTickColorIndex;
93 }
94
95 /**
96 * @param tickColorIndex the tick color index to set (0-15)
97 * @see org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.widgets.TraceColorScheme
98 */
99 public void setTickColorIndex(int tickColorIndex) {
100 fTickColorIndex = tickColorIndex;
101 }
102
103 /**
104 * @return the filter
105 */
106 public ITmfFilterTreeNode getFilter() {
107 return fFilter;
108 }
109
110 /**
111 * @param filter the filter to set
112 */
113 public void setFilter(ITmfFilterTreeNode filter) {
114 fFilter = filter;
115 }
116
117 /**
118 * @return the foreground color
119 */
120 public Color getForegroundColor() {
121 return fForegroundColor;
122 }
123
124 /**
125 * @return the background color
126 */
127 public Color getBackgroundColor() {
128 return fBackgroundColor;
129 }
130
131 /**
132 * @return the dimmed foreground color
133 */
134 public Color getDimmedForegroundColor() {
135 return fDimmedForegroundColor;
136 }
137
138 /**
139 * @return the dimmed background color
140 */
141 public Color getDimmedBackgroundColor() {
142 return fDimmedBackgroundColor;
143 }
144
145 }
This page took 0.055168 seconds and 6 git commands to generate.