[generator] Corrected white space in code and templates

This commit is contained in:
Miro Spönemann 2016-01-21 16:45:30 +01:00
parent 2560e8f3f7
commit 1b4e4ac0fd
19 changed files with 108 additions and 108 deletions

View file

@ -219,7 +219,7 @@ package class ImplicitFragment extends AbstractStubGeneratingFragment {
definitionId="«name».Editor.opened">
</reference>
</visibleWhen>
</command>
</command>
</menuContribution>
<!-- copy qualified name -->
<menuContribution locationURI="popup:#TextEditorContext?after=copy">
@ -228,7 +228,7 @@ package class ImplicitFragment extends AbstractStubGeneratingFragment {
<visibleWhen checkEnabled="false">
<reference definitionId="«name».Editor.opened" />
</visibleWhen>
</command>
</command>
</menuContribution>
<menuContribution locationURI="menu:edit?after=copy">
<command commandId="org.eclipse.xtext.ui.editor.copyqualifiedname.EditorCopyQualifiedName"
@ -236,7 +236,7 @@ package class ImplicitFragment extends AbstractStubGeneratingFragment {
<visibleWhen checkEnabled="false">
<reference definitionId="«name».Editor.opened" />
</visibleWhen>
</command>
</command>
</menuContribution>
<menuContribution locationURI="popup:org.eclipse.xtext.ui.outline?after=additions">
<command commandId="org.eclipse.xtext.ui.editor.copyqualifiedname.OutlineCopyQualifiedName"

View file

@ -73,7 +73,7 @@ import java.util.List
OutlineTreeProviderFragment2 outline = new OutlineTreeProviderFragment2
QuickfixProviderFragment2 quickFixProvider = new QuickfixProviderFragment2
QuickfixProviderFragment2 quickFixProvider = new QuickfixProviderFragment2
ContentAssistFragment2 contentAssist = new ContentAssistFragment2

View file

@ -25,7 +25,7 @@ import org.eclipse.xtext.util.internal.Log
* @noreference
*/
@Log
class XtextGeneratorResourceSetInitializer {
class XtextGeneratorResourceSetInitializer {
public def void initialize(ResourceSet resourceSet, List<String> referencedResources) {
val delegate = new StandaloneSetup

View file

@ -251,7 +251,7 @@ class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment {
}
protected def String getEditDirectory() {
editDirectory ?: '/' + getEditPluginID + '/src'
editDirectory ?: '/' + getEditPluginID + '/src'
}
protected def String getEditorPluginID() {

View file

@ -94,7 +94,7 @@ import org.eclipse.xtext.util.internal.Log
'''
xtendFile.writeTo(projectConfig.runtime.src)
} else {
LOG.error(this.class.name + " has been configured to generate a Java stub, but that's not yet supported. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=481563")
LOG.error(this.class.name + " has been configured to generate a Java stub, but that's not yet supported. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=481563")
}
}

View file

@ -413,7 +413,7 @@ class GrammarAccessExtensions {
}
dispatch def String grammarElementIdentifier(AbstractElement it) {
containingRule.grammarElementIdentifier + '_' + gaElementIdentifier
containingRule.grammarElementIdentifier + '_' + gaElementIdentifier
}
dispatch def grammarElementAccess(EObject it) {
@ -468,7 +468,7 @@ class GrammarAccessExtensions {
dispatch def boolean predicated(RuleCall it) {
predicated || {
val group = rule.alternatives
val group = rule.alternatives
if (group instanceof Group) {
group.elements.head.predicated()
} else {

View file

@ -246,7 +246,7 @@ class IdeaPluginGenerator extends AbstractStubGeneratingFragment {
@«Override»
public «InputStream» getAntlrTokenFile() {
«ClassLoader» classLoader = getClass().getClassLoader();
return classLoader.getResourceAsStream("«grammar.tokens»");
return classLoader.getResourceAsStream("«grammar.tokens»");
}
}
''')
@ -257,7 +257,7 @@ class IdeaPluginGenerator extends AbstractStubGeneratingFragment {
<id>«grammar.ideaBasePackage»</id>
<name>«grammar.simpleName» Support</name>
<description>
This plugin enables smart editing of «grammar.simpleName» files.
This plugin enables smart editing of «grammar.simpleName» files.
</description>
<version>1.0.0</version>
<vendor>My Company</vendor>
@ -279,7 +279,7 @@ class IdeaPluginGenerator extends AbstractStubGeneratingFragment {
uri="«generatedMetamodel.EPackage.nsURI»"
class="«grammar.namespace».«generatedMetamodel.name».«generatedMetamodel.name.toFirstUpper»Package"
/>
«ENDFOR»
«ENDFOR»
<resourceFactory
type="«language.fileExtensions.head»"
class="org.eclipse.xtext.resource.IResourceFactory"
@ -315,7 +315,7 @@ class IdeaPluginGenerator extends AbstractStubGeneratingFragment {
«grammar.compileExtension('lang.psiStructureViewFactory', 'com.intellij.lang.PsiStructureViewFactory'.typeRef)»
<facetType implementation="«grammar.facetType»"/>
«grammar.compileExtension('lang.documentationProvider', 'org.eclipse.xtext.idea.documentation.IdeaDocumentationProvider'.typeRef)»
«grammar.compileExtension('lang.documentationProvider', 'org.eclipse.xtext.idea.documentation.IdeaDocumentationProvider'.typeRef)»
<colorSettingsPage implementation="«grammar.colorSettingsPage»"/>
<highlightVisitor implementation="«grammar.semanticHighlightVisitor»"/>
@ -597,14 +597,14 @@ class IdeaPluginGenerator extends AbstractStubGeneratingFragment {
«ENDIF»
@Override
public int getAntlrType(«iElementType» iElementType) {
return (iElementType instanceof «indexedElementType») ? ((«indexedElementType») iElementType).getLocalIndex() : «Token».INVALID_TOKEN_TYPE;
}
@Override
public «iElementType» getIElementType(int antlrType) {
return tokenTypes[antlrType];
}
public int getAntlrType(«iElementType» iElementType) {
return (iElementType instanceof «indexedElementType») ? ((«indexedElementType») iElementType).getLocalIndex() : «Token».INVALID_TOKEN_TYPE;
}
@Override
public «iElementType» getIElementType(int antlrType) {
return tokenTypes[antlrType];
}
@Override
public «tokenSet» getWhitespaceTokens() {
@ -632,10 +632,10 @@ class IdeaPluginGenerator extends AbstractStubGeneratingFragment {
public class «grammar.syntaxHighlighterFactory.simpleName» extends «lazySyntaxHighlighter» {
@Override
@«"org.jetbrains.annotations.NotNull".typeRef»
protected «syntaxHighlighter» createHighlighter() {
return «grammar.ideaLanguage».INSTANCE.getInstance(«syntaxHighlighter».class);
}
@«"org.jetbrains.annotations.NotNull".typeRef»
protected «syntaxHighlighter» createHighlighter() {
return «grammar.ideaLanguage».INSTANCE.getInstance(«syntaxHighlighter».class);
}
}
''')
}

View file

@ -74,7 +74,7 @@ class PsiAntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenerator
public «grammar.psiInternalParser.simpleName»(PsiBuilder builder, TokenStream input, «grammar.elementTypeProvider.simpleName» elementTypeProvider, «grammarAccess.simpleName» grammarAccess) {
this(input);
setPsiBuilder(builder);
this.grammarAccess = grammarAccess;
this.grammarAccess = grammarAccess;
this.elementTypeProvider = elementTypeProvider;
}

View file

@ -55,7 +55,7 @@ class Junit4Fragment2 extends AbstractStubGeneratingFragment {
generateInjectorProvider.writeTo(projectConfig.runtimeTest.srcGen)
if (isGenerateStub)
generateExampleRuntimeTest.writeTo(projectConfig.runtimeTest.src)
if(projectConfig.eclipsePlugin.srcGen !== null)
if (projectConfig.eclipsePlugin.srcGen !== null)
generateUiInjectorProvider.writeTo(projectConfig.eclipsePluginTest.srcGen)
}
@ -73,7 +73,7 @@ class Junit4Fragment2 extends AbstractStubGeneratingFragment {
class «exampleRuntimeTest»{
@«Inject»
«parseHelper»<«rootType»> parseHelper;
«parseHelper»<«rootType»> parseHelper
@«test»
def void loadModel() {

View file

@ -326,8 +326,8 @@ public class AntlrGrammarGenUtil {
}
};
AbstractElement clone = (AbstractElement) copier.copy(result);
copier.copyReferences();
return clone;
copier.copyReferences();
return clone;
}
return doGetPredicatedElement(element);
}
@ -377,8 +377,8 @@ public class AntlrGrammarGenUtil {
}
};
AbstractElement clone = (AbstractElement) copier.copy(element);
copier.copyReferences();
return clone;
copier.copyReferences();
return clone;
}
return element;
}

View file

@ -155,7 +155,7 @@ class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment2 {
val lexerOutputDir = lexerGrammarFile.substring(0, lexerGrammarFile.lastIndexOf('/'))
lexerAntlrParams += lexerOutputDir
if (!isCombinedGrammar) {
antlrTool.runWithEncodingAndParams(lexerGrammarFile, encoding, lexerAntlrParams)
antlrTool.runWithEncodingAndParams(lexerGrammarFile, encoding, lexerAntlrParams)
cleanupLexerTokensFile(lexerGrammar, KeywordHelper.getHelper(grammar), fsa)
}
@ -167,7 +167,7 @@ class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment2 {
parserAntlrParams += "-lib"
parserAntlrParams += lexerOutputDir
}
antlrTool.runWithEncodingAndParams(parserGrammarFile, encoding, parserAntlrParams)
antlrTool.runWithEncodingAndParams(parserGrammarFile, encoding, parserAntlrParams)
if (!isCombinedGrammar) {
cleanupParserTokensFile(lexerGrammar, parserGrammar, KeywordHelper.getHelper(grammar), fsa)
}

View file

@ -138,12 +138,12 @@ public class AntlrCodeQualityHelper {
}
private static <K, V> V putIfAbsent(Map<K, V> map, K key, V value) {
V v = map.get(key);
if (v == null) {
v = map.put(key, value);
}
return v;
}
V v = map.get(key);
if (v == null) {
v = map.put(key, value);
}
return v;
}
private static final Pattern dfaPattern = Pattern.compile(
"static final short\\[]\\[] (DFA\\d+_transition);\\s+static \\{[^{]*\\{[^}]*\\}[^}]*\\}", Pattern.DOTALL);

View file

@ -51,10 +51,10 @@ class ResourceFactoryFragment2 extends AbstractXtextGeneratorFragment {
</parser>
</extension>
<extension point="org.eclipse.xtext.extension_resourceServiceProvider">
<resourceServiceProvider
class="«grammar.eclipsePluginExecutableExtensionFactory»:org.eclipse.xtext.ui.resource.IResourceUIServiceProvider"
uriExtension="«fileExtension»">
</resourceServiceProvider>
<resourceServiceProvider
class="«grammar.eclipsePluginExecutableExtensionFactory»:org.eclipse.xtext.ui.resource.IResourceUIServiceProvider"
uriExtension="«fileExtension»">
</resourceServiceProvider>
</extension>
«ENDFOR»
'''

View file

@ -147,7 +147,7 @@ class ContentAssistFragment2 extends AbstractInheritingFragment {
// determine the (remaining) rules that are not excluded and not handled yet
val remainingRules = grammar.rules.fold(<AbstractRule>newArrayList()) [candidates, rule |
val fqnFeatureName = rule.FQFeatureName
val fqnFeatureName = rule.FQFeatureName
if (!processedNames.contains(fqnFeatureName) && !excludedFqnFeatureNames.contains(fqnFeatureName)) {
processedNames += fqnFeatureName
candidates += rule
@ -178,15 +178,15 @@ class ContentAssistFragment2 extends AbstractInheritingFragment {
«IF !assignments.empty»
«FOR assignment : assignments»
«assignment.handleAssignment»
«ENDFOR»
«ENDFOR»
«ENDIF»
«ENDIF»
«FOR rule : remainingRules»
public void complete«rule.FQFeatureName»(«EObject» model, «RuleCall» ruleCall, «
contentAssistContextClass» context, «ICompletionProposalAcceptorClass» acceptor) {
// subclasses may override
}
«ENDFOR»
«ENDFOR»
}
'''
writeTo(projectConfig.eclipsePlugin.srcGen)
@ -243,7 +243,7 @@ class ContentAssistFragment2 extends AbstractInheritingFragment {
// subclasses may override
'''
private def dispatch StringConcatenationClient assignmentTerminal(CrossReference element, StringConcatenationClient accessor) '''
private def dispatch StringConcatenationClient assignmentTerminal(CrossReference element, StringConcatenationClient accessor) '''
lookupCrossReference(((«CrossReference»)«accessor»), context, acceptor);
'''

View file

@ -208,12 +208,12 @@ class LabelProviderFragment2 extends AbstractStubGeneratingFragment {
// Labels and icons can be computed like this:
// String text(IEObjectDescription ele) {
// return ele.getName().toString();
// return ele.getName().toString();
// }
//
// String image(IEObjectDescription ele) {
// return ele.getEClass().getName() + ".gif";
// }
// String image(IEObjectDescription ele) {
// return ele.getEClass().getName() + ".gif";
// }
}
''').writeTo(projectConfig.eclipsePlugin.src)
}

View file

@ -157,34 +157,34 @@ class QuickfixProviderFragment2 extends AbstractInheritingFragment {
val executableExtensionFactory = grammar.eclipsePluginExecutableExtensionFactory
projectConfig.eclipsePlugin.pluginXml.entries += '''
<!-- quickfix marker resolution generator for «grammar.name» -->
<extension
point="org.eclipse.ui.ide.markerResolution">
<markerResolutionGenerator
class="«executableExtensionFactory»:org.eclipse.xtext.ui.editor.quickfix.MarkerResolutionGenerator"
markerType="«markerTypePrefix».check.fast">
<attribute
name="FIXABLE_KEY"
value="true">
</attribute>
</markerResolutionGenerator>
<markerResolutionGenerator
class="«executableExtensionFactory»:org.eclipse.xtext.ui.editor.quickfix.MarkerResolutionGenerator"
markerType="«markerTypePrefix».check.normal">
<attribute
name="FIXABLE_KEY"
value="true">
</attribute>
</markerResolutionGenerator>
<markerResolutionGenerator
class="«executableExtensionFactory»:org.eclipse.xtext.ui.editor.quickfix.MarkerResolutionGenerator"
markerType="«markerTypePrefix».check.expensive">
<attribute
name="FIXABLE_KEY"
value="true">
</attribute>
</markerResolutionGenerator>
</extension>
<!-- quickfix marker resolution generator for «grammar.name» -->
<extension
point="org.eclipse.ui.ide.markerResolution">
<markerResolutionGenerator
class="«executableExtensionFactory»:org.eclipse.xtext.ui.editor.quickfix.MarkerResolutionGenerator"
markerType="«markerTypePrefix».check.fast">
<attribute
name="FIXABLE_KEY"
value="true">
</attribute>
</markerResolutionGenerator>
<markerResolutionGenerator
class="«executableExtensionFactory»:org.eclipse.xtext.ui.editor.quickfix.MarkerResolutionGenerator"
markerType="«markerTypePrefix».check.normal">
<attribute
name="FIXABLE_KEY"
value="true">
</attribute>
</markerResolutionGenerator>
<markerResolutionGenerator
class="«executableExtensionFactory»:org.eclipse.xtext.ui.editor.quickfix.MarkerResolutionGenerator"
markerType="«markerTypePrefix».check.expensive">
<attribute
name="FIXABLE_KEY"
value="true">
</attribute>
</markerResolutionGenerator>
</extension>
'''
}
}

View file

@ -85,7 +85,7 @@ class ValidatorFragment2 extends AbstractInheritingFragment {
*/
class «grammar.validatorClass.simpleName» extends «grammar.abstractValidatorClass» {
// public static val INVALID_NAME = 'invalidName'
// public static val INVALID_NAME = 'invalidName'
//
// @Check
// def checkGreetingStartsWithCapital(Greeting greeting) {
@ -109,7 +109,7 @@ class ValidatorFragment2 extends AbstractInheritingFragment {
*/
public class «grammar.validatorClass.simpleName» extends «grammar.abstractValidatorClass» {
// public static final INVALID_NAME = 'invalidName'
// public static final INVALID_NAME = 'invalidName'
//
// @Check
// public void checkGreetingStartsWithCapital(Greeting greeting) {
@ -140,13 +140,13 @@ class ValidatorFragment2 extends AbstractInheritingFragment {
@Override
protected «List»<«EPackage»> getEPackages() {
«List»<«EPackage»> result = new «ArrayList»<«EPackage»>(«IF inheritImplementation && grammar.nonTerminalsSuperGrammar !== null»super.getEPackages()«ENDIF»);
«FOR e: generatedPackagesToValidate»
result.add(«e.generatedEPackageName».eINSTANCE);
«ENDFOR»
«FOR e: registryPackagesToValidate»
result.add(EPackage.Registry.INSTANCE.getEPackage("«e.nsURI»"));
«ENDFOR»
«List»<«EPackage»> result = new «ArrayList»<«EPackage»>(«IF inheritImplementation && grammar.nonTerminalsSuperGrammar !== null»super.getEPackages()«ENDIF»);
«FOR e: generatedPackagesToValidate»
result.add(«e.generatedEPackageName».eINSTANCE);
«ENDFOR»
«FOR e: registryPackagesToValidate»
result.add(EPackage.Registry.INSTANCE.getEPackage("«e.nsURI»"));
«ENDFOR»
return result;
}

View file

@ -673,15 +673,15 @@ class WebIntegrationFragment extends AbstractXtextGeneratorFragment {
/* For all elements of type Greeting or its subtypes */
/*
.Greeting-icon {
background-image: url('images/Greeting.gif');
}
background-image: url('images/Greeting.gif');
}
*/
/* Only in hovers */
/*
.xtext-hover .Greeting-icon {
background-image: url('images/Greeting.gif');
}
background-image: url('images/Greeting.gif');
}
*/
«ENDIF»
'''

View file

@ -194,9 +194,9 @@ class XbaseGeneratorFragment2 extends AbstractXtextGeneratorFragment {
*/
class «jvmModelInferrer.simpleName» extends «'org.eclipse.xtext.xbase.jvmmodel.AbstractModelInferrer'.typeRef» {
/**
* convenience API to build and initialize JVM types and their members.
*/
/**
* convenience API to build and initialize JVM types and their members.
*/
@«Inject» extension «'org.eclipse.xtext.xbase.jvmmodel.JvmTypesBuilder'.typeRef»
/**
@ -228,15 +228,15 @@ class XbaseGeneratorFragment2 extends AbstractXtextGeneratorFragment {
// Here you explain how your model is mapped to Java elements, by writing the actual translation code.
// An implementation for the initial hello world example could look like this:
// acceptor.accept(element.toClass("my.company.greeting.MyGreetings")) [
// for (greeting : element.greetings) {
// members += greeting.toMethod("hello" + greeting.name, typeRef(String)) [
// body = «"'''"»
// return "Hello «'«'»greeting.name«'»'»";
// «"'''"»
// ]
// }
// ]
// acceptor.accept(element.toClass("my.company.greeting.MyGreetings")) [
// for (greeting : element.greetings) {
// members += greeting.toMethod("hello" + greeting.name, typeRef(String)) [
// body = «"'''"»
// return "Hello «'«'»greeting.name«'»'»";
// «"'''"»
// ]
// }
// ]
}
}
''').writeTo(projectConfig.runtime.src)
@ -291,7 +291,7 @@ class XbaseGeneratorFragment2 extends AbstractXtextGeneratorFragment {
definitionId="«name».Editor.opened">
</reference>
</visibleWhen>
</command>
</command>
</menuContribution>
«ENDIF»
<menuContribution
@ -412,7 +412,7 @@ class XbaseGeneratorFragment2 extends AbstractXtextGeneratorFragment {
</visibleWhen>
</command>
</menuContribution>
</extension>
</extension>
<!-- Open implementation -->
<extension point="org.eclipse.ui.handlers">
<handler