Search in sources :

Example 86 with TypeReference

use of org.eclipse.xtext.xtext.generator.model.TypeReference in project xtext-core by eclipse.

the class ResourceDescriptionStrategyFragment method generateResourceDescriptionStrategyStub.

protected void generateResourceDescriptionStrategyStub(final Iterable<AbstractRule> exportedRules) {
    if ((this.isGenerateStub() || this.isGenerateXtendStub())) {
        TypeReference _stubResourceDescriptionStrategyClass = this.getStubResourceDescriptionStrategyClass();
        StringConcatenationClient _client = new StringConcatenationClient() {

            @Override
            protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
                _builder.append("public class ");
                String _simpleName = ResourceDescriptionStrategyFragment.this.getStubResourceDescriptionStrategyClass().getSimpleName();
                _builder.append(_simpleName);
                _builder.append(" extends ");
                TypeReference _abstractResourceDescriptionStrategyClass = ResourceDescriptionStrategyFragment.this.getAbstractResourceDescriptionStrategyClass();
                _builder.append(_abstractResourceDescriptionStrategyClass);
                _builder.append("{");
                _builder.newLineIfNotEmpty();
                _builder.newLine();
                _builder.append("}");
                _builder.newLine();
            }
        };
        this.fileAccessFactory.createJavaFile(_stubResourceDescriptionStrategyClass, _client).writeTo(this.getProjectConfig().getRuntime().getSrc());
    } else {
        boolean _isGenerateXtendStub = this.isGenerateXtendStub();
        if (_isGenerateXtendStub) {
            TypeReference _stubResourceDescriptionStrategyClass_1 = this.getStubResourceDescriptionStrategyClass();
            StringConcatenationClient _client_1 = new StringConcatenationClient() {

                @Override
                protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
                    _builder.append("class ");
                    TypeReference _stubResourceDescriptionStrategyClass = ResourceDescriptionStrategyFragment.this.getStubResourceDescriptionStrategyClass();
                    _builder.append(_stubResourceDescriptionStrategyClass);
                    _builder.append(" extends ");
                    TypeReference _abstractResourceDescriptionStrategyClass = ResourceDescriptionStrategyFragment.this.getAbstractResourceDescriptionStrategyClass();
                    _builder.append(_abstractResourceDescriptionStrategyClass);
                    _builder.append("{");
                    _builder.newLineIfNotEmpty();
                    _builder.newLine();
                    _builder.append("}");
                    _builder.newLine();
                }
            };
            this.fileAccessFactory.createXtendFile(_stubResourceDescriptionStrategyClass_1, _client_1).writeTo(this.getProjectConfig().getRuntime().getSrc());
        }
    }
}
Also used : StringConcatenationClient(org.eclipse.xtend2.lib.StringConcatenationClient) TypeReference(org.eclipse.xtext.xtext.generator.model.TypeReference)

Example 87 with TypeReference

use of org.eclipse.xtext.xtext.generator.model.TypeReference in project xtext-core by eclipse.

the class ResourceDescriptionStrategyFragment method generateResourceDescriptionStrategy.

