Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: b34215c87d8a73da26ef84997bc72d652a1f0298 (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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/*****************************************************************************
 * Copyright (c) 2008 CEA LIST.
 *
 *    
 * 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:
 *  Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
 *
 *****************************************************************************/
package org.eclipse.papyrus.diagram.clazz.custom.providers;

import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
import org.eclipse.papyrus.diagram.clazz.custom.parsers.CustomMessageFormatParser;
import org.eclipse.papyrus.diagram.clazz.custom.parsers.OperationParser;
import org.eclipse.papyrus.diagram.clazz.custom.parsers.PropertyParser;
import org.eclipse.papyrus.diagram.clazz.edit.parts.AppliedStereotypeAbstractionEditPart;
import org.eclipse.papyrus.diagram.clazz.edit.parts.AppliedStereotypeAssociationEditPart;
import org.eclipse.papyrus.diagram.clazz.edit.parts.AppliedStereotypeDependencyEditPart;
import org.eclipse.papyrus.diagram.clazz.edit.parts.AppliedStereotypeElementImportEditPart;
import org.eclipse.papyrus.diagram.clazz.edit.parts.AppliedStereotypeInterfaceRealizationEditPart;
import org.eclipse.papyrus.diagram.clazz.edit.parts.AppliedStereotypePackageImportEditPart;
import org.eclipse.papyrus.diagram.clazz.edit.parts.AppliedStereotypeRealizationEditPart;
import org.eclipse.papyrus.diagram.clazz.edit.parts.AppliedStereotypeSubstitutionEditPart;
import org.eclipse.papyrus.diagram.clazz.edit.parts.AppliedStereotypeUsageEditPart;
import org.eclipse.papyrus.diagram.clazz.edit.parts.AppliedStereotyperGeneralizationEditPart;
import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationBranchMutliplicityEditPart;
import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationBranchRoleEditPart;
import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationNameEditPart;
import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationSourceNameEditPart;
import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationTargetNameEditPart;
import org.eclipse.papyrus.diagram.clazz.edit.parts.OperationForClassEditPart;
import org.eclipse.papyrus.diagram.clazz.edit.parts.OperationForComponentEditPart;
import org.eclipse.papyrus.diagram.clazz.edit.parts.OperationForDataTypeEditPart;
import org.eclipse.papyrus.diagram.clazz.edit.parts.OperationForInterfaceEditpart;
import org.eclipse.papyrus.diagram.clazz.edit.parts.PropertyForClassEditPart;
import org.eclipse.papyrus.diagram.clazz.edit.parts.PropertyForComponentEditPart;
import org.eclipse.papyrus.diagram.clazz.edit.parts.PropertyForInterfaceEditPart;
import org.eclipse.papyrus.diagram.clazz.edit.parts.PropertyForSignalEditPart;
import org.eclipse.papyrus.diagram.clazz.edit.parts.PropertyforDataTypeEditPart;
import org.eclipse.papyrus.diagram.clazz.parsers.MessageFormatParser;
import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
import org.eclipse.papyrus.diagram.common.parser.custom.AssociationEndParser;
import org.eclipse.papyrus.diagram.common.parser.custom.AssociationMultiplicityParser;
import org.eclipse.papyrus.diagram.common.parser.stereotype.AppliedStereotypeParser;
import org.eclipse.uml2.uml.UMLPackage;

/**
 * this class is used to overload specific parsers
 * 
 * @author patrick Tessier
 */
public class CustomUMLParserProvider extends UMLParserProvider {

	private static final int ASSOCIATION_SOURCE = 0;

	private static final int ASSOCIATION_TARGET = 1;

	public CustomUMLParserProvider() {
		super();
	}

	protected IParser getAppliedStereotypeParser() {
		IParser parser = new AppliedStereotypeParser();
		return parser;
	}

	protected IParser getAssociationBranchRole() {
		EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name(), };
		IParser parser = new CustomMessageFormatParser(features, UMLPackage.eINSTANCE.getAssociation_MemberEnd(), 0);
		return parser;

	}

	/**
	 * @generated
	 */
	protected IParser getAssociationName_6002Parser() {
		EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name(), };
		MessageFormatParser parser = new MessageFormatParser(features);
		return parser;
	}

	/**
	 * @generated
	 */
	protected IParser getAssociationSourceMultiplicity() {
		return new AssociationMultiplicityParser(ASSOCIATION_SOURCE);
	}

	/**
	 * @generated
	 */
	protected IParser getAssociationSourceRole() {
		return new AssociationEndParser(ASSOCIATION_SOURCE);
	}

	/**
	 * @generated
	 */
	protected IParser getAssociationTargetMultiplicity() {
		return new AssociationMultiplicityParser(ASSOCIATION_TARGET);
	}

	/**
	 * @generated
	 */
	protected IParser getAssociationTargetRole() {
		return new AssociationEndParser(ASSOCIATION_TARGET);
	}

	/**
	 * 
	 * {@inheritDoc}
	 */
	protected IParser getCustomPropertyParser() {
		return new PropertyParser();
	}

	private IParser getOperationParser() {
		OperationParser operationParser = new OperationParser();
		return operationParser;
	}

	/**
	 * @generated
	 */
	protected IParser getParser(int visualID) {
		switch(visualID) {
		case PropertyForComponentEditPart.VISUAL_ID:
			return getCustomPropertyParser();
		case OperationForComponentEditPart.VISUAL_ID:
			return getOperationParser();
		case PropertyForSignalEditPart.VISUAL_ID:
			return getCustomPropertyParser();
		case PropertyForInterfaceEditPart.VISUAL_ID:
			return getCustomPropertyParser();
		case OperationForInterfaceEditpart.VISUAL_ID:
			return getOperationParser();
		case PropertyForClassEditPart.VISUAL_ID:
			return getCustomPropertyParser();
		case OperationForClassEditPart.VISUAL_ID:
			return getOperationParser();
		case PropertyforDataTypeEditPart.VISUAL_ID:
			return getCustomPropertyParser();
		case OperationForDataTypeEditPart.VISUAL_ID:
			return getOperationParser();
		case AssociationNameEditPart.VISUAL_ID:
			return getAssociationName_6002Parser();
		case AssociationTargetNameEditPart.VISUAL_ID:
			return getAssociationTargetRole();

		case AssociationSourceNameEditPart.VISUAL_ID:
			return getAssociationSourceMultiplicity();

		case AssociationBranchRoleEditPart.VISUAL_ID:
			return getAssociationSourceRole();
		case AssociationBranchMutliplicityEditPart.VISUAL_ID:
			return getAssociationSourceMultiplicity();
		case AppliedStereotypeAssociationEditPart.VISUAL_ID:
			return getAppliedStereotypeParser();
		case AppliedStereotyperGeneralizationEditPart.VISUAL_ID:
			return getAppliedStereotypeParser();
		case AppliedStereotypeInterfaceRealizationEditPart.VISUAL_ID:
			return getAppliedStereotypeParser();
		case AppliedStereotypeSubstitutionEditPart.VISUAL_ID:
			return getAppliedStereotypeParser();
		case AppliedStereotypeRealizationEditPart.VISUAL_ID:
			return getAppliedStereotypeParser();
		case AppliedStereotypeAbstractionEditPart.VISUAL_ID:
			return getAppliedStereotypeParser();
		case AppliedStereotypeUsageEditPart.VISUAL_ID:
			return getAppliedStereotypeParser();
		case AppliedStereotypeDependencyEditPart.VISUAL_ID:
			return getAppliedStereotypeParser();

		case AppliedStereotypeElementImportEditPart.VISUAL_ID:
			return getAppliedStereotypeParser();
		case AppliedStereotypePackageImportEditPart.VISUAL_ID:
			return getAppliedStereotypeParser();

		}
		return super.getParser(visualID);
	}
}

Back to the top