blob: a76b10586389caa1cda93ab35caddc2b5e609566 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
/*****************************************************************************
* Copyright (c) 2017 CEA LIST and Others.
*
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.uml.nattable.stereotyped.elements.tests.manager.axis;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.impl.DynamicEObjectImpl;
import org.eclipse.papyrus.uml.nattable.manager.axis.AbstractStereotypedElementUMLSynchronizedOnFeatureAxisManager;
import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Element;
/**
* AxisManager for dynamic Requirements.
*/
public class RequirementAxisManager extends AbstractStereotypedElementUMLSynchronizedOnFeatureAxisManager<DynamicEObjectImpl> {
/**
* {@inheritDoc}
*
* @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#canCreateAxisElement(java.lang.String)
*/
@Override
public boolean canCreateAxisElement(final String elementId) {
return UMLElementTypes.CLASS.getId().equals(elementId);
}
/**
* {@inheritDoc}
*
* @see org.eclipse.papyrus.uml.nattable.manager.axis.AbstractStereotypedElementUMLSynchronizedOnFeatureAxisManager#getStereotypeApplication(org.eclipse.uml2.uml.Element)
*/
@Override
protected DynamicEObjectImpl getStereotypeApplication(final Element el) {
for (EObject stereotypeApplication : el.getStereotypeApplications()) {
if (stereotypeApplication instanceof DynamicEObjectImpl && ((DynamicEObjectImpl) stereotypeApplication).eClass().getName().equals("Requirement")) { //$NON-NLS-1$
return (DynamicEObjectImpl) stereotypeApplication;
}
}
return null;
}
/**
* {@inheritDoc}
*
* @see org.eclipse.papyrus.uml.nattable.manager.axis.AbstractStereotypedElementUMLSynchronizedOnFeatureAxisManager#isInstanceOfRequiredStereotypeApplication(java.lang.Object)
*/
@Override
protected boolean isInstanceOfRequiredStereotypeApplication(final Object object) {
return object instanceof DynamicEObjectImpl && ((DynamicEObjectImpl) object).eClass().getName().equals("Requirement"); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*
* @see org.eclipse.papyrus.uml.nattable.manager.axis.AbstractStereotypedElementUMLSynchronizedOnFeatureAxisManager#isAllowedAsBaseElement(org.eclipse.uml2.uml.Element)
*/
@Override
protected boolean isAllowedAsBaseElement(final Element element) {
return element instanceof Class;
}
/**
* {@inheritDoc}
*
* @see org.eclipse.papyrus.uml.nattable.manager.axis.AbstractStereotypedElementUMLSynchronizedOnFeatureAxisManager#getStereotypeApplicationBasePropertyName()
*/
@Override
protected String getStereotypeApplicationBasePropertyName() {
return "base_Class"; //$NON-NLS-1$
}
}
|