use of org.eclipse.xtext.xtext.generator.model.ManifestAccess in project xtext-core by eclipse.
the class XtextAntlrGeneratorFragment2 method addRuntimeBindingsAndImports.
protected void addRuntimeBindingsAndImports() {
@Extension final GrammarNaming naming = this.productionNaming;
ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest();
boolean _tripleNotEquals = (_manifest != null);
if (_tripleNotEquals) {
ManifestAccess _manifest_1 = this.getProjectConfig().getRuntime().getManifest();
final Procedure1<ManifestAccess> _function = (ManifestAccess it) -> {
Set<String> _exportedPackages = it.getExportedPackages();
String _packageName = naming.getLexerClass(this.getGrammar()).getPackageName();
String _packageName_1 = naming.getParserClass(this.getGrammar()).getPackageName();
String _packageName_2 = naming.getInternalParserClass(this.getGrammar()).getPackageName();
Iterables.<String>addAll(_exportedPackages, Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList(_packageName, _packageName_1, _packageName_2)));
Set<String> _requiredBundles = it.getRequiredBundles();
_requiredBundles.add("org.antlr.runtime");
};
ObjectExtensions.<ManifestAccess>operator_doubleArrow(_manifest_1, _function);
}
GuiceModuleAccess.BindingFactory _addTypeToType = new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef(IParser.class), naming.getParserClass(this.getGrammar())).addTypeToType(TypeReference.typeRef(ITokenToStringConverter.class), TypeReference.typeRef(AntlrTokenToStringConverter.class)).addTypeToType(TypeReference.typeRef(IAntlrTokenFileProvider.class), naming.getAntlrTokenFileProviderClass(this.getGrammar())).addTypeToType(naming.getLexerSuperClass(this.getGrammar()), naming.getLexerClass(this.getGrammar())).addTypeToType(TypeReference.typeRef(ITokenDefProvider.class), TypeReference.typeRef(AntlrTokenDefProvider.class));
TypeReference _lexerClass = naming.getLexerClass(this.getGrammar());
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append(LexerProvider.class);
_builder.append(".create(");
TypeReference _lexerClass = naming.getLexerClass(XtextAntlrGeneratorFragment2.this.getGrammar());
_builder.append(_lexerClass);
_builder.append(".class)");
}
};
GuiceModuleAccess.BindingFactory _addTypeToProviderInstance = _addTypeToType.addTypeToProviderInstance(_lexerClass, _client);
StringConcatenationClient _client_1 = 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 _lexerClass = naming.getLexerClass(XtextAntlrGeneratorFragment2.this.getGrammar());
_builder.append(_lexerClass, "\t");
_builder.append(".class);");
_builder.newLineIfNotEmpty();
}
};
final GuiceModuleAccess.BindingFactory rtBindings = _addTypeToProviderInstance.addConfiguredBinding("RuntimeLexer", _client_1);
boolean _containsUnorderedGroup = this.containsUnorderedGroup(this.getGrammar());
if (_containsUnorderedGroup) {
rtBindings.addTypeToType(TypeReference.typeRef(IUnorderedGroupHelper.class), TypeReference.typeRef(UnorderedGroupHelper.class));
}
boolean _isIgnoreCase = this.getOptions().isIgnoreCase();
if (_isIgnoreCase) {
rtBindings.addTypeToType(TypeReference.typeRef(ITokenSerializer.IKeywordSerializer.class), TypeReference.typeRef(IgnoreCaseKeywordSerializer.class)).addTypeToType(TypeReference.typeRef(IKeywordSerializer.class), TypeReference.typeRef(org.eclipse.xtext.serializer.tokens.IgnoreCaseKeywordSerializer.class)).addTypeToType(TypeReference.typeRef(AbstractIDValueConverter.class), TypeReference.typeRef(IgnoreCaseIDValueConverter.class));
}
rtBindings.contributeTo(this.getLanguage().getRuntimeGenModule());
}
use of org.eclipse.xtext.xtext.generator.model.ManifestAccess in project xtext-core by eclipse.
the class TypesGeneratorFragment2 method generate.
@Override
public void generate() {
if ((this.onlyEnabledIfGrammarIsUsed.get() && (!this.xbaseUsageDetector.inheritsXtype(this.getLanguage().getGrammar())))) {
return;
}
new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef(IGlobalScopeProvider.class), TypeReference.typeRef("org.eclipse.xtext.common.types.xtext.TypesAwareDefaultGlobalScopeProvider")).contributeTo(this.getLanguage().getRuntimeGenModule());
GuiceModuleAccess _runtimeGenModule = this.getLanguage().getRuntimeGenModule();
_runtimeGenModule.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.common.types.DefaultCommonTypesRuntimeModule"));
new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.editor.contentassist.PrefixMatcher"), TypeReference.typeRef("org.eclipse.xtext.ui.editor.contentassist.FQNPrefixMatcher")).contributeTo(this.getLanguage().getEclipsePluginGenModule());
GuiceModuleAccess _eclipsePluginGenModule = this.getLanguage().getEclipsePluginGenModule();
_eclipsePluginGenModule.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.common.types.ui.DefaultCommonTypesUiModule"));
ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest();
boolean _tripleNotEquals = (_manifest != null);
if (_tripleNotEquals) {
CollectionExtensions.<String>addAll(this.getProjectConfig().getRuntime().getManifest().getRequiredBundles(), "org.eclipse.xtext.common.types", "org.objectweb.asm;bundle-version=\"[5.0.1,6.0.0)\";resolution:=optional");
}
ManifestAccess _manifest_1 = this.getProjectConfig().getRuntimeTest().getManifest();
boolean _tripleNotEquals_1 = (_manifest_1 != null);
if (_tripleNotEquals_1) {
this.getProjectConfig().getRuntimeTest().getManifest().getRequiredBundles().add("org.objectweb.asm;bundle-version=\"[5.0.1,6.0.0)\";resolution:=optional");
}
ManifestAccess _manifest_2 = this.getProjectConfig().getEclipsePlugin().getManifest();
boolean _tripleNotEquals_2 = (_manifest_2 != null);
if (_tripleNotEquals_2) {
this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles().add("org.eclipse.xtext.common.types.ui");
}
}
use of org.eclipse.xtext.xtext.generator.model.ManifestAccess in project xtext-core by eclipse.
the class XtextProjectConfig method newManifestAccess.
protected ManifestAccess newManifestAccess() {
ManifestAccess _manifestAccess = new ManifestAccess();
final Procedure1<ManifestAccess> _function = (ManifestAccess it) -> {
it.setLineDelimiter(this.codeConfig.getLineDelimiter());
};
return ObjectExtensions.<ManifestAccess>operator_doubleArrow(_manifestAccess, _function);
}
use of org.eclipse.xtext.xtext.generator.model.ManifestAccess in project xtext-core by eclipse.
the class BuilderIntegrationFragment2 method generate.
@Override
public void generate() {
this.addRuntimeGuiceBindings();
this.addEclipsePluginGuiceBindings();
ManifestAccess _manifest = this.getProjectConfig().getEclipsePlugin().getManifest();
boolean _tripleNotEquals = (_manifest != null);
if (_tripleNotEquals) {
this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles().addAll(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("org.eclipse.xtext.builder", "org.eclipse.xtext.ui")));
}
}
use of org.eclipse.xtext.xtext.generator.model.ManifestAccess in project xtext-core by eclipse.
the class LabelProviderFragment2 method generate.
@Override
public void generate() {
if ((this.isGenerateStub() || this._xbaseUsageDetector.inheritsXbase(this.getGrammar()))) {
ManifestAccess _manifest = this.getProjectConfig().getEclipsePlugin().getManifest();
boolean _tripleNotEquals = (_manifest != null);
if (_tripleNotEquals) {
Set<String> _requiredBundles = this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles();
_requiredBundles.add("org.eclipse.xtext.ui");
}
TypeReference _xifexpression = null;
boolean _isGenerateStub = this.isGenerateStub();
if (_isGenerateStub) {
_xifexpression = this.getEObjectLabelProviderClass(this.getGrammar());
} else {
_xifexpression = new TypeReference(LabelProviderFragment2.XBASE_LABEL_PROVIDER);
}
final TypeReference labelProviderClass = _xifexpression;
TypeReference _xifexpression_1 = null;
boolean _isGenerateStub_1 = this.isGenerateStub();
if (_isGenerateStub_1) {
_xifexpression_1 = this.getDescriptionLabelProviderClass(this.getGrammar());
} else {
_xifexpression_1 = new TypeReference(LabelProviderFragment2.XBASE_DESCRIPTION_LABEL_PROVIDER);
}
final TypeReference descriptionLabelProviderClass = _xifexpression_1;
final TypeReference iLabelProviderClass = new TypeReference("org.eclipse.jface.viewers.ILabelProvider");
final TypeReference rsdLabelProviderClass = new TypeReference("org.eclipse.xtext.ui.resource.ResourceServiceDescriptionLabelProvider");
GuiceModuleAccess.BindingFactory _addTypeToType = new GuiceModuleAccess.BindingFactory().addTypeToType(iLabelProviderClass, labelProviderClass);
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("binder.bind(");
_builder.append(iLabelProviderClass);
_builder.append(".class).annotatedWith(");
_builder.append(rsdLabelProviderClass);
_builder.append(".class).to(");
_builder.append(descriptionLabelProviderClass);
_builder.append(".class);");
_builder.newLineIfNotEmpty();
}
};
_addTypeToType.addConfiguredBinding("ResourceUIServiceLabelProvider", _client).contributeTo(this.getLanguage().getEclipsePluginGenModule());
}
if ((this.isGenerateStub() && (this.getProjectConfig().getEclipsePlugin().getSrc() != null))) {
boolean _isGenerateXtendStub = this.isGenerateXtendStub();
if (_isGenerateXtendStub) {
this.generateXtendEObjectLabelProvider();
this.generateXtendDescriptionLabelProvider();
} else {
this.generateJavaEObjectLabelProvider();
this.generateJavaDescriptionLabelProvider();
}
}
}
Aggregations