blob: 452619ea4fc7bb7a2ff0e8977f0f1c0624865753 (
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.
*
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.uml.expressions.properties.factories;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElement;
import org.eclipse.papyrus.infra.ui.emf.providers.EMFGraphicalContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
import org.eclipse.papyrus.uml.expressions.properties.factories.utils.UMLExpressionsConstants;
import org.eclipse.papyrus.uml.tools.providers.UMLEClassContentProvider;
import org.eclipse.papyrus.uml.tools.providers.UMLEClassLabelProvider;
/**
* ModelElement used for UML Expressions, to define the label provider and the content provider to use for some edited features of UML Expressions.
*
*/
public class UMLExpressionsModelElement extends EMFModelElement {
/**
* Constructor.
*
* @param source
* @param domain
*/
public UMLExpressionsModelElement(EObject source, EditingDomain domain) {
super(source, domain);
}
/**
* Constructor.
*
* @param source
*/
public UMLExpressionsModelElement(EObject source) {
super(source);
}
/**
* @see org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElement#getContentProvider(java.lang.String)
*
* @param propertyPath
* @return
*/
@Override
public IStaticContentProvider getContentProvider(String propertyPath) {
if (UMLExpressionsConstants.UML_ECLASS.equals(propertyPath)) {
final ResourceSet resourceSet = this.domain == null ? null : this.domain.getResourceSet();
return new EMFGraphicalContentProvider(new UMLEClassContentProvider(), resourceSet, "org.eclipse.papyrus.uml.expressions.eclass.history"); //$NON-NLS-1$
}
return super.getContentProvider(propertyPath);
}
/**
* @see org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElement#getLabelProvider(java.lang.String)
*
* @param propertyPath
* @return
*/
@Override
public ILabelProvider getLabelProvider(String propertyPath) {
if (UMLExpressionsConstants.UML_ECLASS.equals(propertyPath)) {
return new UMLEClassLabelProvider();
}
return super.getLabelProvider(propertyPath);
}
}
|