Skip to content

Package: RepositoryViewBranchDecorator

RepositoryViewBranchDecorator

nameinstructionbranchcomplexitylinemethod
RepositoryViewBranchDecorator()
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%
addListener(ILabelProviderListener)
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
decorate(Object, IDecoration)
M: 54 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 13 C: 0
0%
M: 1 C: 0
0%
dispose()
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
isLabelProperty(Object, String)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
removeListener(ILabelProviderListener)
M: 1 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-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: * Johannes Faltermeier - initial API and implementation
13: *******************************************************************************/
14: package org.eclipse.emf.ecp.emfstore.internal.ui.decorator;
15:
16: import java.util.List;
17:
18: import org.eclipse.core.runtime.NullProgressMonitor;
19: import org.eclipse.emf.ecp.emfstore.core.internal.EMFStoreProjectWrapper;
20: import org.eclipse.emf.emfstore.client.ESRemoteProject;
21: import org.eclipse.emf.emfstore.server.exceptions.ESException;
22: import org.eclipse.emf.emfstore.server.model.ESBranchInfo;
23: import org.eclipse.emf.emfstore.server.model.versionspec.ESPrimaryVersionSpec;
24: import org.eclipse.jface.viewers.IDecoration;
25: import org.eclipse.jface.viewers.ILabelProviderListener;
26: import org.eclipse.jface.viewers.ILightweightLabelDecorator;
27:
28: /**
29: * Optional decorator. Not used in extension point
30: *
31: * @author jfaltermeier
32: *
33: */
34: public class RepositoryViewBranchDecorator implements ILightweightLabelDecorator {
35:
36:         @Override
37:         public void addListener(ILabelProviderListener listener) {
38:         }
39:
40:         @Override
41:         public void dispose() {
42:         }
43:
44:         @Override
45:         public boolean isLabelProperty(Object element, String property) {
46:                 return false;
47:         }
48:
49:         @Override
50:         public void removeListener(ILabelProviderListener listener) {
51:         }
52:
53:         @Override
54:         public void decorate(Object element, IDecoration decoration) {
55:•                if (element instanceof EMFStoreProjectWrapper) {
56:                         final EMFStoreProjectWrapper wrapper = (EMFStoreProjectWrapper) element;
57:                         final ESRemoteProject remoteProject = wrapper.getCheckoutData();
58:
59:•                        if (remoteProject == null) {
60:                                 return;
61:                         }
62:
63:                         try {
64:                                 final List<ESBranchInfo> branches = remoteProject.getBranches(new NullProgressMonitor());
65:•                                for (final ESBranchInfo bi : branches) {
66:                                         final ESPrimaryVersionSpec versSpec = bi.getHead();
67:                                         decoration.addSuffix(" [" + versSpec.getBranch() + ", v" + versSpec.getIdentifier() + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
68:                                 }
69:                         } catch (final ESException ex) {
70:                         }
71:                 } else {
72:                         return;
73:                 }
74:         }
75: }