示例#1
0
 public static TypeReference typeRef(final EClass clazz, final IXtextGeneratorLanguage language) {
   ResourceSet _resourceSet = language.getResourceSet();
   return new TypeReference(clazz, _resourceSet);
 }
 @Override
 public void generate() {
   IXtextProjectConfig _projectConfig = this.getProjectConfig();
   IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin();
   ManifestAccess _manifest = null;
   if (_eclipsePlugin != null) {
     _manifest = _eclipsePlugin.getManifest();
   }
   Set<String> _requiredBundles = null;
   if (_manifest != null) {
     _requiredBundles = _manifest.getRequiredBundles();
   }
   if (_requiredBundles != null) {
     _requiredBundles.addAll(
         Collections.<String>unmodifiableList(
             CollectionLiterals.<String>newArrayList(
                 "org.eclipse.xtext.ui", "org.eclipse.xtext.ui.codetemplates.ui")));
   }
   GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory();
   TypeReference _typeRef =
       TypeReference.typeRef(
           "org.eclipse.xtext.ui.codetemplates.ui.preferences.TemplatesLanguageConfiguration");
   StringConcatenationClient _client =
       new StringConcatenationClient() {
         @Override
         protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
           TypeReference _typeRef =
               TypeReference.typeRef(
                   "org.eclipse.xtext.ui.codetemplates.ui.AccessibleCodetemplatesActivator");
           _builder.append(_typeRef, "");
           _builder.append(".getTemplatesLanguageConfigurationProvider()");
         }
       };
   GuiceModuleAccess.BindingFactory _addTypeToProviderInstance =
       _bindingFactory.addTypeToProviderInstance(_typeRef, _client);
   TypeReference _typeRef_1 =
       TypeReference.typeRef("org.eclipse.xtext.ui.codetemplates.ui.registry.LanguageRegistry");
   StringConcatenationClient _client_1 =
       new StringConcatenationClient() {
         @Override
         protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
           TypeReference _typeRef =
               TypeReference.typeRef(
                   "org.eclipse.xtext.ui.codetemplates.ui.AccessibleCodetemplatesActivator");
           _builder.append(_typeRef, "");
           _builder.append(".getLanguageRegistry()");
         }
       };
   GuiceModuleAccess.BindingFactory _addTypeToProviderInstance_1 =
       _addTypeToProviderInstance.addTypeToProviderInstance(_typeRef_1, _client_1);
   TypeReference _typeRef_2 =
       TypeReference.typeRef("org.eclipse.xtext.ui.codetemplates.ui.registry.LanguageRegistrar");
   TypeReference _typeRef_3 =
       TypeReference.typeRef("org.eclipse.xtext.ui.codetemplates.ui.registry.LanguageRegistrar");
   GuiceModuleAccess.BindingFactory _addTypeToTypeEagerSingleton =
       _addTypeToProviderInstance_1.addTypeToTypeEagerSingleton(_typeRef_2, _typeRef_3);
   TypeReference _typeRef_4 =
       TypeReference.typeRef("org.eclipse.xtext.ui.editor.templates.XtextTemplatePreferencePage");
   TypeReference _typeRef_5 =
       TypeReference.typeRef(
           "org.eclipse.xtext.ui.codetemplates.ui.preferences.AdvancedTemplatesPreferencePage");
   GuiceModuleAccess.BindingFactory _addTypeToType =
       _addTypeToTypeEagerSingleton.addTypeToType(_typeRef_4, _typeRef_5);
   TypeReference _typeRef_6 =
       TypeReference.typeRef(
           "org.eclipse.xtext.ide.editor.partialEditing.IPartialEditingContentAssistParser");
   Grammar _grammar = this.getGrammar();
   TypeReference _partialContentAssistParserClass =
       this.getPartialContentAssistParserClass(_grammar);
   GuiceModuleAccess.BindingFactory _addTypeToType_1 =
       _addTypeToType.addTypeToType(_typeRef_6, _partialContentAssistParserClass);
   TypeReference _typeRef_7 =
       TypeReference.typeRef(
           "org.eclipse.xtext.ui.codetemplates.ui.partialEditing.IPartialEditingContentAssistContextFactory");
   TypeReference _typeRef_8 =
       TypeReference.typeRef(
           "org.eclipse.xtext.ui.codetemplates.ui.partialEditing.PartialEditingContentAssistContextFactory");
   GuiceModuleAccess.BindingFactory _addTypeToType_2 =
       _addTypeToType_1.addTypeToType(_typeRef_7, _typeRef_8);
   IXtextGeneratorLanguage _language = this.getLanguage();
   GuiceModuleAccess _eclipsePluginGenModule = _language.getEclipsePluginGenModule();
   _addTypeToType_2.contributeTo(_eclipsePluginGenModule);
   IXtextProjectConfig _projectConfig_1 = this.getProjectConfig();
   IBundleProjectConfig _genericIde = _projectConfig_1.getGenericIde();
   IXtextGeneratorFileSystemAccess _srcGen = null;
   if (_genericIde != null) {
     _srcGen = _genericIde.getSrcGen();
   }
   boolean _notEquals = (!Objects.equal(_srcGen, null));
   if (_notEquals) {
     Grammar _grammar_1 = this.getGrammar();
     TypeReference _partialContentAssistParserClass_1 =
         this.getPartialContentAssistParserClass(_grammar_1);
     GeneratedJavaFileAccess _createGeneratedJavaFile =
         this.fileAccessFactory.createGeneratedJavaFile(_partialContentAssistParserClass_1);
     final Procedure1<GeneratedJavaFileAccess> _function =
         (GeneratedJavaFileAccess it) -> {
           StringConcatenationClient _genPartialContentAssistParser =
               this.getGenPartialContentAssistParser();
           it.setContent(_genPartialContentAssistParser);
           IXtextProjectConfig _projectConfig_2 = this.getProjectConfig();
           IBundleProjectConfig _genericIde_1 = _projectConfig_2.getGenericIde();
           IXtextGeneratorFileSystemAccess _srcGen_1 = _genericIde_1.getSrcGen();
           it.writeTo(_srcGen_1);
         };
     ObjectExtensions.<GeneratedJavaFileAccess>operator_doubleArrow(
         _createGeneratedJavaFile, _function);
   }
 }