protected JavaFileAccess generateResourceDescriptionStrategy(final Iterable<AbstractRule> exportedRules) {
    TypeReference _abstractResourceDescriptionStrategyClass = this.getAbstractResourceDescriptionStrategyClass();
    StringConcatenationClient _client = new StringConcatenationClient() {

        @Override
        protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
            _builder.append("public class ");
            String _simpleName = ResourceDescriptionStrategyFragment.this.getSuperTypeRef().getSimpleName();
            _builder.append(_simpleName);
            _builder.append(" extends ");
            TypeReference _resourceDescriptionSuperClass = ResourceDescriptionStrategyFragment.this.getResourceDescriptionSuperClass();
            _builder.append(_resourceDescriptionSuperClass);
            _builder.append(" {");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append("public boolean createEObjectDescriptions(");
            _builder.append(EObject.class, "\t");
            _builder.append(" eObject, ");
            _builder.append(IAcceptor.class, "\t");
            _builder.append("<");
            _builder.append(IEObjectDescription.class, "\t");
            _builder.append("> acceptor) {");
            _builder.newLineIfNotEmpty();
            {
                for (final AbstractRule exportedRule : exportedRules) {
                    _builder.append("\t\t");
                    _builder.append("if(eObject instanceof ");
                    EClassifier _classifier = exportedRule.getType().getClassifier();
                    ResourceSet _resourceSet = ResourceDescriptionStrategyFragment.this.getGrammar().eResource().getResourceSet();
                    TypeReference _typeReference = new TypeReference(((EClass) _classifier), _resourceSet);
                    _builder.append(_typeReference, "\t\t");
                    _builder.append(") {");
                    _builder.newLineIfNotEmpty();
                    _builder.append("\t\t");
                    _builder.append("\t");
                    _builder.append("return createEObjectDescriptionsFor");
                    String _name = exportedRule.getType().getClassifier().getName();
                    _builder.append(_name, "\t\t\t");
                    _builder.append("(eObject, acceptor);");
                    _builder.newLineIfNotEmpty();
                    _builder.append("\t\t");
                    _builder.append("}");
                    _builder.newLine();
                }
            }
            _builder.append("\t\t");
            _builder.append("return true;");
            _builder.newLine();
            _builder.append("\t");
            _builder.append("}");
            _builder.newLine();
            _builder.newLine();
            {
                for (final AbstractRule exportedRule_1 : exportedRules) {
                    _builder.append("\t");
                    _builder.append("protected boolean createEObjectDescriptionsFor");
                    String _name_1 = exportedRule_1.getType().getClassifier().getName();
                    _builder.append(_name_1, "\t");
                    _builder.append("(");
                    _builder.append(EObject.class, "\t");
                    _builder.append(" eObject, ");
                    _builder.append(IAcceptor.class, "\t");
                    _builder.append("<");
                    _builder.append(IEObjectDescription.class, "\t");
                    _builder.append("> acceptor) {");
                    _builder.newLineIfNotEmpty();
                    _builder.append("\t");
                    _builder.append("\t");
                    _builder.append("return super.createEObjectDescriptions(eObject, acceptor);");
                    _builder.newLine();
                    _builder.append("\t");
                    _builder.append("}");
                    _builder.newLine();
                }
            }
            _builder.append("}");
            _builder.newLine();
        }
    };
    return this.fileAccessFactory.createJavaFile(_abstractResourceDescriptionStrategyClass, _client);
}
Also used : StringConcatenationClient(org.eclipse.xtend2.lib.StringConcatenationClient) EObject(org.eclipse.emf.ecore.EObject) IAcceptor(org.eclipse.xtext.util.IAcceptor) EClassifier(org.eclipse.emf.ecore.EClassifier) TypeReference(org.eclipse.xtext.xtext.generator.model.TypeReference) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) AbstractRule(org.eclipse.xtext.AbstractRule) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription)

Example 88 with TypeReference

use of org.eclipse.xtext.xtext.generator.model.TypeReference in project xtext-core by eclipse.

the class Junit4Fragment2 method generateExampleRuntimeTest.

