Skip to content

Package: PropertiesContentProvider

PropertiesContentProvider

nameinstructionbranchcomplexitylinemethod
PropertiesContentProvider()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
connectInput(Properties)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
disconnectInput(Properties)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
getElements(Object)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
propertiesChanged(ECPProperties, Collection, Collection)
M: 8 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /********************************************************************************
2: * Copyright (c) 2011 Eike Stepper (Berlin, Germany) 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: * Eike Stepper - initial API and implementation
13: ********************************************************************************/
14: package org.eclipse.emf.ecp.internal.ui.model;
15:
16: import java.util.Collection;
17: import java.util.Map.Entry;
18:
19: import org.eclipse.emf.ecp.core.util.ECPProperties;
20: import org.eclipse.emf.ecp.core.util.observer.ECPPropertiesObserver;
21: import org.eclipse.emf.ecp.internal.core.util.Properties;
22:
23: /**
24: * @author Eike Stepper
25: */
26: public class PropertiesContentProvider extends StructuredContentProvider<Properties> implements ECPPropertiesObserver {
27:         /**
28:          * Constructor.
29:          */
30:         public PropertiesContentProvider() {
31:         }
32:
33:         /**
34:          * {@inheritDoc}
35:          */
36:         @Override
37:         public Object[] getElements(Object inputElement) {
38:                 return getInput().getElements().toArray();
39:         }
40:
41:         /**
42:          * {@inheritDoc}
43:          */
44:         @Override
45:         public void propertiesChanged(ECPProperties properties, Collection<Entry<String, String>> oldProperties,
46:                 Collection<Entry<String, String>> newProperties) {
47:•                if (properties.equals(getInput())) {
48:                         refreshViewer();
49:                 }
50:         }
51:
52:         @Override
53:         protected void connectInput(Properties input) {
54:                 super.connectInput(input);
55:                 input.addObserver(this);
56:         }
57:
58:         @Override
59:         protected void disconnectInput(Properties input) {
60:                 input.removeObserver(this);
61:                 super.disconnectInput(input);
62:         }
63: }