Skip to content

Package: BooleanControl

BooleanControl

nameinstructionbranchcomplexitylinemethod
BooleanControl()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
bindValue()
M: 12 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
dispose()
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
fillControlComposite(Composite)
M: 13 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
getControlsForTooltip()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getUnsetButtonTooltip()
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
getUnsetLabelText()
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setEditable(boolean)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
updateValidationColor(Color)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2013 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Eugen Neufeld - initial API and implementation
13: *
14: *******************************************************************************/
15: package org.eclipse.emf.ecp.edit.internal.swt.controls;
16:
17: import org.eclipse.core.databinding.Binding;
18: import org.eclipse.core.databinding.observable.value.IObservableValue;
19: import org.eclipse.emfforms.spi.localization.LocalizationServiceHelper;
20: import org.eclipse.jface.databinding.swt.typed.WidgetProperties;
21: import org.eclipse.swt.SWT;
22: import org.eclipse.swt.graphics.Color;
23: import org.eclipse.swt.widgets.Button;
24: import org.eclipse.swt.widgets.Composite;
25: import org.eclipse.swt.widgets.Control;
26:
27: /**
28: * This class defines a BooleanControl which is used for displaying {@link org.eclipse.emf.ecore.EStructuralFeature
29: * EStructuralFeature}s which have a Boolean
30: * value.
31: *
32: * @author Eugen Neufeld
33: *
34: */
35: @Deprecated
36: public class BooleanControl extends SingleControl {
37:
38:         private Button check;
39:
40:         @Override
41:         protected void fillControlComposite(Composite composite) {
42:                 check = new Button(composite, SWT.CHECK);
43:                 check.setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_control_boolean"); //$NON-NLS-1$
44:         }
45:
46:         /**
47:          * {@inheritDoc}
48:          */
49:         @Override
50:         public void setEditable(boolean isEditable) {
51:                 check.setEnabled(isEditable);
52:         }
53:
54:         @Override
55:         public void dispose() {
56:                 check.dispose();
57:                 super.dispose();
58:         }
59:
60:         @Override
61:         public Binding bindValue() {
62:                 final IObservableValue targetValue = WidgetProperties.buttonSelection().observe(check);
63:                 return getDataBindingContext().bindValue(targetValue, getModelValue());
64:         }
65:
66:         /*
67:          * (non-Javadoc)
68:          * @see org.eclipse.emf.ecp.edit.internal.swt.controls.SingleControl#getUnsetLabelText()
69:          */
70:         @Override
71:         protected String getUnsetLabelText() {
72:                 return LocalizationServiceHelper.getString(getClass(),
73:                         DepricatedControlMessageKeys.BooleanControl_NoBooleanSetClickToSetBoolean);
74:         }
75:
76:         /*
77:          * (non-Javadoc)
78:          * @see org.eclipse.emf.ecp.edit.internal.swt.controls.SingleControl#getUnsetButtonTooltip()
79:          */
80:         @Override
81:         protected String getUnsetButtonTooltip() {
82:                 return LocalizationServiceHelper
83:                         .getString(getClass(), DepricatedControlMessageKeys.BooleanControl_UnsetBoolean);
84:         }
85:
86:         /*
87:          * (non-Javadoc)
88:          * @see org.eclipse.emf.ecp.edit.internal.swt.util.SWTControl#getControlForTooltip()
89:          */
90:         @Override
91:         protected Control[] getControlsForTooltip() {
92:                 // return new Control[] { check };
93:                 return new Control[0];
94:         }
95:
96:         /**
97:          * {@inheritDoc}
98:          *
99:          * @see org.eclipse.emf.ecp.edit.internal.swt.controls.SingleControl#updateValidationColor(org.eclipse.swt.graphics.Color)
100:          */
101:         @Override
102:         protected void updateValidationColor(Color color) {
103:                 check.setBackground(color);
104:         }
105: }