use of org.eclipse.xtext.xtext.generator.model.TextFileAccess in project xtext-core by eclipse.
the class IdeaPluginGenerator method generate.
@Override
public void generate() {
boolean _isEnabled = this.getProjectConfig().getIdeaPlugin().isEnabled();
boolean _not = (!_isEnabled);
if (_not) {
return;
}
final String fileExtension = IterableExtensions.<String>head(this.getLanguage().getFileExtensions());
final Grammar grammar = this.getLanguage().getGrammar();
final GuiceModuleAccess.BindingFactory bindFactory = new GuiceModuleAccess.BindingFactory();
bindFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.parser.antlr.IAntlrTokenFileProvider"), this._ideaPluginClassNames.getAntlrTokenFileProvider(grammar));
bindFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.parser.antlr.Lexer"), this._ideaPluginClassNames.getPsiInternalLexer(grammar));
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("binder.bind(");
_builder.append(Lexer.class);
_builder.append(".class)");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append(".annotatedWith(");
_builder.append(Names.class, "\t");
_builder.append(".named(");
_builder.append(LexerBindings.class, "\t");
_builder.append(".RUNTIME))");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append(".to(");
TypeReference _psiInternalLexer = IdeaPluginGenerator.this._ideaPluginClassNames.getPsiInternalLexer(grammar);
_builder.append(_psiInternalLexer, "\t");
_builder.append(".class);");
_builder.newLineIfNotEmpty();
}
};
bindFactory.addConfiguredBinding("RuntimeLexer", _client);
bindFactory.addTypeToType(TypeReference.typeRef("com.intellij.lang.PsiParser"), this._ideaPluginClassNames.getPsiParser(grammar));
bindFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.idea.parser.TokenTypeProvider"), this._ideaPluginClassNames.getTokenTypeProvider(grammar));
bindFactory.addTypeToType(TypeReference.typeRef("com.intellij.lang.ParserDefinition"), this._ideaPluginClassNames.getParserDefinition(grammar));
bindFactory.addTypeToTypeSingleton(TypeReference.typeRef("org.eclipse.xtext.idea.lang.IElementTypeProvider"), this._ideaPluginClassNames.getElementTypeProvider(grammar));
bindFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.idea.facet.AbstractFacetConfiguration"), this._ideaPluginClassNames.getFacetConfiguration(grammar));
TypeReference _typeRef = TypeReference.typeRef("com.intellij.facet.FacetTypeId");
StringConcatenationClient _client_1 = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
TypeReference _facetType = IdeaPluginGenerator.this._ideaPluginClassNames.getFacetType(grammar);
_builder.append(_facetType);
_builder.append(".TYPEID");
}
};
bindFactory.addTypeToInstance(_typeRef, _client_1);
bindFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.antlr.IContentAssistParser"), this.caNaming.getParserClass(grammar));
StringConcatenationClient _client_2 = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("binder.bind(");
TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.antlr.internal.Lexer");
_builder.append(_typeRef);
_builder.append(".class).annotatedWith(");
_builder.append(Names.class);
_builder.append(".named(");
TypeReference _typeRef_1 = TypeReference.typeRef("org.eclipse.xtext.ide.LexerIdeBindings");
_builder.append(_typeRef_1);
_builder.append(".CONTENT_ASSIST)).to(");
TypeReference _lexerClass = IdeaPluginGenerator.this.caNaming.getLexerClass(grammar);
_builder.append(_lexerClass);
_builder.append(".class);");
}
};
bindFactory.addConfiguredBinding("ContentAssistLexer", _client_2);
boolean _inheritsXbase = this._xbaseUsageDetector.inheritsXbase(grammar);
if (_inheritsXbase) {
bindFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.common.types.xtext.AbstractTypeScopeProvider"), TypeReference.typeRef("org.eclipse.xtext.idea.common.types.StubBasedTypeScopeProvider"));
TypeReference _typeReference = new TypeReference("org.eclipse.xtext.xbase.typesystem.internal", "IFeatureScopeTracker.Provider");
bindFactory.addTypeToType(_typeReference, TypeReference.typeRef("org.eclipse.xtext.xbase.typesystem.internal.OptimizingFeatureScopeTrackerProvider"));
StringConcatenationClient _client_3 = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("binder.bind(");
TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.psi.IPsiModelAssociations");
_builder.append(_typeRef);
_builder.append(".class)");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append(".annotatedWith(");
_builder.append(LanguageSpecific.class, "\t");
_builder.append(".class)");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append(".to(");
TypeReference _typeRef_1 = TypeReference.typeRef("org.eclipse.xtext.idea.common.types.DerivedMemberAwarePsiModelAssociations");
_builder.append(_typeRef_1, "\t");
_builder.append(".class);");
_builder.newLineIfNotEmpty();
}
};
bindFactory.addConfiguredBinding("LanguageSpecificPsiModelAssociations", _client_3);
bindFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.idea.highlighting.IHighlightingConfiguration"), TypeReference.typeRef("org.eclipse.xtext.xbase.idea.highlighting.XbaseHighlightingConfiguration"));
bindFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.idea.formatting.BlockFactory"), TypeReference.typeRef("org.eclipse.xtext.xbase.idea.formatting.XbaseBlockFactory"));
bindFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.idea.formatting.ChildAttributesProvider"), TypeReference.typeRef("org.eclipse.xtext.xbase.idea.formatting.XbaseChildAttributesProvider"));
bindFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ide.editor.bracketmatching.IBracePairProvider"), TypeReference.typeRef("org.eclipse.xtext.xbase.idea.bracketmatching.XbaseBracePairProvider"));
bindFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.idea.findusages.IReferenceSearcher"), TypeReference.typeRef("org.eclipse.xtext.xbase.idea.findusages.JvmElementAwareReferenceSearcher"));
bindFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.xbase.compiler.IGeneratorConfigProvider"), TypeReference.typeRef("org.eclipse.xtext.xbase.idea.facet.XbaseGeneratorConfigProvider"));
TypeReference _typeRef_1 = TypeReference.typeRef("org.eclipse.xtext.idea.findusages.WordsScannerProvider");
TypeReference _typeReference_1 = new TypeReference("org.eclipse.xtext.xbase.idea.findusages", "XbaseWordsScanner.XbaseWordsScannerProvider");
bindFactory.addTypeToType(_typeRef_1, _typeReference_1);
}
bindFactory.contributeTo(this.getLanguage().getIdeaGenModule());
JavaFileAccess _compileStandaloneSetup = this.compileStandaloneSetup(grammar);
JavaFileAccess _compileIdeaSetup = this.compileIdeaSetup(grammar);
JavaFileAccess _compileCompletionContributor = this.compileCompletionContributor(grammar);
JavaFileAccess _compileFileType = this.compileFileType(grammar);
JavaFileAccess _compileFacetConfiguration = this.compileFacetConfiguration(grammar);
JavaFileAccess _compileColorSettingsPage = this.compileColorSettingsPage(grammar);
final Consumer<JavaFileAccess> _function = (JavaFileAccess it) -> {
it.writeTo(this.getProjectConfig().getIdeaPlugin().getSrc());
};
Collections.<JavaFileAccess>unmodifiableList(CollectionLiterals.<JavaFileAccess>newArrayList(_compileStandaloneSetup, _compileIdeaSetup, _compileCompletionContributor, _compileFileType, _compileFacetConfiguration, _compileColorSettingsPage)).forEach(_function);
TextFileAccess _compileServicesISetup = this.compileServicesISetup(grammar);
JavaFileAccess _compileAbstractCompletionContributor = this.compileAbstractCompletionContributor(grammar);
JavaFileAccess _compileLanguage = this.compileLanguage(grammar);
JavaFileAccess _compileAbstractFileType = this.compileAbstractFileType(grammar, fileExtension);
JavaFileAccess _compileFileTypeFactory = this.compileFileTypeFactory(grammar);
JavaFileAccess _compileFileImpl = this.compileFileImpl(grammar);
JavaFileAccess _compileTokenTypeProvider = this.compileTokenTypeProvider(grammar);
JavaFileAccess _compileElementTypeProvider = this.compileElementTypeProvider(grammar);
JavaFileAccess _compileParserDefinition = this.compileParserDefinition(grammar);
JavaFileAccess _compileSyntaxHighlighterFactory = this.compileSyntaxHighlighterFactory(grammar);
JavaFileAccess _compileSemanticHighlightVisitor = this.compileSemanticHighlightVisitor(grammar);
JavaFileAccess _compileExtensionFactory = this.compileExtensionFactory(grammar);
JavaFileAccess _compileCodeBlockModificationListener = this.compileCodeBlockModificationListener(grammar);
JavaFileAccess _compilePsiParser = this.compilePsiParser(grammar);
JavaFileAccess _compileAntlrTokenFileProvider = this.compileAntlrTokenFileProvider(grammar);
JavaFileAccess _compilePomDeclarationSearcher = this.compilePomDeclarationSearcher(grammar);
JavaFileAccess _compileFacetType = this.compileFacetType(grammar);
JavaFileAccess _compileBaseColorSettingsPage = this.compileBaseColorSettingsPage(grammar);
final Consumer<TextFileAccess> _function_1 = (TextFileAccess it) -> {
it.writeTo(this.getProjectConfig().getIdeaPlugin().getSrcGen());
};
Collections.<TextFileAccess>unmodifiableList(CollectionLiterals.<TextFileAccess>newArrayList(_compileServicesISetup, _compileAbstractCompletionContributor, _compileLanguage, _compileAbstractFileType, _compileFileTypeFactory, _compileFileImpl, _compileTokenTypeProvider, _compileElementTypeProvider, _compileParserDefinition, _compileSyntaxHighlighterFactory, _compileSemanticHighlightVisitor, _compileExtensionFactory, _compileCodeBlockModificationListener, _compilePsiParser, _compileAntlrTokenFileProvider, _compilePomDeclarationSearcher, _compileFacetType, _compileBaseColorSettingsPage)).forEach(_function_1);
if (this.deployable) {
final TextFileAccess pluginXml = this.compilePluginXml(grammar);
boolean _isFile = this.getProjectConfig().getIdeaPlugin().getMetaInf().isFile(pluginXml.getPath());
boolean _not_1 = (!_isFile);
if (_not_1) {
pluginXml.writeTo(this.getProjectConfig().getIdeaPlugin().getMetaInf());
}
this.compilePluginGenXml(grammar).writeTo(this.getProjectConfig().getIdeaPlugin().getMetaInf());
}
}
use of org.eclipse.xtext.xtext.generator.model.TextFileAccess in project xtext-core by eclipse.
the class WebIntegrationFragment method generateIndexDoc.
protected void generateIndexDoc(final String hlModName) {
boolean _isFile = this.getProjectConfig().getWeb().getAssets().isFile("index.html");
if (_isFile) {
return;
}
final TextFileAccess indexFile = this.fileAccessFactory.createTextFile();
indexFile.setPath("index.html");
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("<html>");
_builder.newLine();
_builder.append("<head>");
_builder.newLine();
_builder.append("\t");
_builder.append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">");
_builder.newLine();
_builder.append("\t");
_builder.append("<meta http-equiv=\"Content-Language\" content=\"en-us\">");
_builder.newLine();
_builder.append("\t");
_builder.append("<title>Example Web Editor</title>");
_builder.newLine();
{
WebIntegrationFragment.Framework _get = WebIntegrationFragment.this.framework.get();
boolean _equals = Objects.equal(_get, WebIntegrationFragment.Framework.ORION);
if (_equals) {
_builder.append("\t");
_builder.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"orion/code_edit/built-codeEdit.css\"/>");
_builder.newLine();
_builder.append("\t");
_builder.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"xtext/");
XtextVersion _xtextVersion = WebIntegrationFragment.this.codeConfig.getXtextVersion();
_builder.append(_xtextVersion, "\t");
_builder.append("/xtext-orion.css\"/>");
_builder.newLineIfNotEmpty();
} else {
WebIntegrationFragment.Framework _get_1 = WebIntegrationFragment.this.framework.get();
boolean _equals_1 = Objects.equal(_get_1, WebIntegrationFragment.Framework.ACE);
if (_equals_1) {
_builder.append("\t");
_builder.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"xtext/");
XtextVersion _xtextVersion_1 = WebIntegrationFragment.this.codeConfig.getXtextVersion();
_builder.append(_xtextVersion_1, "\t");
_builder.append("/xtext-ace.css\"/>");
_builder.newLineIfNotEmpty();
} else {
WebIntegrationFragment.Framework _get_2 = WebIntegrationFragment.this.framework.get();
boolean _equals_2 = Objects.equal(_get_2, WebIntegrationFragment.Framework.CODEMIRROR);
if (_equals_2) {
_builder.append("\t");
_builder.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"webjars/codemirror/");
_builder.append(WebIntegrationFragment.this.codeMirrorVersion, "\t");
_builder.append("/lib/codemirror.css\"/>");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"webjars/codemirror/");
_builder.append(WebIntegrationFragment.this.codeMirrorVersion, "\t");
_builder.append("/addon/hint/show-hint.css\"/>");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"xtext/");
XtextVersion _xtextVersion_2 = WebIntegrationFragment.this.codeConfig.getXtextVersion();
_builder.append(_xtextVersion_2, "\t");
_builder.append("/xtext-codemirror.css\"/>");
_builder.newLineIfNotEmpty();
}
}
}
}
_builder.append("\t");
_builder.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\"/>");
_builder.newLine();
_builder.append("\t");
_builder.append("<script src=\"webjars/requirejs/");
_builder.append(WebIntegrationFragment.this.requireJsVersion, "\t");
_builder.append("/require.min.js\"></script>");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("<script type=\"text/javascript\">");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var baseUrl = window.location.pathname;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("var fileIndex = baseUrl.indexOf(\"index.html\");");
_builder.newLine();
_builder.append("\t\t");
_builder.append("if (fileIndex > 0)");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("baseUrl = baseUrl.slice(0, fileIndex);");
_builder.newLine();
{
WebIntegrationFragment.Framework _get_3 = WebIntegrationFragment.this.framework.get();
boolean _equals_3 = Objects.equal(_get_3, WebIntegrationFragment.Framework.ORION);
if (_equals_3) {
_builder.append("\t\t");
_builder.append("require.config({");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\t");
_builder.append("baseUrl: baseUrl,");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\t");
_builder.append("paths: {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\t\t");
_builder.append("\"text\": \"webjars/requirejs-text/");
_builder.append(WebIntegrationFragment.this.requireJsTextVersion, "\t\t\t\t");
_builder.append("/text\",");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("\t\t");
_builder.append("\"jquery\": \"webjars/jquery/");
_builder.append(WebIntegrationFragment.this.jQueryVersion, "\t\t\t\t");
_builder.append("/jquery.min\",");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("\t\t");
_builder.append("\"xtext/xtext-orion\": \"xtext/");
XtextVersion _xtextVersion_3 = WebIntegrationFragment.this.codeConfig.getXtextVersion();
_builder.append(_xtextVersion_3, "\t\t\t\t");
_builder.append("/xtext-orion\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t\t");
_builder.append("});");
_builder.newLine();
_builder.append("\t\t");
_builder.append("require([\"orion/code_edit/built-codeEdit-amd\"], function() {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\t");
_builder.append("require([\"xtext/xtext-orion\"], function(xtext) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\t\t");
_builder.append("xtext.createEditor({");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\t\t\t");
_builder.append("baseUrl: baseUrl,");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\t\t\t");
_builder.append("syntaxDefinition: \"");
String _xifexpression = null;
boolean _get_4 = WebIntegrationFragment.this.generateJsHighlighting.get();
if (_get_4) {
_xifexpression = hlModName;
} else {
_xifexpression = "none";
}
_builder.append(_xifexpression, "\t\t\t\t\t");
_builder.append("\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("\t\t");
_builder.append("});");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\t");
_builder.append("});");
_builder.newLine();
_builder.append("\t\t");
_builder.append("});");
_builder.newLine();
} else {
WebIntegrationFragment.Framework _get_5 = WebIntegrationFragment.this.framework.get();
boolean _equals_4 = Objects.equal(_get_5, WebIntegrationFragment.Framework.ACE);
if (_equals_4) {
_builder.append("\t\t");
_builder.append("require.config({");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\t");
_builder.append("baseUrl: baseUrl,");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\t");
_builder.append("paths: {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\t\t");
_builder.append("\"jquery\": \"webjars/jquery/");
_builder.append(WebIntegrationFragment.this.jQueryVersion, "\t\t\t\t");
_builder.append("/jquery.min\",");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("\t\t");
_builder.append("\"ace/ext/language_tools\": \"webjars/ace/");
_builder.append(WebIntegrationFragment.this.aceVersion, "\t\t\t\t");
_builder.append("/src/ext-language_tools\",");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("\t\t");
_builder.append("\"xtext/xtext-ace\": \"xtext/");
XtextVersion _xtextVersion_4 = WebIntegrationFragment.this.codeConfig.getXtextVersion();
_builder.append(_xtextVersion_4, "\t\t\t\t");
_builder.append("/xtext-ace\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t\t");
_builder.append("});");
_builder.newLine();
_builder.append("\t\t");
_builder.append("require([\"webjars/ace/");
_builder.append(WebIntegrationFragment.this.aceVersion, "\t\t");
_builder.append("/src/ace\"], function() {");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("\t");
_builder.append("require([\"xtext/xtext-ace\"], function(xtext) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\t\t");
_builder.append("xtext.createEditor({");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\t\t\t");
_builder.append("baseUrl: baseUrl,");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\t\t\t");
_builder.append("syntaxDefinition: \"");
String _xifexpression_1 = null;
boolean _get_6 = WebIntegrationFragment.this.generateJsHighlighting.get();
if (_get_6) {
_xifexpression_1 = hlModName;
} else {
_xifexpression_1 = "none";
}
_builder.append(_xifexpression_1, "\t\t\t\t\t");
_builder.append("\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("\t\t");
_builder.append("});");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\t");
_builder.append("});");
_builder.newLine();
_builder.append("\t\t");
_builder.append("});");
_builder.newLine();
} else {
WebIntegrationFragment.Framework _get_7 = WebIntegrationFragment.this.framework.get();
boolean _equals_5 = Objects.equal(_get_7, WebIntegrationFragment.Framework.CODEMIRROR);
if (_equals_5) {
_builder.append("\t\t");
_builder.append("require.config({");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\t");
_builder.append("baseUrl: baseUrl,");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\t");
_builder.append("paths: {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\t\t");
_builder.append("\"jquery\": \"webjars/jquery/");
_builder.append(WebIntegrationFragment.this.jQueryVersion, "\t\t\t\t");
_builder.append("/jquery.min\",");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("\t\t");
_builder.append("\"xtext/xtext-codemirror\": \"xtext/");
XtextVersion _xtextVersion_5 = WebIntegrationFragment.this.codeConfig.getXtextVersion();
_builder.append(_xtextVersion_5, "\t\t\t\t");
_builder.append("/xtext-codemirror\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("\t");
_builder.append("},");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\t");
_builder.append("packages: [{");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\t\t");
_builder.append("name: \"codemirror\",");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\t\t");
_builder.append("location: \"webjars/codemirror/");
_builder.append(WebIntegrationFragment.this.codeMirrorVersion, "\t\t\t\t");
_builder.append("\",");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("\t\t");
_builder.append("main: \"lib/codemirror\"");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\t");
_builder.append("}]");
_builder.newLine();
_builder.append("\t\t");
_builder.append("});");
_builder.newLine();
_builder.append("\t\t");
_builder.append("require([");
{
boolean _get_8 = WebIntegrationFragment.this.generateJsHighlighting.get();
if (_get_8) {
_builder.append("\"");
_builder.append(hlModName, "\t\t");
_builder.append("\", ");
}
}
_builder.append("\"xtext/xtext-codemirror\"], function(");
{
boolean _get_9 = WebIntegrationFragment.this.generateJsHighlighting.get();
if (_get_9) {
_builder.append("mode, ");
}
}
_builder.append("xtext) {");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("\t");
_builder.append("xtext.createEditor({");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\t\t");
_builder.append("baseUrl: baseUrl");
{
boolean _get_10 = WebIntegrationFragment.this.generateJsHighlighting.get();
boolean _not = (!_get_10);
if (_not) {
_builder.append(",");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("\t\t");
_builder.append("syntaxDefinition: \"none\"");
_builder.newLine();
}
}
_builder.append("\t\t");
_builder.append("\t");
_builder.append("});");
_builder.newLine();
_builder.append("\t\t");
_builder.append("});");
_builder.newLine();
}
}
}
}
_builder.append("\t");
_builder.append("</script>");
_builder.newLine();
_builder.append("</head>");
_builder.newLine();
_builder.append("<body>");
_builder.newLine();
_builder.newLine();
_builder.append("<div class=\"container\">");
_builder.newLine();
_builder.append("\t");
_builder.append("<div class=\"header\">");
_builder.newLine();
_builder.append("\t\t");
_builder.append("<h1>Example ");
String _simpleName = GrammarUtil.getSimpleName(WebIntegrationFragment.this.getGrammar());
_builder.append(_simpleName, "\t\t");
_builder.append(" Web Editor</h1>");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("</div>");
_builder.newLine();
_builder.append("\t");
_builder.append("<div class=\"content\">");
_builder.newLine();
_builder.append("\t\t");
_builder.append("<div id=\"xtext-editor\" data-editor-xtext-lang=\"");
String _head = IterableExtensions.<String>head(WebIntegrationFragment.this.getLanguage().getFileExtensions());
_builder.append(_head, "\t\t");
_builder.append("\"></div>");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("</div>");
_builder.newLine();
_builder.append("</div>");
_builder.newLine();
_builder.newLine();
_builder.append("</body>");
_builder.newLine();
_builder.append("</html>");
_builder.newLine();
}
};
indexFile.setContent(_client);
indexFile.writeTo(this.getProjectConfig().getWeb().getAssets());
}
use of org.eclipse.xtext.xtext.generator.model.TextFileAccess in project xtext-core by eclipse.
the class FileAccessFactory method createTextFile.
public TextFileAccess createTextFile(final String path) {
final TextFileAccess result = this.createTextFile();
result.setPath(path);
return result;
}
use of org.eclipse.xtext.xtext.generator.model.TextFileAccess in project xtext-core by eclipse.
the class FileAccessFactory method createTextFile.
public TextFileAccess createTextFile(final String path, final StringConcatenationClient content) {
final TextFileAccess result = this.createTextFile(path);
result.setContent(content);
return result;
}
use of org.eclipse.xtext.xtext.generator.model.TextFileAccess in project xtext-core by eclipse.
the class XtextGenerator method generateServices.
protected void generateServices() {
if (((this.projectConfig.getGenericIde().getSrcGen() == null) || this.languageConfigs.isEmpty())) {
return;
}
final TextFileAccess file = new TextFileAccess();
file.setPath("META-INF/services/org.eclipse.xtext.ISetup");
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
{
for (final XtextGeneratorLanguage lang : XtextGenerator.this.languageConfigs) {
TypeReference _genericIdeSetup = XtextGenerator.this.naming.getGenericIdeSetup(lang.getGrammar());
_builder.append(_genericIdeSetup);
_builder.newLineIfNotEmpty();
}
}
}
};
file.setContent(_client);
file.writeTo(this.projectConfig.getGenericIde().getSrcGen());
}
Aggregations