blob: a532ba13c60bcc852ee01978ad7d7ec75b6feb7b (
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
|
/*****************************************************************************
* Copyright (c) 2011, 2014 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:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.infra.properties.ui.modelelement;
import org.eclipse.core.databinding.observable.IObservable;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.ui.emf.databinding.AnnotationObservableValue;
/**
* A ModelElement for handling EAnnotations
*
* @author Camille Letavernier
*/
public class AnnotationModelElement extends AbstractModelElement {
/**
* The EModelElement owning the represented EAnnotation
*/
protected EModelElement source;
/**
* The editing domain on which the modification commands will be executed
*/
protected EditingDomain domain;
/**
* The name of the annotation being represented
*/
protected String annotationName;
/**
*
* Constructor.
*
* @param source
* The EModelElement owning the EAnnotation that will be edited
* @param domain
* The EditingDomain on which the commands will be executed
* @param annotationName
* The name of the EAnnotation to edit. The EAnnotation doesn't need to exist yet
*/
public AnnotationModelElement(EModelElement source, EditingDomain domain, String annotationName) {
this.source = source;
this.domain = domain;
this.annotationName = annotationName;
}
/**
* {@inheritDoc}
*/
@Override
public IObservable doGetObservable(String propertyPath) {
return new AnnotationObservableValue(source, domain, annotationName, propertyPath);
}
@Override
public boolean isEditable(String propertyPath) {
return !EMFHelper.isReadOnly(source);
}
}
|