protected JavaFileAccess generateExampleRuntimeTest() {
    String _testingPackage = this.getTestingPackage();
    String _plus = (_testingPackage + ".XtextRunner");
    final TypeReference xtextRunner = new TypeReference(_plus);
    final TypeReference runWith = new TypeReference("org.junit.runner.RunWith");
    String _testingPackage_1 = this.getTestingPackage();
    String _plus_1 = (_testingPackage_1 + ".InjectWith");
    final TypeReference injectWith = new TypeReference(_plus_1);
    String _testingPackage_2 = this.getTestingPackage();
    String _plus_2 = (_testingPackage_2 + ".util.ParseHelper");
    final TypeReference parseHelper = new TypeReference(_plus_2);
    final TypeReference test = new TypeReference("org.junit.Test");
    final TypeReference assert_ = new TypeReference("org.junit.Assert");
    EClassifier _classifier = IterableExtensions.<AbstractRule>head(this.getGrammar().getRules()).getType().getClassifier();
    ResourceSet _resourceSet = this.getGrammar().eResource().getResourceSet();
    final TypeReference rootType = new TypeReference(((EClass) _classifier), _resourceSet);
    TypeReference _exampleRuntimeTest = this.exampleRuntimeTest();
    StringConcatenationClient _client = new StringConcatenationClient() {

        @Override
        protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
            _builder.append("@");
            _builder.append(runWith);
            _builder.append("(");
            _builder.append(xtextRunner);
            _builder.append(")");
            _builder.newLineIfNotEmpty();
            _builder.append("@");
            _builder.append(injectWith);
            _builder.append("(");
            TypeReference _injectorProvider = Junit4Fragment2.this.injectorProvider();
            _builder.append(_injectorProvider);
            _builder.append(")");
            _builder.newLineIfNotEmpty();
            _builder.append("class ");
            TypeReference _exampleRuntimeTest = Junit4Fragment2.this.exampleRuntimeTest();
            _builder.append(_exampleRuntimeTest);
            _builder.append(" {");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append("@");
            _builder.append(Inject.class, "\t");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append(parseHelper, "\t");
            _builder.append("<");
            _builder.append(rootType, "\t");
            _builder.append("> parseHelper");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.newLine();
            _builder.append("\t");
            _builder.append("@");
            _builder.append(test, "\t");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append("def void loadModel() {");
            _builder.newLine();
            _builder.append("\t\t");
            _builder.append("val result = parseHelper.parse(\'\'");
            _builder.append("\'");
            _builder.newLine();
            _builder.append("\t\t\t");
            _builder.append("Hello Xtext!");
            _builder.newLine();
            _builder.append("\t\t");
            _builder.append("\'\'");
            _builder.append("\')");
            _builder.newLine();
            _builder.append("\t\t");
            _builder.append(assert_, "\t\t");
            _builder.append(".assertNotNull(result)");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t");
            _builder.append("val errors = result.eResource.errors");
            _builder.newLine();
            _builder.append("\t\t");
            _builder.append(assert_, "\t\t");
            _builder.append(".assertTrue(\'\'");
            _builder.append("\'Unexpected errors: ");
            _builder.append("�", "\t\t");
            _builder.append("errors.join(\", \")");
            _builder.append("�", "\t\t");
            _builder.append("\'\'");
            _builder.append("\', errors.isEmpty)");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append("}");
            _builder.newLine();
            _builder.append("}");
            _builder.newLine();
        }
    };
    return this.fileAccessFactory.createXtendFile(_exampleRuntimeTest, _client);
}
Also used : EClass(org.eclipse.emf.ecore.EClass) StringConcatenationClient(org.eclipse.xtend2.lib.StringConcatenationClient) EClassifier(org.eclipse.emf.ecore.EClassifier) TypeReference(org.eclipse.xtext.xtext.generator.model.TypeReference) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) AbstractRule(org.eclipse.xtext.AbstractRule)

Example 89 with TypeReference

use of org.eclipse.xtext.xtext.generator.model.TypeReference in project xtext-core by eclipse.

the class CodeConfig method getAnnotationImportsAsString.

public String getAnnotationImportsAsString() {
    boolean _isEmpty = this.classAnnotations.isEmpty();
    if (_isEmpty) {
        return null;
    }
    final StringBuilder stringBuilder = new StringBuilder();
    for (final IClassAnnotation annotation : this.classAnnotations) {
        {
            final TypeReference importString = annotation.getAnnotationImport();
            if ((importString != null)) {
                stringBuilder.append("import ").append(importString).append(";").append(Strings.newLine());
            }
        }
    }
    return stringBuilder.toString();
}
Also used : IClassAnnotation(org.eclipse.xtext.xtext.generator.model.annotations.IClassAnnotation) TypeReference(org.eclipse.xtext.xtext.generator.model.TypeReference)

Example 90 with TypeReference

use of org.eclipse.xtext.xtext.generator.model.TypeReference in project xtext-core by eclipse.

the class ImplicitFragment method getImplicitPluginXmlEnties.

