Skip to content

Package: StringControl

StringControl

nameinstructionbranchcomplexitylinemethod
StringControl()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
customizeText(Text)
M: 0 C: 12
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
getTextVariantID()
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getTextWidgetLayoutData()
M: 3 C: 17
85%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 1 C: 3
75%
M: 0 C: 1
100%
getTextWidgetStyle()
M: 12 C: 23
66%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 3 C: 5
63%
M: 0 C: 1
100%
getUnsetButtonTooltip()
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getUnsetLabelText()
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%

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.emfforms.spi.localization.LocalizationServiceHelper;
18: import org.eclipse.swt.SWT;
19: import org.eclipse.swt.layout.GridData;
20: import org.eclipse.swt.widgets.Text;
21:
22: /**
23: * The class describing a String control.
24: *
25: * @author Eugen Neufeld
26: *
27: */
28: @Deprecated
29: public class StringControl extends AbstractTextControl {
30:
31:         /** {@inheritDoc} */
32:         @Override
33:         protected GridData getTextWidgetLayoutData() {
34:                 final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
35:
36:•                if (getItemPropertyDescriptor(getFirstSetting()).isMultiLine(null)) {
37:                         gridData.heightHint = 200;
38:                 }
39:                 return gridData;
40:         }
41:
42:         /** {@inheritDoc} */
43:         @Override
44:         protected int getTextWidgetStyle() {
45:                 int textStyle = SWT.BORDER;
46:                 final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
47:•                if (getItemPropertyDescriptor(getFirstSetting()).isMultiLine(null)) {
48:                         textStyle = textStyle | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL;
49:                         gridData.heightHint = 200;
50:                 } else {
51:                         textStyle = textStyle | SWT.SINGLE;
52:                 }
53:                 return textStyle;
54:         }
55:
56:         /*
57:          * (non-Javadoc)
58:          * @see org.eclipse.emf.ecp.edit.internal.swt.controls.AbstractTextControl#getTextVariantID()
59:          */
60:         @Override
61:         protected String getTextVariantID() {
62:                 return "org_eclipse_emf_ecp_control_string"; //$NON-NLS-1$
63:         }
64:
65:         /*
66:          * (non-Javadoc)
67:          * @see org.eclipse.emf.ecp.edit.internal.swt.controls.SingleControl#getUnsetLabelText()
68:          */
69:         @Override
70:         protected String getUnsetLabelText() {
71:                 return LocalizationServiceHelper.getString(getClass(),
72:                         DepricatedControlMessageKeys.StringControl_NoTextSetClickToSetText);
73:         }
74:
75:         /*
76:          * (non-Javadoc)
77:          * @see org.eclipse.emf.ecp.edit.internal.swt.controls.SingleControl#getUnsetButtonTooltip()
78:          */
79:         @Override
80:         protected String getUnsetButtonTooltip() {
81:                 return LocalizationServiceHelper.getString(getClass(), DepricatedControlMessageKeys.StringControl_UnsetText);
82:         }
83:
84:         @Override
85:         protected void customizeText(Text text) {
86:                 super.customizeText(text);
87:                 text.setMessage(getItemPropertyDescriptor(getFirstSetting()).getDisplayName(null));
88:         }
89: }