Merge branch 'HistogramView'
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / uml2sd / drawings / impl / ColorImpl.java
1 /**********************************************************************
2 * Copyright (c) 2005, 2008, 2011 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 * $Id: ColorImpl.java,v 1.3 2008/01/24 02:28:50 apnan Exp $
8 *
9 * Contributors:
10 * IBM - Initial API and implementation
11 * Bernd Hufmann - Updated for TMF
12 **********************************************************************/
13 package org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.impl;
14
15 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IColor;
16 import org.eclipse.swt.graphics.Color;
17 import org.eclipse.swt.widgets.Display;
18
19 /**
20 * @author sveyrier
21 *
22 */
23 public class ColorImpl implements IColor {
24
25 protected Color col = null;
26 protected boolean manageColor = true;
27
28 public ColorImpl(Display display, int r, int g, int b) {
29 col = new Color(display, r, g, b);
30 }
31
32 protected ColorImpl(Color color) {
33 col = color;
34 manageColor = false;
35 }
36
37 public static ColorImpl getSystemColor(int color) {
38 return new ColorImpl(Display.getDefault().getSystemColor(color));
39 }
40
41 @Override
42 public Object getColor() {
43 return col;
44 }
45
46 @Override
47 public void dispose() {
48 if ((col != null) && (manageColor))
49 col.dispose();
50 }
51
52 }
This page took 0.031746 seconds and 6 git commands to generate.