Skip to content

Package: PropertiesLabelProvider

PropertiesLabelProvider

nameinstructionbranchcomplexitylinemethod
PropertiesLabelProvider()
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%
getColumnImage(Object, int)
M: 11 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
getColumnText(Object, int)
M: 20 C: 0
0%
M: 5 C: 0
0%
M: 4 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%
static {...}
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 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.Map;
17:
18: import org.eclipse.emf.ecp.internal.ui.Activator;
19: import org.eclipse.jface.viewers.ITableLabelProvider;
20: import org.eclipse.jface.viewers.LabelProvider;
21: import org.eclipse.swt.graphics.Image;
22:
23: /**
24: * A {@link LabelProvider} for properties.
25: *
26: * @author Eike Stepper
27: */
28: public class PropertiesLabelProvider extends LabelProvider implements ITableLabelProvider {
29:         private static final Image PROPERTY = Activator.getImage("icons/property_obj.gif"); //$NON-NLS-1$
30:
31:         /**
32:          * Default constructor.
33:          */
34:         public PropertiesLabelProvider() {
35:         }
36:
37:         @Override
38:         public String getColumnText(Object element, int columnIndex) {
39:•                if (element instanceof Map.Entry) {
40:                         @SuppressWarnings("unchecked")
41:                         final Map.Entry<String, String> entry = (Map.Entry<String, String>) element;
42:•                        switch (columnIndex) {
43:                         case 0:
44:                                 return entry.getKey();
45:
46:                         case 1:
47:                                 return entry.getValue();
48:                         default:
49:                                 return null;
50:                         }
51:                 }
52:
53:                 return null;
54:         }
55:
56:         @Override
57:         public Image getColumnImage(Object element, int columnIndex) {
58:•                if (element instanceof Map.Entry) {
59:•                        switch (columnIndex) {
60:                         case 0:
61:                                 return PROPERTY;
62:                         default:
63:                                 return null;
64:                         }
65:                 }
66:
67:                 return null;
68:         }
69: }