Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: b4967d9cea6ef6c22d8e45cb4d369d5598be320d (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) 2007, 2010, 2013 Borland Software Corporation and others
 * 
 * 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:
 * Dmitry Stadnik (Borland) - initial API and implementation
 * Michael Golubev (Montages) - #386838 - migrate to Xtend2
 * Thibault Landre (Atos Origin) - initial API and implementation
 * 
 *****************************************************************************/
package aspects.xpt.diagram.preferences

import com.google.inject.Inject
import com.google.inject.Singleton
import org.eclipse.gmf.codegen.gmfgen.GenDiagram
import org.eclipse.gmf.codegen.gmfgen.GenStandardPreferencePage
import org.eclipse.gmf.codegen.gmfgen.StandardPreferencePages
import utils.PrefsConstant_qvto
import xpt.Common
import xpt.diagram.Utils_qvto

@Singleton class extensions extends xpt.diagram.preferences.extensions {
	@Inject extension Common;
	@Inject extension Utils_qvto;
	@Inject extension PrefsConstant_qvto;

	@Inject xpt.diagram.preferences.PreferenceInitializer xptPreferenceInitializer;

	override extensions(GenDiagram it) '''
		
		«tripleSpace(1)»<extension point="org.eclipse.core.runtime.preferences" id="prefs">
		«tripleSpace(2)»«xmlGeneratedTag»
		«tripleSpace(2)»<initializer class="«xptPreferenceInitializer.qualifiedClassName(it)»"/>
		«tripleSpace(1)»</extension>
		
		«IF ! it.preferencePages.empty»
			«tripleSpace(1)»<extension point="org.eclipse.ui.preferencePages" id="prefpages">
			«tripleSpace(2)»«xmlGeneratedTag»
			      «FOR pref : allPreferencePages(it)»
			      	«IF pref instanceof GenStandardPreferencePage»
					«papyrusPreferencePage(pref as GenStandardPreferencePage)»
				«ENDIF»
			«ENDFOR»
			«tripleSpace(1)»</extension>
		«ENDIF»
	'''

	def papyrusPreferencePage(GenStandardPreferencePage it) '''
		«IF StandardPreferencePages.GENERAL_LITERAL == kind»
		      <page
		            id="«getDiagramPreferencePageCategory()».«getDiagram().editorGen.modelID»"
		            name="«getDiagram().editorGen.modelID» Diagram"
		            category="«getDiagramPreferencePageCategory()»"
		            class="«getQualifiedClassName()»">
		      </page>
		      «ELSEIF StandardPreferencePages.PRINTING_LITERAL == kind ||
				StandardPreferencePages.RULERS_AND_GRID_LITERAL == kind»
		      <page
		            id="«getQualifiedClassName()»"
		            name="%prefpage.«ID»"
		            category="«getDiagramPreferencePageCategory()».«getDiagram().editorGen.modelID»"
		            class="«getQualifiedClassName()»">
		      </page>
		«ENDIF»
	'''

}

Back to the top