Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 38e9354b7e19d0a61cc80334dc702cbd555542c2 (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
/****************************************************************************
 * Copyright (c) 2008 Atos Origin.
 *  
 * 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:
 *		Thibault Landre (Atos Origin) - Initial API and implementation
 *
 *****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.preferences.initializer;

import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
import org.eclipse.gmf.runtime.notation.FillStyle;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.swt.graphics.RGB;

/**
 * Initialize a node view with the properties contained in a preference store
 * <p>
 * The following properties can be initialized :
 * <ul>
 * <li>{@link org.eclipse.gmf.runtime.notation.FillStyle#getFillColor() <em> FillColor</em>}</li>
 * </ul>
 * </p>
 * 
 * @author tlandre
 */
// @unused
public class NodeViewInitializer extends AbstractViewInitializer {

	/**
	 * Default Constructor
	 * 
	 * @param view
	 *        the node view to initialize
	 * @param store
	 *        the preference store to use
	 */
	// @unused
	public NodeViewInitializer(View view, IPreferenceStore store) {
		super(view, store);
	}

	/**
	 * Initialize the fill color.
	 * 
	 * @param preferenceFillColorName
	 *        the name of the preference where is stored the value of the color.
	 */
	// @unused
	public void initFillColor(String preferenceFillColorName) {
		FillStyle fillStyle = (FillStyle)getView().getStyle(NotationPackage.Literals.FILL_STYLE);
		if(fillStyle != null) {
			// fill color
			RGB fillRGB = PreferenceConverter.getColor(getStore(), preferenceFillColorName);
			fillStyle.setFillColor(FigureUtilities.RGBToInteger(fillRGB).intValue());
		}
	}
}

Back to the top