public CharSequence getImplicitPluginXmlEnties(final Grammar it) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("<extension");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("point=\"org.eclipse.ui.editors\">");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<editor");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("class=\"");
    TypeReference _eclipsePluginExecutableExtensionFactory = this.naming.getEclipsePluginExecutableExtensionFactory(it);
    _builder.append(_eclipsePluginExecutableExtensionFactory, "\t\t");
    _builder.append(":org.eclipse.xtext.ui.editor.XtextEditor\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("contributorClass=\"org.eclipse.ui.editors.text.TextEditorActionContributor\"");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("default=\"true\"");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("extensions=\"");
    String _join = IterableExtensions.join(this.getLanguage().getFileExtensions(), ",");
    _builder.append(_join, "\t\t");
    _builder.append("\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("id=\"");
    String _name = it.getName();
    _builder.append(_name, "\t\t");
    _builder.append("\"");
    _builder.newLineIfNotEmpty();
    {
        boolean _inheritsXbase = this._xbaseUsageDetector.inheritsXbase(this.getGrammar());
        if (_inheritsXbase) {
            _builder.append("\t\t");
            _builder.append("matchingStrategy=\"");
            TypeReference _eclipsePluginExecutableExtensionFactory_1 = this.naming.getEclipsePluginExecutableExtensionFactory(it);
            _builder.append(_eclipsePluginExecutableExtensionFactory_1, "\t\t");
            _builder.append(":org.eclipse.xtext.xbase.ui.editor.JavaEditorInputMatcher\"");
            _builder.newLineIfNotEmpty();
        }
    }
    _builder.append("\t\t");
    _builder.append("name=\"");
    String _simpleName = GrammarUtil.getSimpleName(it);
    _builder.append(_simpleName, "\t\t");
    _builder.append(" Editor\">");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("</editor>");
    _builder.newLine();
    _builder.append("</extension>");
    _builder.newLine();
    _builder.append("<extension");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("point=\"org.eclipse.ui.handlers\">");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<handler");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("class=\"");
    TypeReference _eclipsePluginExecutableExtensionFactory_2 = this.naming.getEclipsePluginExecutableExtensionFactory(it);
    _builder.append(_eclipsePluginExecutableExtensionFactory_2, "\t\t");
    _builder.append(":org.eclipse.xtext.ui.editor.hyperlinking.OpenDeclarationHandler\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("commandId=\"org.eclipse.xtext.ui.editor.hyperlinking.OpenDeclaration\">");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<activeWhen>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<reference");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("definitionId=\"");
    String _name_1 = it.getName();
    _builder.append(_name_1, "\t\t\t\t");
    _builder.append(".Editor.opened\">");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t\t");
    _builder.append("</reference>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("</activeWhen>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</handler>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<handler");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("class=\"");
    TypeReference _eclipsePluginExecutableExtensionFactory_3 = this.naming.getEclipsePluginExecutableExtensionFactory(it);
    _builder.append(_eclipsePluginExecutableExtensionFactory_3, "\t\t");
    _builder.append(":org.eclipse.xtext.ui.editor.handler.ValidateActionHandler\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("commandId=\"");
    String _name_2 = it.getName();
    _builder.append(_name_2, "\t\t");
    _builder.append(".validate\">");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("<activeWhen>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<reference");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("definitionId=\"");
    String _name_3 = it.getName();
    _builder.append(_name_3, "\t\t\t\t");
    _builder.append(".Editor.opened\">");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("</reference>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</activeWhen>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</handler>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<!-- copy qualified name -->");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<handler");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("class=\"");
    TypeReference _eclipsePluginExecutableExtensionFactory_4 = this.naming.getEclipsePluginExecutableExtensionFactory(it);
    _builder.append(_eclipsePluginExecutableExtensionFactory_4, "\t\t");
    _builder.append(":org.eclipse.xtext.ui.editor.copyqualifiedname.EditorCopyQualifiedNameHandler\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("commandId=\"org.eclipse.xtext.ui.editor.copyqualifiedname.EditorCopyQualifiedName\">");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<activeWhen>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<reference definitionId=\"");
    String _name_4 = it.getName();
    _builder.append(_name_4, "\t\t\t");
    _builder.append(".Editor.opened\" />");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("</activeWhen>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</handler>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<handler");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("class=\"");
    TypeReference _eclipsePluginExecutableExtensionFactory_5 = this.naming.getEclipsePluginExecutableExtensionFactory(it);
    _builder.append(_eclipsePluginExecutableExtensionFactory_5, "\t\t");
    _builder.append(":org.eclipse.xtext.ui.editor.copyqualifiedname.OutlineCopyQualifiedNameHandler\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("commandId=\"org.eclipse.xtext.ui.editor.copyqualifiedname.OutlineCopyQualifiedName\">");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<activeWhen>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<and>");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("<reference definitionId=\"");
    String _name_5 = it.getName();
    _builder.append(_name_5, "\t\t\t\t");
    _builder.append(".XtextEditor.opened\" />");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t\t\t");
    _builder.append("<iterate>");
    _builder.newLine();
    _builder.append("\t\t\t\t\t");
    _builder.append("<adapt type=\"org.eclipse.xtext.ui.editor.outline.IOutlineNode\" />");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("</iterate>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("</and>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("</activeWhen>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</handler>");
    _builder.newLine();
    _builder.append("</extension>");
    _builder.newLine();
    _builder.append("<extension point=\"org.eclipse.core.expressions.definitions\">");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<definition id=\"");
    String _name_6 = it.getName();
    _builder.append(_name_6, "\t");
    _builder.append(".Editor.opened\">");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("<and>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<reference definitionId=\"isActiveEditorAnInstanceOfXtextEditor\"/>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<with variable=\"activeEditor\">");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("<test property=\"org.eclipse.xtext.ui.editor.XtextEditor.languageName\"");
    _builder.newLine();
    _builder.append("\t\t\t\t\t");
    _builder.append("value=\"");
    String _name_7 = it.getName();
    _builder.append(_name_7, "\t\t\t\t\t");
    _builder.append("\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t\t\t\t");
    _builder.append("forcePluginActivation=\"true\"/>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("</with>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("</and>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</definition>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<definition id=\"");
    String _name_8 = it.getName();
    _builder.append(_name_8, "\t");
    _builder.append(".XtextEditor.opened\">");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("<and>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<reference definitionId=\"isXtextEditorActive\"/>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<with variable=\"activeEditor\">");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("<test property=\"org.eclipse.xtext.ui.editor.XtextEditor.languageName\"");
    _builder.newLine();
    _builder.append("\t\t\t\t\t");
    _builder.append("value=\"");
    String _name_9 = it.getName();
    _builder.append(_name_9, "\t\t\t\t\t");
    _builder.append("\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t\t\t\t");
    _builder.append("forcePluginActivation=\"true\"/>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("</with>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("</and>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</definition>");
    _builder.newLine();
    _builder.append("</extension>");
    _builder.newLine();
    _builder.append("<extension");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("point=\"org.eclipse.ui.preferencePages\">");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<page");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("class=\"");
    TypeReference _eclipsePluginExecutableExtensionFactory_6 = this.naming.getEclipsePluginExecutableExtensionFactory(it);
    _builder.append(_eclipsePluginExecutableExtensionFactory_6, "\t\t");
    _builder.append(":org.eclipse.xtext.ui.editor.preferences.LanguageRootPreferencePage\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("id=\"");
    String _name_10 = it.getName();
    _builder.append(_name_10, "\t\t");
    _builder.append("\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("name=\"");
    String _simpleName_1 = GrammarUtil.getSimpleName(it);
    _builder.append(_simpleName_1, "\t\t");
    _builder.append("\">");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("<keywordReference id=\"");
    String _namespace = GrammarUtil.getNamespace(it);
    String _plus = (_namespace + ".ui.keyword_");
    String _simpleName_2 = GrammarUtil.getSimpleName(it);
    String _plus_1 = (_plus + _simpleName_2);
    _builder.append(_plus_1, "\t\t");
    _builder.append("\"/>");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("</page>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<page");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("category=\"");
    String _name_11 = it.getName();
    _builder.append(_name_11, "\t\t");
    _builder.append("\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("class=\"");
    TypeReference _eclipsePluginExecutableExtensionFactory_7 = this.naming.getEclipsePluginExecutableExtensionFactory(it);
    _builder.append(_eclipsePluginExecutableExtensionFactory_7, "\t\t");
    _builder.append(":org.eclipse.xtext.ui.editor.syntaxcoloring.SyntaxColoringPreferencePage\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("id=\"");
    String _name_12 = it.getName();
    _builder.append(_name_12, "\t\t");
    _builder.append(".coloring\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("name=\"Syntax Coloring\">");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<keywordReference id=\"");
    String _namespace_1 = GrammarUtil.getNamespace(it);
    String _plus_2 = (_namespace_1 + ".ui.keyword_");
    String _simpleName_3 = GrammarUtil.getSimpleName(it);
    String _plus_3 = (_plus_2 + _simpleName_3);
    _builder.append(_plus_3, "\t\t");
    _builder.append("\"/>");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("</page>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<page");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("category=\"");
    String _name_13 = it.getName();
    _builder.append(_name_13, "\t\t");
    _builder.append("\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("class=\"");
    TypeReference _eclipsePluginExecutableExtensionFactory_8 = this.naming.getEclipsePluginExecutableExtensionFactory(it);
    _builder.append(_eclipsePluginExecutableExtensionFactory_8, "\t\t");
    _builder.append(":org.eclipse.xtext.ui.editor.templates.XtextTemplatePreferencePage\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("id=\"");
    String _name_14 = it.getName();
    _builder.append(_name_14, "\t\t");
    _builder.append(".templates\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("name=\"Templates\">");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<keywordReference id=\"");
    String _namespace_2 = GrammarUtil.getNamespace(it);
    String _plus_4 = (_namespace_2 + ".ui.keyword_");
    String _simpleName_4 = GrammarUtil.getSimpleName(it);
    String _plus_5 = (_plus_4 + _simpleName_4);
    _builder.append(_plus_5, "\t\t");
    _builder.append("\"/>");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("</page>");
    _builder.newLine();
    _builder.append("</extension>");
    _builder.newLine();
    _builder.append("<extension");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("point=\"org.eclipse.ui.propertyPages\">");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<page");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("class=\"");
    TypeReference _eclipsePluginExecutableExtensionFactory_9 = this.naming.getEclipsePluginExecutableExtensionFactory(it);
    _builder.append(_eclipsePluginExecutableExtensionFactory_9, "\t\t");
    _builder.append(":org.eclipse.xtext.ui.editor.preferences.LanguageRootPreferencePage\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("id=\"");
    String _name_15 = it.getName();
    _builder.append(_name_15, "\t\t");
    _builder.append("\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("name=\"");
    String _simpleName_5 = GrammarUtil.getSimpleName(it);
    _builder.append(_simpleName_5, "\t\t");
    _builder.append("\">");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("<keywordReference id=\"");
    String _namespace_3 = GrammarUtil.getNamespace(it);
    String _plus_6 = (_namespace_3 + ".ui.keyword_");
    String _simpleName_6 = GrammarUtil.getSimpleName(it);
    String _plus_7 = (_plus_6 + _simpleName_6);
    _builder.append(_plus_7, "\t\t");
    _builder.append("\"/>");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("<enabledWhen>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<adapt type=\"org.eclipse.core.resources.IProject\"/>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("</enabledWhen>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<filter name=\"projectNature\" value=\"org.eclipse.xtext.ui.shared.xtextNature\"/>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</page>");
    _builder.newLine();
    _builder.append("</extension>");
    _builder.newLine();
    _builder.append("<extension");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("point=\"org.eclipse.ui.keywords\">");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<keyword");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("id=\"");
    String _namespace_4 = GrammarUtil.getNamespace(it);
    String _plus_8 = (_namespace_4 + ".ui.keyword_");
    String _simpleName_7 = GrammarUtil.getSimpleName(it);
    String _plus_9 = (_plus_8 + _simpleName_7);
    _builder.append(_plus_9, "\t\t");
    _builder.append("\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("label=\"");
    String _simpleName_8 = GrammarUtil.getSimpleName(it);
    _builder.append(_simpleName_8, "\t\t");
    _builder.append("\"/>");
    _builder.newLineIfNotEmpty();
    _builder.append("</extension>");
    _builder.newLine();
    _builder.append("<extension");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("point=\"org.eclipse.ui.commands\">");
    _builder.newLine();
    _builder.append("<command");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("description=\"Trigger expensive validation\"");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("id=\"");
    String _name_16 = it.getName();
    _builder.append(_name_16, "\t\t");
    _builder.append(".validate\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("name=\"Validate\">");
    _builder.newLine();
    _builder.append("</command>");
    _builder.newLine();
    _builder.append("<!-- copy qualified name -->");
    _builder.newLine();
    _builder.append("<command");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("id=\"org.eclipse.xtext.ui.editor.copyqualifiedname.EditorCopyQualifiedName\"");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("categoryId=\"org.eclipse.ui.category.edit\"");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("description=\"Copy the qualified name for the selected element\"");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("name=\"Copy Qualified Name\">");
    _builder.newLine();
    _builder.append("</command>");
    _builder.newLine();
    _builder.append("<command");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("id=\"org.eclipse.xtext.ui.editor.copyqualifiedname.OutlineCopyQualifiedName\"");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("categoryId=\"org.eclipse.ui.category.edit\"");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("description=\"Copy the qualified name for the selected element\"");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("name=\"Copy Qualified Name\">");
    _builder.newLine();
    _builder.append("</command>");
    _builder.newLine();
    _builder.append("</extension>");
    _builder.newLine();
    _builder.append("<extension point=\"org.eclipse.ui.menus\">");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<menuContribution");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("locationURI=\"popup:#TextEditorContext?after=group.edit\">");
    _builder.newLine();
    _builder.append("\t\t ");
    _builder.append("<command");
    _builder.newLine();
    _builder.append("\t\t\t ");
    _builder.append("commandId=\"");
    String _name_17 = it.getName();
    _builder.append(_name_17, "\t\t\t ");
    _builder.append(".validate\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t\t ");
    _builder.append("style=\"push\"");
    _builder.newLine();
    _builder.append("\t\t\t ");
    _builder.append("tooltip=\"Trigger expensive validation\">");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<visibleWhen checkEnabled=\"false\">");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<reference");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("definitionId=\"");
    String _name_18 = it.getName();
    _builder.append(_name_18, "\t\t\t\t");
    _builder.append(".Editor.opened\">");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t\t");
    _builder.append("</reference>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("</visibleWhen>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</command>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</menuContribution>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<!-- copy qualified name -->");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<menuContribution locationURI=\"popup:#TextEditorContext?after=copy\">");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<command commandId=\"org.eclipse.xtext.ui.editor.copyqualifiedname.EditorCopyQualifiedName\"");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("style=\"push\" tooltip=\"Copy Qualified Name\">");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<visibleWhen checkEnabled=\"false\">");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("<reference definitionId=\"");
    String _name_19 = it.getName();
    _builder.append(_name_19, "\t\t\t\t");
    _builder.append(".Editor.opened\" />");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t\t");
    _builder.append("</visibleWhen>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("</command>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</menuContribution>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<menuContribution locationURI=\"menu:edit?after=copy\">");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<command commandId=\"org.eclipse.xtext.ui.editor.copyqualifiedname.EditorCopyQualifiedName\"");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("style=\"push\" tooltip=\"Copy Qualified Name\">");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<visibleWhen checkEnabled=\"false\">");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("<reference definitionId=\"");
    String _name_20 = it.getName();
    _builder.append(_name_20, "\t\t\t\t");
    _builder.append(".Editor.opened\" />");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t\t");
    _builder.append("</visibleWhen>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("</command>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</menuContribution>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<menuContribution locationURI=\"popup:org.eclipse.xtext.ui.outline?after=additions\">");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<command commandId=\"org.eclipse.xtext.ui.editor.copyqualifiedname.OutlineCopyQualifiedName\"");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("style=\"push\" tooltip=\"Copy Qualified Name\">");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<visibleWhen checkEnabled=\"false\">");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("<and>");
    _builder.newLine();
    _builder.append("\t\t\t\t\t");
    _builder.append("<reference definitionId=\"");
    String _name_21 = it.getName();
    _builder.append(_name_21, "\t\t\t\t\t");
    _builder.append(".XtextEditor.opened\" />");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t\t\t\t");
    _builder.append("<iterate>");
    _builder.newLine();
    _builder.append("\t\t\t\t\t\t");
    _builder.append("<adapt type=\"org.eclipse.xtext.ui.editor.outline.IOutlineNode\" />");
    _builder.newLine();
    _builder.append("\t\t\t\t\t");
    _builder.append("</iterate>");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("</and>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("</visibleWhen>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("</command>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</menuContribution>");
    _builder.newLine();
    _builder.append("</extension>");
    _builder.newLine();
    _builder.append("<extension point=\"org.eclipse.ui.menus\">");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<menuContribution locationURI=\"popup:#TextEditorContext?endof=group.find\">");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<command commandId=\"org.eclipse.xtext.ui.editor.FindReferences\">");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<visibleWhen checkEnabled=\"false\">");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("<reference definitionId=\"");
    String _name_22 = it.getName();
    _builder.append(_name_22, "\t\t\t\t");
    _builder.append(".Editor.opened\">");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t\t\t");
    _builder.append("</reference>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("</visibleWhen>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("</command>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</menuContribution>");
    _builder.newLine();
    _builder.append("</extension>");
    _builder.newLine();
    _builder.append("<extension point=\"org.eclipse.ui.handlers\">");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<handler");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("class=\"");
    TypeReference _eclipsePluginExecutableExtensionFactory_10 = this.naming.getEclipsePluginExecutableExtensionFactory(it);
    _builder.append(_eclipsePluginExecutableExtensionFactory_10, "\t\t");
    _builder.append(":org.eclipse.xtext.ui.editor.findrefs.FindReferencesHandler\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("commandId=\"org.eclipse.xtext.ui.editor.FindReferences\">");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("<activeWhen>");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("<reference");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("definitionId=\"");
    String _name_23 = it.getName();
    _builder.append(_name_23, "\t\t\t\t");
    _builder.append(".Editor.opened\">");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t\t");
    _builder.append("</reference>");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("</activeWhen>");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</handler>");
    _builder.newLine();
    _builder.append("</extension>");
    _builder.newLine();
    _builder.append("<extension point=\"org.eclipse.core.contenttype.contentTypes\">");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("<content-type");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("base-type=\"org.eclipse.core.runtime.text\"");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("file-extensions=\"");
    String _join_1 = IterableExtensions.join(this.getLanguage().getFileExtensions(), ",");
    _builder.append(_join_1, "\t\t");
    _builder.append("\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("id=\"");
    String _name_24 = it.getName();
    _builder.append(_name_24, "\t\t");
    _builder.append(".contenttype\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("name=\"");
    String _simpleName_9 = GrammarUtil.getSimpleName(it);
    _builder.append(_simpleName_9, "\t\t");
    _builder.append(" File\"");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("priority=\"normal\">");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("</content-type>");
    _builder.newLine();
    _builder.append("</extension>");
    _builder.newLine();
    return _builder;
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) TypeReference(org.eclipse.xtext.xtext.generator.model.TypeReference)

