Skip to content

Package: CheckoutProjectHandler

CheckoutProjectHandler

nameinstructionbranchcomplexitylinemethod
CheckoutProjectHandler()
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%
canExecute(ECPCheckoutSource)
M: 6 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
execute(Shell, ECPCheckoutSource)
M: 5 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: package org.eclipse.emf.ecp.ui.e4.handlers;
16:
17: import java.util.Collections;
18:
19: import javax.inject.Named;
20:
21: import org.eclipse.e4.core.di.annotations.CanExecute;
22: import org.eclipse.e4.core.di.annotations.Execute;
23: import org.eclipse.e4.core.di.annotations.Optional;
24: import org.eclipse.e4.ui.services.IServiceConstants;
25: import org.eclipse.emf.ecp.core.util.ECPCheckoutSource;
26: import org.eclipse.emf.ecp.spi.ui.util.ECPHandlerHelper;
27: import org.eclipse.swt.widgets.Shell;
28:
29: /**
30: * Handler to check out a {@link ECPCheckoutSource}.
31: *
32: * @author Jonas
33: *
34: */
35: public class CheckoutProjectHandler {
36:         /**
37:          * checks out a {@link ECPCheckoutSource}.
38:          *
39:          * @param shell shell to display a dialog
40:          * @param checkoutSource the {@link ECPCheckoutSource} to be chcked out
41:          */
42:         @Execute
43:         public void execute(Shell shell,
44:                 @Named(IServiceConstants.ACTIVE_SELECTION) @Optional ECPCheckoutSource checkoutSource) {
45:                 ECPHandlerHelper.checkout(Collections.singletonList(checkoutSource), shell);
46:         }
47:
48:         /**
49:          * checks if the current selection is an {@link ECPCheckoutSource}.
50:          *
51:          * @param checkoutSource the current selection, if it is an {@link ECPCheckoutSource} or null otherwise
52:          * @return if the current selection is an {@link ECPCheckoutSource}
53:          */
54:         @CanExecute
55:         public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional ECPCheckoutSource checkoutSource) {
56:•                return checkoutSource != null;
57:         }
58: }