Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 1b9a38c1e63ed65fed4ffa716916a834c24b0da7 (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
/*******************************************************************************
 * Copyright (c) 2007, 2015 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

package org.eclipse.ui.internal.keys.model;

import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.bindings.BindingManager;
import org.eclipse.jface.bindings.Scheme;

/**
 * @since 3.4
 *
 */
public class SchemeModel extends CommonModel {

	public static final String PROP_SCHEMES = "schemes"; //$NON-NLS-1$
	private List schemes;

	/**
	 * @param kc
	 */
	public SchemeModel(KeyController kc) {
		super(kc);
	}

	/**
	 * @param bindingManager
	 */
	public void init(BindingManager bindingManager) {
		schemes = new ArrayList();
		for (Scheme definedScheme : bindingManager.getDefinedSchemes()) {
			SchemeElement se = new SchemeElement(controller);
			se.init(definedScheme);
			se.setParent(this);
			schemes.add(se);
			if (definedScheme == bindingManager.getActiveScheme()) {
				setSelectedElement(se);
			}
		}
	}

	/**
	 * @return Returns the schemes.
	 */
	public List getSchemes() {
		return schemes;
	}

	/**
	 * @param schemes The schemes to set.
	 */
	public void setSchemes(List schemes) {
		List old = this.schemes;
		this.schemes = schemes;
		controller.firePropertyChange(this, PROP_SCHEMES, old, schemes);
	}

}

Back to the top