本文整理汇总了Java中org.eclipse.emf.ecore.EModelElement类的典型用法代码示例。如果您正苦于以下问题:Java EModelElement类的具体用法?Java EModelElement怎么用?Java EModelElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EModelElement类属于org.eclipse.emf.ecore包,在下文中一共展示了EModelElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: persistMetamodel
import org.eclipse.emf.ecore.EModelElement; //导入依赖的package包/类
public static void persistMetamodel(ResourceSet resourceSet, EPackage generated, String path) throws IOException {
if (new File(path).exists()) {
EPackage existing = (EPackage) OcciHelper.getRootElement(resourceSet, "file:/" + path);
for (Iterator<EObject> iterator = existing.eAllContents(); iterator.hasNext();) {
EObject eo = iterator.next();
if (eo instanceof EAnnotation && isOCLRelated((EAnnotation) eo)) {
EModelElement existingContainer = (EModelElement) eo.eContainer();
EModelElement generatedContainer = (EModelElement) getGeneratedElement(generated,
existingContainer);
if (generatedContainer == null) {
throw new RuntimeException("Unable to find " + existingContainer + " to reattach " + eo + " "
+ ((EAnnotation) eo).getEAnnotations());
} else {
generatedContainer.getEAnnotations().add((EAnnotation) EcoreUtil.copy(eo));
}
}
}
}
ConverterUtils.save(resourceSet, generated, "file:/" + path);
}
示例2: deactivate
import org.eclipse.emf.ecore.EModelElement; //导入依赖的package包/类
/**
* activate에서 등록한 어댑터를 삭제한다.
*
* @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractNotationNodeEditPart#deactivate()
*/
@Override
public void deactivate() {
super.deactivate();
LabelNode node = (LabelNode) getModel();
if (node.getParent() != null) {
node.getParent().eAdapters().remove(this);
Element umlModel = ((AbstractView) node.getParent()).getUmlModel();
if (umlModel != null) {
umlModel.eAdapters().remove(this);
for (Stereotype stereotype : ((Element) umlModel).getAppliedStereotypes()) {
stereotype.eAdapters().remove(this);
}
for (EAnnotation annotation : ((EModelElement) umlModel).getEAnnotations()) {
annotation.eAdapters().remove(this);
}
}
}
}
示例3: activate
import org.eclipse.emf.ecore.EModelElement; //导入依赖的package包/类
/**
* @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractNotationNodeEditPart#activate()
*/
@Override
public void activate() {
super.activate();
LabelNode node = (LabelNode) getModel();
if (node.getParent() != null) {
node.getParent().eAdapters().add(this);
if (null == ((AbstractView) node.getParent()).getParent()) {
return;
}
((AbstractView) node.getParent()).getParent().eAdapters().add(this);
((AbstractView) node.getParent()).getUmlModel().eAdapters().add(this);
for (Stereotype stereotype : ((Element) ((AbstractView) node.getParent()).getUmlModel()).getAppliedStereotypes()) {
stereotype.eAdapters().add(this);
}
for (EAnnotation annotation : ((EModelElement) ((AbstractView) node.getParent()).getUmlModel()).getEAnnotations()) {
annotation.eAdapters().add(this);
}
}
}
示例4: deactivate
import org.eclipse.emf.ecore.EModelElement; //导入依赖的package包/类
/**
* @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractNotationNodeEditPart#deactivate()
*/
@Override
public void deactivate() {
super.deactivate();
LabelNode node = (LabelNode) getModel();
if (node.getParent() != null) {
node.getParent().eAdapters().remove(this);
((AbstractView) node.getParent()).getParent().eAdapters().remove(this);
((AbstractView) node.getParent()).getUmlModel().eAdapters().remove(this);
for (Stereotype stereotype : ((Element) ((AbstractView) node.getParent()).getUmlModel()).getAppliedStereotypes()) {
stereotype.eAdapters().remove(this);
}
for (EAnnotation annotation : ((EModelElement) ((AbstractView) node.getParent()).getUmlModel()).getEAnnotations()) {
annotation.eAdapters().remove(this);
}
}
}
示例5: activate
import org.eclipse.emf.ecore.EModelElement; //导入依赖的package包/类
/**
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#activate()
*/
public void activate() {
if (!isActive()) {
super.activate();
EObject model = (EObject) getModel();
model.eAdapters().add(this);
model = ((AbstractNode) getModel()).getUmlModel();
model.eAdapters().add(this);
model = ((AbstractNode) getModel()).getUmlModel();
for (Stereotype stereotype : ((Element) model).getAppliedStereotypes()) {
stereotype.eAdapters().add(this);
}
model = ((AbstractNode) getModel()).getUmlModel();
for (EAnnotation annotation : ((EModelElement) model).getEAnnotations()) {
annotation.eAdapters().add(this);
}
}
}
示例6: deactivate
import org.eclipse.emf.ecore.EModelElement; //导入依赖的package包/类
/**
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#deactivate()
*/
public void deactivate() {
if (isActive()) {
super.deactivate();
EObject model = (EObject) getModel();
model.eAdapters().remove(this);
model = ((AbstractNode) getModel()).getUmlModel();
model.eAdapters().remove(this);
model = ((AbstractNode) getModel()).getUmlModel();
for (Stereotype stereotype : ((Element) model).getAppliedStereotypes()) {
stereotype.eAdapters().remove(this);
}
model = ((AbstractNode) getModel()).getUmlModel();
for (EAnnotation annotation : ((EModelElement) model).getEAnnotations()) {
annotation.eAdapters().remove(this);
}
}
}
示例7: deactivate
import org.eclipse.emf.ecore.EModelElement; //导入依赖的package包/类
/**
* 모델에서 어답터를 제거함 void
*/
protected void deactivate() {
if (null == this.selectedModel) {
return;
}
if (this.selectedModel.eAdapters().contains(this)) {
this.selectedModel.eAdapters().remove(this);
}
for (Stereotype stereotype : ((Element) selectedModel).getAppliedStereotypes()) {
stereotype.eAdapters().remove(this);
}
for (EAnnotation annotation : ((EModelElement) selectedModel).getEAnnotations()) {
annotation.eAdapters().remove(this);
}
if (selectedModel instanceof InteractionConstraint) {
InteractionConstraint constraint = (InteractionConstraint) selectedModel;
OpaqueExpression expression = (OpaqueExpression) constraint.getSpecification();
expression.eAdapters().remove(this);
}
}
示例8: getColumnWidth
import org.eclipse.emf.ecore.EModelElement; //导入依赖的package包/类
protected static int getColumnWidth(EObject eObject, final IItemPropertyDescriptor descriptor) {
int columnWidth = 100;
Object feature = descriptor.getFeature(eObject);
if (feature instanceof EModelElement) {
EModelElement element = (EModelElement) feature;
String valueString = EMFUtils.getAnnotation(element, ANNOTATION_SOURCE_TABLE, ANNOTATION_DETAIL_COLUMN_WIDTH);
if (valueString != null) {
try {
columnWidth = Integer.parseInt(valueString);
} catch (Exception e) {
LogUtil.error("cannot parse '"+valueString+"' for "+element);
}
}
}
return columnWidth;
}
示例9: computeMappings
import org.eclipse.emf.ecore.EModelElement; //导入依赖的package包/类
private void computeMappings() {
this.mappings = new ArrayList<ITransformationMapping.MetamodelElementMapping>();
this.srcUses = new HashSet<EModelElement>();
this.tgtUses = new HashSet<EModelElement>();
List<RuleWithPattern> rules = analysis.getATLModel().allObjectsOf(RuleWithPattern.class);
for (RuleWithPattern r : rules) {
InPatternElement src = r.getInPattern().getElements().get(0);
for (OutPatternElement ope : r.getOutPattern().getElements()) {
Metaclass srcType = (Metaclass) src.getInferredType();
Metaclass tgtType = (Metaclass) ope.getInferredType();
addMapping(mappings, r, srcType.getKlass(), tgtType.getKlass());
}
}
}
示例10: setDocumentation
import org.eclipse.emf.ecore.EModelElement; //导入依赖的package包/类
public static void setDocumentation(EModelElement eModelElement, String documentation)
{
EAnnotation eAnnotation = eModelElement.getEAnnotation(GEN_MODEL_PACKAGE_NS_URI);
if (documentation == null)
{
if (eAnnotation != null)
{
eAnnotation.getDetails().removeKey("documentation");
}
}
else
{
if (eAnnotation == null)
{
eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
eAnnotation.setSource(GEN_MODEL_PACKAGE_NS_URI);
eModelElement.getEAnnotations().add(eAnnotation);
}
eAnnotation.getDetails().put("documentation", documentation);
}
}
示例11: getConstraints
import org.eclipse.emf.ecore.EModelElement; //导入依赖的package包/类
public static List<String> getConstraints(EModelElement eModelElement)
{
EAnnotation eAnnotation = eModelElement.getEAnnotation(EcorePackage.eNS_URI);
if (eAnnotation != null)
{
String constraints = eAnnotation.getDetails().get("constraints");
if (constraints != null)
{
List<String> result = new ArrayList<String>();
for (StringTokenizer stringTokenizer = new StringTokenizer(constraints); stringTokenizer.hasMoreTokens();)
{
String constraint = stringTokenizer.nextToken();
result.add(constraint);
}
return result;
}
}
return Collections.emptyList();
}
示例12: setAnnotation
import org.eclipse.emf.ecore.EModelElement; //导入依赖的package包/类
public static void setAnnotation(EModelElement eModelElement, String sourceURI, String key, String value)
{
EAnnotation eAnnotation = eModelElement.getEAnnotation(sourceURI);
if (value == null)
{
if (eAnnotation != null)
{
eAnnotation.getDetails().removeKey(key);
}
}
else
{
if (eAnnotation == null)
{
eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
eAnnotation.setSource(sourceURI);
eModelElement.getEAnnotations().add(eAnnotation);
}
eAnnotation.getDetails().put(key, value);
}
}
示例13: setEModelElement
import org.eclipse.emf.ecore.EModelElement; //导入依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setEModelElement(EModelElement newEModelElement)
{
if (newEModelElement != eInternalContainer() || (eContainerFeatureID() != EcorePackage.EANNOTATION__EMODEL_ELEMENT && newEModelElement != null))
{
if (EcoreUtil.isAncestor(this, newEModelElement))
throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
NotificationChain msgs = null;
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
if (newEModelElement != null)
msgs = ((InternalEObject)newEModelElement).eInverseAdd(this, EcorePackage.EMODEL_ELEMENT__EANNOTATIONS, EModelElement.class, msgs);
msgs = basicSetEModelElement(newEModelElement, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EcorePackage.EANNOTATION__EMODEL_ELEMENT, newEModelElement, newEModelElement));
}
示例14: eInverseAdd
import org.eclipse.emf.ecore.EModelElement; //导入依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case EcorePackage.EANNOTATION__EANNOTATIONS:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getEAnnotations()).basicAdd(otherEnd, msgs);
case EcorePackage.EANNOTATION__EMODEL_ELEMENT:
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return basicSetEModelElement((EModelElement)otherEnd, msgs);
}
return eDynamicInverseAdd(otherEnd, featureID, msgs);
}
示例15: setDocumentation
import org.eclipse.emf.ecore.EModelElement; //导入依赖的package包/类
public static void setDocumentation(EModelElement eModelElement, String documentation)
{
EAnnotation eAnnotation = eModelElement.getEAnnotation(GEN_MODEL_PACKAGE_NS_URI);
if (documentation == null)
{
if (eAnnotation != null)
{
eAnnotation.getDetails().remove("documentation");
}
}
else
{
if (eAnnotation == null)
{
eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
eAnnotation.setSource(GEN_MODEL_PACKAGE_NS_URI);
eModelElement.getEAnnotations().add(eAnnotation);
}
eAnnotation.getDetails().put("documentation", documentation);
}
}