Skip to content

Package: ImportHandler

ImportHandler

nameinstructionbranchcomplexitylinemethod
ImportHandler()
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%
execute(Shell, EObject, ECPProject)
M: 12 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 5 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: * David Soto Setzke - initial API and implementation
13: *
14: *******************************************************************************/
15: package org.eclipse.emf.ecp.ui.e4.handlers;
16:
17: import javax.inject.Named;
18:
19: import org.eclipse.e4.core.di.annotations.Execute;
20: import org.eclipse.e4.core.di.annotations.Optional;
21: import org.eclipse.e4.ui.services.IServiceConstants;
22: import org.eclipse.emf.ecore.EObject;
23: import org.eclipse.emf.ecp.core.ECPProject;
24: import org.eclipse.emf.ecp.internal.ui.util.ECPImportHandlerHelper;
25: import org.eclipse.swt.widgets.Shell;
26:
27: /**
28: * Handler to import an {@link EObject}.
29: *
30: * @author David
31: *
32: */
33: public class ImportHandler {
34:
35:         /**
36:          * Imports an {@link EObject} which will be selected via a dialog into the current project.
37:          *
38:          * @param shell {@link Shell} which should be used for the dialogs
39:          * @param eObject The selected {@link EObject} which should be connected with the imported {@link EObject} or null
40:          * if an {@link ECPProject} was selected
41:          * @param ecpProject The selected {@link ECPProject} which should be connected with the imported {@link EObject} or
42:          * null
43:          * if an {@link EObject} was selected
44:          */
45:         @Execute
46:         public void execute(Shell shell, @Named(IServiceConstants.ACTIVE_SELECTION) @Optional EObject eObject,
47:                 @Named(IServiceConstants.ACTIVE_SELECTION) @Optional ECPProject ecpProject) {
48:•                if (eObject != null) {
49:                         ECPImportHandlerHelper.importElement(shell, eObject);
50:•                } else if (ecpProject != null) {
51:                         ECPImportHandlerHelper.importElement(shell, ecpProject);
52:                 }
53:         }
54: }