blob: ca3ef987f3213b21f2de491f609218fb2d364e28 (
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
|
package org.eclipse.fx.ecp.ui.controls;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecp.edit.ECPControlContext;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.fx.ecp.ui.Control;
@SuppressWarnings("restriction")
public class DummyControl extends HBox implements Control {
public DummyControl(IItemPropertyDescriptor propertyDescriptor, ECPControlContext context) {
EObject modelElement = context.getModelElement();
String displayName = propertyDescriptor.getDisplayName(modelElement);
Label label = new Label(displayName);
label.getStyleClass().add(IControlConstants.CONTROL_LABEL_CLASS);
getChildren().add(label);
EStructuralFeature feature = (EStructuralFeature) propertyDescriptor.getFeature(modelElement);
Object val = modelElement.eGet(feature);
TextField textField = new TextField();
textField.setText(val.toString());
textField.setDisable(true);
HBox.setHgrow(textField, Priority.ALWAYS);
getChildren().add(textField);
}
@Override
public void handleValidation(Diagnostic diagnostic) {
// TODO Auto-generated method stub
}
@Override
public void resetValidation() {
// TODO Auto-generated method stub
}
public static class Factory implements Control.Factory {
@Override
public Control createControl(IItemPropertyDescriptor itemPropertyDescriptor, ECPControlContext context) {
return new DummyControl(itemPropertyDescriptor, context);
}
}
}
|