Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 74e38e3028630ec142c5500d2ac6da20aa0f2244 (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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*****************************************************************************
 * Copyright (c) 2013 CEA LIST.
 *
 *    
 * 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:
 * CEA LIST- Initial API and implementation
 * Nizar GUEDIDI (CEA LIST)- modification
 *
 ****************************************************************************/
package org.eclipse.papyrus.sysml.diagram.requirement.preferences;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.TreeMap;

import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.OrderedCompartmentGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.OrderedLabelGroup;
import org.eclipse.papyrus.sysml.diagram.requirement.Activator;
import org.eclipse.swt.widgets.Composite;

public class RequirementDiagramNodePreferencePage extends AbstractPapyrusNodePreferencePage {

	/** The list owning the names of compartments */
	protected List<String> compartmentNamesList;

	/** The list owning the names of compartment that have a title */
	protected List<String> compartmentTitlesList;

	/** The list of label names for this node */
	protected List<String> labelsList;

	/** Constructor */
	public RequirementDiagramNodePreferencePage() {
		this.labelsList = new ArrayList<String>();
		this.compartmentNamesList = new ArrayList<String>();
		this.compartmentTitlesList = new ArrayList<String>();

		initializeLabelsList();
		initializeCompartmentNamesList();
		initializeCompartmentTitlesList();

		Collections.unmodifiableList(labelsList);
		Collections.unmodifiableList(compartmentNamesList);
		Collections.unmodifiableList(compartmentTitlesList);
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	protected void createPageContents(Composite parent) {
		super.createPageContents(parent);

		// Add compartments visibility group
		if(!compartmentNamesList.isEmpty()) {
			OrderedCompartmentGroup compartmentGroup = new OrderedCompartmentGroup(parent, getPreferenceKey(), this, compartmentNamesList, compartmentTitlesList, getPreferenceStore());
			addAbstractGroup(compartmentGroup);
		}

		// Add label visibility group
		if(!labelsList.isEmpty()) {
			OrderedLabelGroup compartmentGroup = new OrderedLabelGroup(parent, getPreferenceKey(), this, labelsList);
			addAbstractGroup(compartmentGroup);
		}
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	protected String getBundleId() {
		return Activator.PLUGIN_ID;
	}

	/** Initialize the list containing names of labels. */
	protected void initializeLabelsList() {
		//  Implemented by subclasses.
	}

	/** Initialize the list containing the names of compartments. */
	protected void initializeCompartmentNamesList() {
		//  Implemented by subclasses.
	}

	/** Initialize the list containing the names of compartment that have titles. */
	protected void initializeCompartmentTitlesList() {
		//  Implemented by subclasses.
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	protected final TreeMap<String, String> getLabelRole() {
		return new TreeMap<String, String>();
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	protected final TreeMap<String, Boolean> getCompartmentTitleVisibilityPreferences() {
		return new TreeMap<String, Boolean>();
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	protected final void initializeCompartmentsList() {
		compartmentsList = Collections.emptyList();
	}
}

Back to the top