Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 18d2af23ef4e5c852f11711f7a46dba882abfb62 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*******************************************************************************
 * Copyright (c) 2009, 2010 Mia-Software.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Nicolas Bros (Mia-Software) - initial API and implementation
 *
 *******************************************************************************/

package org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.custom.presentation;

import org.eclipse.jface.resource.JFaceColors;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Display;

public final class ColorProvider {

	private static ColorProvider instance;

	public static ColorProvider getInstance() {
		if (ColorProvider.instance == null) {
			ColorProvider.instance = new ColorProvider();
		}
		return ColorProvider.instance;
	}

	/** The color used for elements that are empty or not used */
	private final Color gray;
	/** The color used for elements that are not part of the first resource */
	private final Color externalResourceColor;
	/** The color used for elements that are not in any resource */
	private final Color nullResourceColor;

	private ColorProvider() {
		final Display display = Display.getCurrent();

		final RGB rgbGray = new RGB(128, 128, 128);
		this.gray = new Color(display, rgbGray);

		final RGB rgbBlue = new RGB(0, 0, 255);
		this.externalResourceColor = new Color(display, rgbBlue);

		final RGB rgbDarkRed = new RGB(192, 0, 0);
		this.nullResourceColor = new Color(display, rgbDarkRed);
	}

	public Color getGray() {
		return this.gray;
	}

	public Color getExternalResourceColor() {
		return this.externalResourceColor;
	}

	public Color getNullResourceColor() {
		return this.nullResourceColor;
	}

	public Color getUnresolvedProxyColor() {
		return JFaceColors.getErrorText(Display.getCurrent());
	}
}

Back to the top