blob: 898aa7a63e37b3fa6704453ce40f36fa15130d4a (
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
/*****************************************************************************
* Copyright (c) 2015 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:
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.expansion.expansionmodel.rendering;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
import org.eclipse.papyrus.infra.gmfdiag.common.providers.IGraphicalTypeRegistry;
/**
* This class is used to know all graphical type that can be added in the diagram.
* By default it accepts all. This is the ExpandViewProvider that verify the job
* #Req org.eclipse.papyrus.infra.gmfdiag.expansion.Req_010
*
*/
public class IdentityGraphicalElementType implements IGraphicalTypeRegistry {
/**
* {@inheritDoc}
*/
@Override
public String getEdgeGraphicalType(EObject domainElement) {
return UNDEFINED_TYPE;
}
/**
* {@inheritDoc}
*/
@Override
public String getEdgeGraphicalType(IElementType elementType) {
if (elementType instanceof IHintedType) {
String semanticHint = ((IHintedType) elementType).getSemanticHint();
return getEdgeGraphicalType(semanticHint);
}
return UNDEFINED_TYPE;
}
/**
* {@inheritDoc}
*/
@Override
public String getEdgeGraphicalType(String proposedType) {
return proposedType;
}
/**
* {@inheritDoc}
*/
@Override
public String getNodeGraphicalType(EObject domainElement, String containerType) {
return UNDEFINED_TYPE;
}
/**
* {@inheritDoc}
*/
@Override
public String getNodeGraphicalType(IElementType elementType, String containerType) {
if (elementType instanceof IHintedType) {
String semanticHint = ((IHintedType) elementType).getSemanticHint();
return getNodeGraphicalType(semanticHint, containerType);
}
return UNDEFINED_TYPE;
}
/**
* {@inheritDoc}
*/
@Override
public String getNodeGraphicalType(String proposedType, String containerType) {
return proposedType;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isKnownEdgeType(String type) {
return true;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isKnownNodeType(String type) {
return true;
}
}
|