Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 3f7593571733f7393bd6ba23e220c3028d6599eb (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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
/*
 * Copyright (c) 2007, 2009 Borland Software Corporation

 * 
 * 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:
 *    Dmitry Stadnik (Borland) - initial API and implementation
 * Thibault Landre (Atos Origin) - initial API and implementation
 */

«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
«IMPORT 'http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension'»
«EXTENSION xpt::diagram::Utils»
«EXTENSION xpt::GenEditorGenerator»

«EXTENSION xpt::preferences::PrefsConstant»
«EXTENSION xpt::editor::palette::Utils»

«DEFINE category FOR gmfgen::GenDiagram»«getDiagramPreferencePageCategory()».«editorGen.modelID»«ENDDEFINE»



«AROUND plugin FOR gmfgen::GenPlugin-»
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
«EXPAND xpt::Common::xcopyright FOR editorGen-»
<plugin>
«REM»YT (not used): «EXPAND fileTypes-»«ENDREM»
«REM»YT (not used): «EXPAND extension_parser-»«ENDREM»
«EXPAND xpt::editor::extensions::extensions FOR editorGen-»
«REM» global actions handled in the diagram.common plugin
«EXPAND xpt::plugin::plugin::menu-»«ENDREM»
«EXPAND xpt::plugin::plugin::validation FOR editorGen.diagram-»
«EXPAND xpt::plugin::plugin::metrics FOR editorGen.metrics-»
«REM»RS: redefine palette generation«ENDREM»
«EXPAND palettePredefinedEntries FOR editorGen-»
«EXPAND paletteEntries FOR editorGen-»
«EXPAND xpt::diagram::preferences::extensions::extensions FOR editorGen.diagram-»
«EXPAND xpt::propsheet::extensions::extensions FOR editorGen.propertySheet-»
«EXPAND preferencePages FOR editorGen.diagram-»
«EXPAND preferencePageInitializer FOR editorGen.diagram-»
«EXPAND xpt::providers::extensions::extensions FOR editorGen.diagram-»
«EXPAND xpt::navigator::extensions::extensions FOR editorGen.navigator-»
«EXPAND xpt::application::extensions::extensions FOR editorGen.application-»
«EXPAND xpt::ConstraintProviders::extensions FOR editorGen-»
«EXPAND xpt::diagram::updater::extensions::extensions FOR editorGen.diagramUpdater-»
«EXPAND impl::actions::extensions::Main FOR editorGen-»
«EXPAND xpt::plugin::plugin::additions-»
«EXPAND xpt::plugin::plugin::notationTypesMap FOR editorGen»
</plugin>
«ENDAROUND»

«DEFINE fileTypes FOR gmfgen::GenPlugin»
   <extension point="org.eclipse.team.core.fileTypes" id="repo-ftype">
      «EXPAND xpt::Common::xmlGeneratedTag»
      <fileTypes type="text" extension="«editorGen.diagramFileExtension»"/>
   </extension>
«ENDDEFINE»

«DEFINE extension_parser FOR gmfgen::GenPlugin»
   <extension point="org.eclipse.emf.ecore.extension_parser" id="resource-factory">
      «EXPAND xpt::Common::xmlGeneratedTag»
      <parser
         type="«editorGen.diagramFileExtension»"
         class="org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory">
      </parser>
   </extension>
«ENDDEFINE»

«DEFINE menu FOR gmfgen::GenPlugin»
   <extension point="org.eclipse.gmf.runtime.common.ui.services.action.globalActionHandlerProviders" id="global-actions">
      «EXPAND xpt::Common::xmlGeneratedTag»
      <GlobalActionHandlerProvider
         class="org.eclipse.papyrus.uml.diagram.common.providers.PapyrusGlobalActionHandlerProvider"
         id="«editorGen.modelID»Presentation">
         <Priority name="Highest"/>
         <ViewId id="org.eclipse.papyrus.infra.core.papyrusEditor">
            <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
               <GlobalActionId actionId="delete"/>
            </ElementType>
            <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart">
               <GlobalActionId actionId="save"/>
            </ElementType>
         </ViewId>
      </GlobalActionHandlerProvider>
«IF printingEnabled-»
      <GlobalActionHandlerProvider
         class="org.eclipse.gmf.runtime.diagram.ui.printing.render.providers.DiagramWithPrintGlobalActionHandlerProvider"
         id="«editorGen.modelID»PresentationPrint">
         <Priority name="Low"/>
         <ViewId id="org.eclipse.papyrus.infra.core.papyrusEditor">
            <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
               <GlobalActionId actionId="print"/>
            </ElementType>
         </ViewId>
      </GlobalActionHandlerProvider>
«ENDIF-»
«IF null = editorGen.application-»
      <GlobalActionHandlerProvider
         class="org.eclipse.gmf.runtime.diagram.ui.providers.ide.providers.DiagramIDEGlobalActionHandlerProvider"
         id="«editorGen.modelID»PresentationIDE">
         <Priority name="Low"/>
         <ViewId id="org.eclipse.papyrus.infra.core.papyrusEditor">
            <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
               <GlobalActionId actionId="bookmark"/>
            </ElementType>
         </ViewId>
      </GlobalActionHandlerProvider>
«ENDIF-»
      <GlobalActionHandlerProvider
            class="org.eclipse.papyrus.uml.diagram.common.providers.PapyrusGlobalActionHandlerProvider"
            id="«editorGen.modelID»Render">
         <Priority name="Highest"/>
         <ViewId id="org.eclipse.papyrus.infra.core.papyrusEditor">
            <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
               <GlobalActionId actionId="cut"/>
               <GlobalActionId actionId="copy"/>
               <GlobalActionId actionId="paste"/>
            </ElementType>
         </ViewId>
      </GlobalActionHandlerProvider>
   </extension>

«ENDDEFINE»

«DEFINE metrics FOR gmfgen::GenMetricContainer-»
«IF metrics->size() > 0»
   <extension id="metrics-view" point="org.eclipse.ui.views">
      «EXPAND xpt::Common::xmlGeneratedTag»
   	  <view class="«editorGen.diagram.getMetricProviderQualifiedClassName()»$ResultView"
			id="«editorGen.diagram.getMetricViewID()»"
			name="«editorGen.modelID» Diagram Metrics"/>
   </extension>
«ENDIF-»
«ENDDEFINE»

«DEFINE validation FOR gmfgen::GenDiagram-»
«IF validationEnabled or hasAudits(editorGen)-»
«IF null = editorGen.application-»

   <extension point="org.eclipse.gmf.runtime.common.ui.services.markerNavigationProviders" id="markers-navigation">
      «EXPAND xpt::Common::xmlGeneratedTag»
      <MarkerNavigationProvider class="«getMarkerNavigationProviderQualifiedClassName()»">
         <MarkerType name="«editorGen.plugin.iD + '.' + getValidationDiagnosticMarkerType()»"/>
         <Priority name="«markerNavigationProviderPriority»"/>
      </MarkerNavigationProvider>
   </extension>

   <extension id="«getValidationDiagnosticMarkerType()»" name="«editorGen.plugin.name» problems" point="org.eclipse.core.resources.markers">
      «EXPAND xpt::Common::xmlGeneratedTag»
      <super type="org.eclipse.core.resources.problemmarker"/>
      <super type="org.eclipse.gmf.runtime.common.ui.services.marker"/>
      <persistent value="true"/>
   </extension>   
«ENDIF-»
«IF validationDecorators-»

   <extension id="validationDecoratorProvider" name="ValidationDecorations" point="org.eclipse.gmf.runtime.diagram.ui.decoratorProviders">
      «EXPAND xpt::Common::xmlGeneratedTag»
      <decoratorProvider class="«getValidationDecoratorProviderQualifiedClassName()»">
         <Priority name="«validationDecoratorProviderPriority»"/>
         <object class="org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart(org.eclipse.gmf.runtime.diagram.ui)" id="PRIMARY_VIEW"/>
         <context decoratorTargets="PRIMARY_VIEW"/>
      </decoratorProvider>
   </extension>
«ENDIF-»
«ENDIF-»
«ENDDEFINE»

«DEFINE additions FOR gmfgen::GenPlugin»«ENDDEFINE»

«DEFINE preferencePageInitializer FOR gmfgen::GenDiagram»
	<extension point="org.eclipse.core.runtime.preferences">
		«EXPAND xpt::Common::xmlGeneratedTag»
		<initializer class="«preferencesPackageName».DiagramPreferenceInitializer"/>
	</extension>
«ENDDEFINE»

«DEFINE preferencePages FOR gmfgen::GenDiagram»
«REM»Generate Diagram Preference Page«ENDREM»
«EXPAND xpt::Common::xmlGeneratedTag»
<extension point="org.eclipse.ui.preferencePages">

«REM»Generate Nodes Preference Pages«ENDREM»
«FOREACH getAllNodes().elementType.displayName->asSet() AS node  -»
		«EXPAND preferencePageNodeExtension(self) FOR node-»
«ENDFOREACH»
«REM»Generate Links Preference Pages«ENDREM»
«FOREACH links.elementType.displayName->asSet()  AS link -»
		«EXPAND preferencePageLinkExtension(self) FOR link-»
«ENDFOREACH»
</extension>
«ENDDEFINE»

«DEFINE preferencePageNodeExtension(gmfgen::GenDiagram diagram) FOR String-»
«IF 'UNDEFINED' <> self.toUpper()»
	«EXPAND xpt::Common::xmlGeneratedTag»
	<page  	category="«EXPAND category FOR diagram»"
			class="«diagram.preferencesPackageName».«self»«getPreferencePageSuffix()»"
            id="«diagram.preferencesPackageName».«self»«getPreferencePageSuffix()»"
            name="«self» Node" />
«ENDIF»	
«ENDDEFINE»
«DEFINE preferencePageLinkExtension(gmfgen::GenDiagram diagram) FOR String-»

«IF 'UNDEFINED' <>  self.toUpper()»
	«EXPAND xpt::Common::xmlGeneratedTag»
	<page  	category="«EXPAND category FOR diagram»"
			class="«diagram.preferencesPackageName».«self»«getPreferencePageSuffix()»"
            id="«diagram.preferencesPackageName».«self»«getPreferencePageSuffix()»"
            name="«self» Link" />
«ENDIF»		
«ENDDEFINE»
«DEFINE preferencePageExtension(gmfgen::GenDiagram diagram) FOR gmfgen::GenLink-»
«IF "UNDEFINED" <> self.elementType.displayName.toUpper()»
	«EXPAND xpt::Common::xmlGeneratedTag»
	<page  	category="«EXPAND category FOR diagram»"
			class="«diagram.preferencesPackageName».«self»«getPreferencePageSuffix()»"
            id="«diagram.preferencesPackageName».«self»«getPreferencePageSuffix()»"
            name="«self.elementType.displayName» Link" />
«ENDIF»		
«ENDDEFINE»

«REM»RS: redefine palette generation, using predefined entries«ENDREM»
«DEFINE palettePredefinedEntries FOR gmfgen::GenEditorGenerator»
	«EXPAND xpt::Common::xmlGeneratedTag»
	<extension
		id="«plugin.name».palettedefinition"
		name="«plugin.name» Predefined Entries"
		point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders"> 
		
		«EXPAND xpt::Common::xmlGeneratedTag»	
		<paletteProvider class="org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider">
			<Priority name="Lowest"/>
      		<contribution
            	factoryClass="«self.diagram.palette.packageName».«self.diagram.palette.factoryClassName»">
     			<predefinedEntry id="standardGroup/noteStack/noteTool" remove="true"/> 
				<predefinedEntry id="standardGroup/noteStack/textTool" remove="true"/> 
				<predefinedEntry id="standardGroup/noteStack/noteattachmentTool" remove="true"/>
				«EXPAND predefinedEntryDefinition FOREACH collectTools(diagram.palette)»
			</contribution>
		</paletteProvider>	
			
	</extension>
«ENDDEFINE»

«DEFINE predefinedEntryDefinition  FOR gmfgen::AbstractToolEntry-»
	<entry
       defineOnly="true"
       description="«self.description»"
       id=«IF id.isQuoted('\"')»«id»«ELSE»"«id»"«ENDIF»
       kind="tool"
       label="«self.title»"
       large_icon="«largeIconPath»"
       path=""
       small_icon="«smallIconPath»">
 	</entry>
«ENDDEFINE»

«REM»RS: redefine palette generation, using predefined entries«ENDREM»
«DEFINE paletteEntries FOR gmfgen::GenEditorGenerator»
	«EXPAND xpt::Common::xmlGeneratedTag»
	<extension
		id="«plugin.name».standard"
		name="«plugin.name» Standard Palette"
		point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders"> 
		
		«EXPAND xpt::Common::xmlGeneratedTag»	
		<paletteProvider class="org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider">
			<Priority name="Low"/>
      		<contribution
            	factoryClass="«self.diagram.palette.packageName».«self.diagram.palette.factoryClassName»">
     			<predefinedEntry id="standardGroup/noteStack/noteTool" remove="true"/> 
				<predefinedEntry id="standardGroup/noteStack/textTool" remove="true"/> 
				<predefinedEntry id="standardGroup/noteStack/noteattachmentTool" remove="true"/>
				«EXPAND groupUsage FOREACH collectGroups(diagram.palette)»
			</contribution>
			<editor id="«plugin.iD»"/>
		</paletteProvider>	
			
	</extension>
«ENDDEFINE»

«DEFINE groupUsage FOR gmfgen::ToolGroup-»
	<entry
       description="«self.description»"
       id=«IF id.isQuoted('\"')»«id»«ELSE»"«id»"«ENDIF»
       kind="drawer"
       label="«self.title»"
       large_icon="«largeIconPath»"
       path="/"
       small_icon="«smallIconPath»">
       <expand
              force="true">
       </expand>
 	</entry>
 	«REM» TODO: call sub entries...«ENDREM» 
 	«EXPAND toolUsage(self) FOREACH self.entries»
«ENDDEFINE»

«DEFINE toolUsage (gmfgen::ToolGroup group)  FOR gmfgen::ToolEntry-»
 	<predefinedEntry
          id=«IF id.isQuoted('\"')»«id»«ELSE»"«id»"«ENDIF»
          path="«group.id.getToolPath()»">
    </predefinedEntry>
«ENDDEFINE»

«DEFINE notationTypesMap FOR gmfgen::GenEditorGenerator»
	<extension point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping">
		<diagramMappings diagramID="«modelID»">
			<mapping type="«modelID»" humanReadableType="«modelID.replaceAll('Papyrus|UML|Diagram', '')»Diagram"/>
			«EXPAND compartmentToTypeMap FOREACH diagram.compartments»
			«EXPAND linksToTypeMap FOREACH diagram.links»
		</diagramMappings>
	</extension>
«ENDDEFINE»

«DEFINE linksToTypeMap FOR gmfgen::GenLink»
	«EXPAND linkLabelToTypeMap FOREACH labels»
«ENDDEFINE»

«DEFINE linkLabelToTypeMap FOR gmfgen::GenLinkLabel»«IF papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->exists(linkLabels->includes(self))»
	<mapping
		humanReadableType="«papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.linkLabels->includes(self))->asSequence()->first().role»"
		type="«visualID»">
	</mapping>
«ENDIF»«ENDDEFINE»

«DEFINE compartmentToTypeMap FOR gmfgen::GenCompartment»
	<mapping
		humanReadableType="«title.replaceAll('Compartment', '')»"
		type="«visualID»">
	</mapping>
«ENDDEFINE»








Back to the top