blob: 4380b9e4bce2d58d661363cf13efd69da41302a9 (
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) 2011, 2016 CEA LIST, Esterel Technologies SAS and others.
*
* 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:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Sebastien Gabel (Esterel Technologies SAS) - Bug 497768
*
*****************************************************************************/
package org.eclipse.papyrus.infra.properties.ui.widgets;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
import org.eclipse.swt.widgets.Composite;
/**
* A Property Editor for editing a String with an editable combo.
* The combo proposes a set of default values.
*
* @author Camille Letavernier
*/
public class StringCombo extends AbstractPropertyEditor {
/**
* The StringCombo widget used by this property editor
*/
protected org.eclipse.papyrus.infra.widgets.editors.StringCombo editor;
/**
*
* Constructor.
*
* @param parent
* @param style
*/
public StringCombo(Composite parent, int style) {
editor = createStringCombo(parent, style);
setEditor(editor);
}
/**
* Creates the string combo dialog.
*
* @param parent
* The composite in which the widget will be displayed
* @param style
* The style for the widget
* @return the string combo dialog.
*/
protected org.eclipse.papyrus.infra.widgets.editors.StringCombo createStringCombo(Composite parent, int style) {
return new org.eclipse.papyrus.infra.widgets.editors.StringCombo(parent, style);
}
@Override
public void doBinding() {
IStaticContentProvider contentProvider = input.getContentProvider(propertyPath);
editor.setContentProvider(contentProvider);
editor.setUnsettable(!input.isMandatory(propertyPath));
ILabelProvider labelProvider = input.getLabelProvider(propertyPath);
if (labelProvider != null) {
editor.setLabelProvider(labelProvider);
}
super.doBinding();
}
}
|