]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/widgets/DefaultColorProvider.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.browsing.ui.swt / src / org / simantics / browsing / ui / swt / widgets / DefaultColorProvider.java
1 /*******************************************************************************
2  * Copyright (c) 2012 Association for Decentralized Information Management in
3  * Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.browsing.ui.swt.widgets;
13
14 import org.eclipse.jface.resource.ColorDescriptor;
15 import org.eclipse.jface.resource.ResourceManager;
16 import org.eclipse.swt.graphics.Color;
17 import org.eclipse.swt.graphics.RGB;
18 import org.simantics.browsing.ui.swt.widgets.impl.ITrackedColorProvider;
19
20 public class DefaultColorProvider implements ITrackedColorProvider {
21         
22         private final ResourceManager resourceManager;
23         
24     private final ColorDescriptor highlightColor = ColorDescriptor.createFrom(new RGB(254, 255, 197));
25     private final ColorDescriptor inactiveColor = ColorDescriptor.createFrom(new RGB(245, 246, 190));
26     private final ColorDescriptor invalidInputColor = ColorDescriptor.createFrom(new RGB(255, 128, 128));
27
28     public DefaultColorProvider(ResourceManager resourceManager) {
29         this.resourceManager = resourceManager;
30     }
31     
32     @Override
33     public Color getEditingBackground() {
34         return null;
35     }
36
37     @Override
38     public Color getHoverBackground() {
39         return resourceManager.createColor(highlightColor);
40     }
41
42     @Override
43     public Color getInactiveBackground() {
44         return resourceManager.createColor(inactiveColor);
45     }
46
47     @Override
48     public Color getInvalidBackground() {
49         return resourceManager.createColor(invalidInputColor);
50     }
51
52 }
53
54