Skip to main content
summaryrefslogtreecommitdiffstats
blob: f976c7d5bd09aba438ab6a8d755128c0655034db (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
/*******************************************************************************
 * Copyright (c) 2011 Willink Transformations 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:
 *     E.D.Willink - initial API and implementation
 *
 * Run As->MWE2 Workflow to regenerate the editor.
 * If it fails with a stack dump, open the Xtext file and do
 * a dummy edit. Generally there is an error in the source file.
 *******************************************************************************/
module GenerateQVTcoreEditor

import org.eclipse.emf.mwe.utils.*
import org.eclipse.ocl.examples.build.*
import org.eclipse.ocl.examples.build.utilities.*
import org.eclipse.ocl.examples.build.xtend.*
import org.eclipse.xtext.generator.*
import org.eclipse.xtext.ui.generator.*

var QVTcore.file.extensions = "qvtc"
var QVTcoreProjectName = "org.eclipse.qvtd.xtext.qvtcore"
var QVTcoreRuntimeProject = "../../plugins/${QVTcoreProjectName}"

/**
 *	Generate the QVTcore Editor.
 */
Workflow {
    bean = StandaloneSetup {
		platformUri = "${QVTcoreRuntimeProject}/.."
   		scanClassPath = true
//		registerEcoreFile = "platform:/resource/org.eclipse.ocl.pivot/model/Pivot.ecore"
//		registerEcoreFile = "platform:/resource/org.eclipse.qvtd.pivot.qvtbase/model/QVTbase.ecore"
//		registerEcoreFile = "platform:/resource/org.eclipse.qvtd.pivot.qvtcorebase/model/QVTcoreBase.ecore"
//		registerEcoreFile = "platform:/resource/org.eclipse.qvtd.pivot.qvtcore/model/QVTcore.ecore"
//		registerEcoreFile = "platform:/resource/org.eclipse.ocl.xtext.base/model/BaseCS.ecore"
//		registerEcoreFile = "platform:/resource/org.eclipse.ocl.xtext.essentialocl/model/EssentialOCLCS.ecore"
//		registerEcoreFile = "platform:/resource/org.eclipse.qvtd.xtext.qvtcore/model/QVTcoreCS.ecore"
		registerGeneratedEPackage = "org.eclipse.qvtd.xtext.qvtcorecs.QVTcoreCSPackage"
		registerGenModelFile = "platform:/resource/org.eclipse.qvtd.xtext.qvtcore/model/QVTcoreCS.genmodel"
	}
	
	component = DirectoryCleaner {
		directory = "${QVTcoreRuntimeProject}/src-gen"
	}
	
	component = DirectoryCleaner {
		directory = "${QVTcoreRuntimeProject}.ui/src-gen"
	}
	
	component = Generator {
		fileHeader =
"/*******************************************************************************
 * Copyright (c) 2011, \${year} Willink Transformations 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:
 *     E.D.Willink - initial API and implementation
 *******************************************************************************/"
		pathRtProject = QVTcoreRuntimeProject
		pathUiProject = "${QVTcoreRuntimeProject}.ui"
		projectNameRt = QVTcoreProjectName
		projectNameUi = "${QVTcoreProjectName}.ui"
		mergeManifest = false

		language = {
			uri = "classpath:/org/eclipse/qvtd/xtext/qvtcore/QVTcore.xtext"
			fileExtensions = QVTcore.file.extensions
			
			// Java API to access grammar elements (required by several other fragments)
			fragment = grammarAccess.GrammarAccessFragment {}
			
			// generates Java API for the generated EPackages 
//			fragment = ecore.EcoreGeneratorFragment {
//				referencedGenModels = "platform:/resource/org.eclipse.emf.ecore/model/Ecore.genmodel"  
//				referencedGenModels = "platform:/resource/org.eclipse.ocl.xtext.essentialocl/model/EssentialOCLCST.genmodel"
//			}
			
			// the serialization component
			fragment = serializer.SerializerFragment {}
			
			// a custom ResourceFactory for use with EMF 
			fragment = resourceFactory.ResourceFactoryFragment {
				fileExtensions = QVTcore.file.extensions
			}
				
			// the following fragment tries to use the Antlr Generator fragment which can be installed via update manager from http://download.itemis.com/updates/
//			fragment = de.itemis.xtext.antlr.XtextAntlrGeneratorFragment {
//				options = { backtrack = true classSplitting = true }
//			}
			fragment = parser.antlr.XtextAntlrGeneratorFragment {
				options = { backtrack = true classSplitting = true }			
				antlrParam = "-Xconversiontimeout" antlrParam = "10000"
			}
			
			// check-based API for validation
			/*
			fragment = validation.CheckFragment {}
			*/
			 
			// java-based API for validation 
			fragment = validation.JavaValidatorFragment {
                composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
//                composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
            }
            
			// scoping and exporting API
			/*
			fragment = scoping.ImportURIScopingFragment {}
			fragment = exporting.SimpleNamesFragment {}
			*/
			
			// scoping and exporting API 
			fragment = scoping.ImportNamespacesScopingFragment {}
			fragment = exporting.QualifiedNamesFragment {}
			
			// formatter API 
			fragment = formatting.FormatterFragment {}

			// labeling API 
			fragment = labeling.LabelProviderFragment {}

			// outline API 
//			fragment = outline.TransformerFragment {}
//			fragment = outline.OutlineNodeAdapterFactoryFragment {}
			fragment = outline.OutlineTreeProviderFragment {}
			fragment = outline.QuickOutlineFragment {}

			// java-based API for content assistance 
			fragment = contentAssist.JavaBasedContentAssistFragment {}
						
//			fragment = de.itemis.xtext.antlr.XtextAntlrGeneratorFragment {
//				options = { backtrack = true classSplitting = true}
//			}
			fragment = parser.antlr.XtextAntlrUiGeneratorFragment {
				options = { backtrack = true classSplitting = true}			
				antlrParam = "-Xconversiontimeout" antlrParam = "10000"
			}

			fragment = builder.BuilderIntegrationFragment {}

			// project wizard (optional) 
			/*
			fragment = projectWizard.SimpleProjectWizardFragment {
				generatorProjectName = "${projectName}.generator" 
				modelFileExtension = file.extensions
			}
			*/
			
			// quickfix API 
			fragment = quickfix.QuickfixProviderFragment {}			
				
			// EssentialOCL bindings 
			fragment = fragments.EssentialOCLFragment {}							
			// Support Markup in Hover text 
			fragment = fragments.MarkupHoverFragment {}			
			// *.xtextbin support on Xtext 2.3		
			fragment = fragments.CompatibilityFragment {}			
		}
	}
	component = GenerateGrammarXtend {
		javaFolder = "${QVTcoreRuntimeProject}/src-gen"
		javaPackageName = "${QVTcoreProjectName}"
		grammarFileStem = "QVTcore"
	}
	component = ConvertToUnixLineEndings {
		directory = "${QVTcoreRuntimeProject}/src-gen"
	}
	component = ConvertToUnixLineEndings {
		directory = "${QVTcoreRuntimeProject}.ui/src-gen"
	}
}

Back to the top