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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
/****************************************************************************
* 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
* Vincent Lorenzo (CEA LIST) - Add a list for the compartment names
* Vincent Lorenzo (CEA-LIst) - bug 335989: [Preferences] [Enhancement] Add a group for labels in each Connection Preference Page
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.preferences.pages;
import java.util.ArrayList;
import java.util.List;
import java.util.TreeMap;
import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.BackgroundColor;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.DecorationGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.LabelGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.NodeColorGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.NodeCompartmentGroup;
import org.eclipse.swt.widgets.Composite;
/**
* An abstract implementation of a basic node preference page.
* <p>
* This Preference page adds the preference for {@link org.eclipse.gmf.runtime.notation.FillStyle#getFillColor() <em>FillColor</em>}
* </p>
*
* @author tlandre
*/
public abstract class AbstractPapyrusNodePreferencePage extends AbstractPapyrusElementPreferencePage {
/** the list owning the compartment names for the Node */
protected List<String> compartmentsList;
/**
*
* Constructor.
*
*/
public AbstractPapyrusNodePreferencePage() {
compartmentsList = new ArrayList<String>();
initializeCompartmentsList();
}
/**
*
* @see org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusElementPreferencePage#createPageContents(org.eclipse.swt.widgets.Composite)
*
* @param parent
*/
@Override
protected void createPageContents(Composite parent) {
super.createPageContents(parent);
NodeColorGroup colorGroupForNodeComposite = new NodeColorGroup(parent, getPreferenceKey(), this);
addPreferenceGroup(colorGroupForNodeComposite);
BackgroundColor backgroundColorGroup = new BackgroundColor(parent, getPreferenceKey(), this);
addPreferenceGroup(backgroundColorGroup);
DecorationGroup decorationGroup = new DecorationGroup(parent, getPreferenceKey(), this);
addPreferenceGroup(decorationGroup);
if (!compartmentsList.isEmpty()) {
NodeCompartmentGroup compartmentGroup = new NodeCompartmentGroup(parent, getPreferenceKey(), this, compartmentsList, getCompartmentTitleVisibilityPreferences().keySet(), Activator.getDefault().getPreferenceStore());
addPreferenceGroup(compartmentGroup);
}
// Label role group
if (!getLabelRole().isEmpty()) {
LabelGroup compartmentGroup = new LabelGroup(parent, getPreferenceKey(), this, getLabelRole());
addPreferenceGroup(compartmentGroup);
}
}
/**
* Initialize {@link #compartmentsList} with the name of the compartment owned by the node
*/
protected void initializeCompartmentsList() {
// TODO Auto-generated method stub
}
/**
*
* @return
* the label roles
*/
protected TreeMap<String, String> getLabelRole() {
return new TreeMap<String, String>();
}
/**
*
* @return
* the compartment title visibility
*/
protected TreeMap<String, Boolean> getCompartmentTitleVisibilityPreferences() {
return new TreeMap<String, Boolean>();
}
}
|