Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: d85e98ea3070ea0fa932fa1b9e1db0c14e220b47 (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) 2011 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:
 *   Atos Origin - Initial API and implementation
 *
 *****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.groups.preferences;

import org.eclipse.jface.dialogs.DialogPage;
import org.eclipse.jface.preference.ScaleFieldEditor;
import org.eclipse.papyrus.preferences.ui.AbstractGroup;
import org.eclipse.papyrus.uml.diagram.common.ui.helper.HelpComponentFactory;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.ui.forms.widgets.FormToolkit;

/**
 * Group use to set the opacity of a compartment of a group
 * 
 * @author adaussy
 * 
 */
public class OpacityGroup extends AbstractGroup {

	/**
	 * Name of the preferance to set
	 */
	protected String preferenceName;

	public OpacityGroup(Composite parent, String key, DialogPage dialogPage, String preferenceName) {
		super(parent, key, dialogPage);
		this.preferenceName = preferenceName;
		createContent(parent);
	}

	/**
	 * Creates the content.
	 * 
	 * @param parent
	 *        the parent
	 */
	public void createContent(Composite parent) {
		Group visibilityGroup = new Group(parent, SWT.SCROLL_PAGE);
		/*
		 * TODO Refactor layout (help component at the end of the line)
		 */
		visibilityGroup.setLayout(new GridLayout());
		visibilityGroup.setText("Opacity of the compartment");

		ScaleFieldEditor alphaEditor = new ScaleFieldEditor(preferenceName, "Opacity", visibilityGroup, 0, 255, 5, 20);
		alphaEditor.setPage(dialogPage);
		addFieldEditor(alphaEditor);
		HelpComponentFactory.createHelpComponent(visibilityGroup, new FormToolkit(parent.getDisplay()), "Set to min to make the compartment totally transparent");
	}


}

Back to the top