Aggregations

TypeReference (org.eclipse.xtext.xtext.generator.model.TypeReference)154 StringConcatenationClient (org.eclipse.xtend2.lib.StringConcatenationClient)119 GuiceModuleAccess (org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess)27 GeneratedJavaFileAccess (org.eclipse.xtext.xtext.generator.model.GeneratedJavaFileAccess)24 Grammar (org.eclipse.xtext.Grammar)23 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)21 ManifestAccess (org.eclipse.xtext.xtext.generator.model.ManifestAccess)17 List (java.util.List)14 Set (java.util.Set)12 Test (org.junit.Test)12 JavaFileAccess (org.eclipse.xtext.xtext.generator.model.JavaFileAccess)11 PluginXmlAccess (org.eclipse.xtext.xtext.generator.model.PluginXmlAccess)11 IClassAnnotation (org.eclipse.xtext.xtext.generator.model.annotations.IClassAnnotation)10 AbstractRule (org.eclipse.xtext.AbstractRule)9 SuppressWarningsAnnotation (org.eclipse.xtext.xtext.generator.model.annotations.SuppressWarningsAnnotation)8 IBundleProjectConfig (org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig)8 ContentAssistGrammarNaming (org.eclipse.xtext.xtext.generator.parser.antlr.ContentAssistGrammarNaming)7 EObject (org.eclipse.emf.ecore.EObject)6 Function1 (org.eclipse.xtext.xbase.lib.Functions.Function1)6 ArrayList (java.util.ArrayList)5