Skip to content

Package: SegmentIdeDescriptor

SegmentIdeDescriptor

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2019 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: * Lucas Koehler - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.view.spi.editor.controls;
15:
16: import org.eclipse.emf.ecore.EClass;
17: import org.eclipse.emf.ecore.EStructuralFeature;
18: import org.eclipse.emf.ecp.view.internal.editor.handler.CreateSegmentDmrWizard;
19: import org.eclipse.emf.ecp.view.spi.model.VDomainModelReferenceSegment;
20:
21: /**
22: * A {@link SegmentIdeDescriptor} provides information about one type of {@link VDomainModelReferenceSegment} relevant
23: * to the IDE tooling. For instance, this information is needed by the {@link CreateSegmentDmrWizard}
24: * to properly create DMRs with different segment types.
25: *
26: * @author Lucas Koehler
27: * @since 1.20
28: *
29: */
30: public interface SegmentIdeDescriptor {
31:         /**
32:          * Returns the {@link EClass} of the segment type that is described by this {@link SegmentIdeDescriptor}.
33:          *
34:          * @return The segment's {@link EClass}
35:          */
36:         EClass getSegmentType();
37:
38:         /**
39:          * Defines whether the described segment type may be created by users.
40:          *
41:          * @return <code>true</code> if users may create the type, <code>false</code> otherwise
42:          */
43:         boolean isAvailableInIde();
44:
45:         /**
46:          * Defines whether the described segment may appear in the middle of a reference path or if the segment is only
47:          * allowed to be at the end of a path.
48:          *
49:          * @return <code>true</code> if the segment must only be at the end of a path, <code>false</code> otherwise
50:          */
51:         boolean isLastElementInPath();
52:
53:         /**
54:          * Defines whether the described segment can be the last element of a reference path.
55:          *
56:          * @return <code>true</code> if the segment can be the last element of a reference path, <code>false</code>
57:          * otherwise
58:          */
59:         boolean isAllowedAsLastElementInPath();
60:
61:         /**
62:          * Returns an {@link EStructuralFeatureSelectionValidator} that determines whether an {@link EStructuralFeature} is
63:          * a valid reference path part for the described segment type. E.g. an index segment needs a multi reference or
64:          * attribute.
65:          *
66:          * @return The {@link EStructuralFeatureSelectionValidator}
67:          */
68:         EStructuralFeatureSelectionValidator getEStructuralFeatureSelectionValidator();
69:
70:         /**
71:          * Returns a {@link ReferenceTypeResolver} that resolves the root {@link EClass} for the next reference path segment
72:          * from an EReference.
73:          *
74:          * @return The {@link ReferenceTypeResolver}
75:          */
76:         ReferenceTypeResolver getReferenceTypeResolver();
77: }