Skip to content

Package: ECPObservableValue

ECPObservableValue

nameinstructionbranchcomplexitylinemethod
ECPObservableValue(IObservableList, int, Object)
M: 0 C: 12
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
doGetValue()
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
doSetValue(Object)
M: 0 C: 8
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
getIndex()
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%
getValueType()
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%
setIndex(int)
M: 4 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:
16: package org.eclipse.emf.ecp.edit.internal.swt.util;
17:
18: import org.eclipse.core.databinding.observable.list.IObservableList;
19: import org.eclipse.core.databinding.observable.value.AbstractObservableValue;
20:
21: /**
22: * This implements an ObservableValue of a list. This class is used for binding.
23: *
24: * @author Eugen Neufeld
25: */
26: public class ECPObservableValue extends AbstractObservableValue {
27:
28:         private final IObservableList list;
29:
30:         private int index;
31:
32:         private final Object valueType;
33:
34:         /**
35:          * The Constructor to crate an observable value for a {@link IObservableList}, an index and a special value type.
36:          *
37:          * @param list the {@link IObservableList}
38:          * @param index the index of this value
39:          * @param valueType the type of the observed object
40:          */
41:         public ECPObservableValue(IObservableList list, int index, Object valueType) {
42:                 super();
43:                 this.list = list;
44:                 this.index = index;
45:                 this.valueType = valueType;
46:         }
47:
48:         /*
49:          * (non-Javadoc)
50:          * @see org.eclipse.core.databinding.observable.value.IObservableValue#getValueType()
51:          * @generated
52:          */
53:         @Override
54:         public Object getValueType() {
55:                 return valueType;
56:         }
57:
58:         /*
59:          * (non-Javadoc)
60:          * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doGetValue()
61:          */
62:         @Override
63:         protected Object doGetValue() {
64:                 return list.get(index);
65:         }
66:
67:         /*
68:          * (non-Javadoc)
69:          * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doSetValue(java.lang.Object)
70:          */
71:         @Override
72:         protected void doSetValue(Object value) {
73:                 list.set(index, value);
74:         }
75:
76:         /**
77:          * @return the index
78:          */
79:         public int getIndex() {
80:                 return index;
81:         }
82:
83:         /**
84:          * @param index
85:          * the index to set
86:          */
87:         public void setIndex(int index) {
88:                 this.index = index;
89:         }
90:
91: }