Skip to content

Package: ReferenceService

ReferenceService

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2018 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: * Lucas Koehler - added new add new model elements api
14: ******************************************************************************/
15: package org.eclipse.emf.ecp.edit.spi;
16:
17: import org.eclipse.emf.ecore.EObject;
18: import org.eclipse.emf.ecore.EReference;
19: import org.eclipse.emf.ecp.view.spi.context.ViewModelService;
20: import org.eclipse.emfforms.common.Optional;
21:
22: /**
23: * @author Eugen Neufeld
24: * @since 1.2
25: *
26: */
27: public interface ReferenceService extends ViewModelService {
28:
29:         /**
30:          * Adds new model elements to the {@link EReference}.
31:          * The implementation is responsible for providing a selection meachsims, e.g. a dialog.
32:          *
33:          * @param eObject the {@link EObject} to add
34:          * @param eReference the {@link EReference} to add the {@link EObject} to
35:          * @since 1.5
36:          * @deprecated use {@link #addNewModelElements(EObject, EReference, boolean)} instead
37:          */
38:         @Deprecated
39:         void addNewModelElements(EObject eObject, EReference eReference);
40:
41:         /**
42:          * Adds new model elements to the {@link EReference}.
43:          * The implementation is responsible for providing a selection mechanism, e.g. a dialog.
44:          *
45:          * @param eObject the {@link EObject} to add
46:          * @param eReference the {@link EReference} to add the {@link EObject} to
47:          * @param openInNewContext Hints the reference service whether the created model element should be opened in a new
48:          * context
49:          * @since 1.17
50:          * @return The created model element
51:          */
52:         Optional<EObject> addNewModelElements(EObject eObject, EReference eReference, boolean openInNewContext);
53:
54:         /**
55:          * Adds existing model elements to the {@link EReference}.
56:          * The implementation is responsible for providing a selection meachsims, e.g. a dialog.
57:          *
58:          * @param eObject the {@link EObject} to add
59:          * @param eReference the {@link EReference} to add the {@link EObject} to
60:          * @since 1.5
61:          */
62:         void addExistingModelElements(EObject eObject, EReference eReference);
63:
64:         /**
65:          * Opens an {@link EObject} in a new context.
66:          *
67:          * @param eObject the {@link EObject} to open in a new context
68:          */
69:         void openInNewContext(EObject eObject);
70: }