Java Code Examples for org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig#getSrcGen()

The following examples show how to use org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig#getSrcGen() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XtextAntlrGeneratorComparisonFragment.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void generate() {
  Naming _naming = this.getNaming();
  boolean _tripleEquals = (_naming == null);
  if (_tripleEquals) {
    this.setNaming(this.createNaming());
  }
  if ((this.options == null)) {
    AntlrOptions _antlrOptions = new AntlrOptions();
    this.options = _antlrOptions;
  }
  final AntlrGrammarComparator.IErrorHandler errorHandler = this.createErrorHandler();
  RuntimeException exception = null;
  IRuntimeProjectConfig _runtime = this.getProjectConfig().getRuntime();
  IXtextGeneratorFileSystemAccess _srcGen = null;
  if (_runtime!=null) {
    _srcGen=_runtime.getSrcGen();
  }
  boolean _tripleNotEquals = (_srcGen != null);
  if (_tripleNotEquals) {
    exception = this.loadAndCompareGrammars(this.getProjectConfig().getRuntime().getSrcGen(), Generator.SRC_GEN, errorHandler);
  }
  boolean _and = false;
  if (!(((!this.failOnError) || (exception == null)) && (!this.skipContentAssistGrammarComparison))) {
    _and = false;
  } else {
    IBundleProjectConfig _genericIde = this.getProjectConfig().getGenericIde();
    IXtextGeneratorFileSystemAccess _srcGen_1 = null;
    if (_genericIde!=null) {
      _srcGen_1=_genericIde.getSrcGen();
    }
    boolean _tripleNotEquals_1 = (_srcGen_1 != null);
    _and = _tripleNotEquals_1;
  }
  if (_and) {
    exception = this.loadAndCompareGrammars(this.getProjectConfig().getGenericIde().getSrcGen(), Generator.SRC_GEN_IDE, errorHandler);
  }
  XtextAntlrGeneratorComparisonFragment.deleteDir(this.getTmpFolder());
  if ((this.failOnError && (exception != null))) {
    throw exception;
  }
}
 
Example 2
Source File: XbaseGeneratorFragment2.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
protected boolean contributeEditorStub() {
  boolean _xblockexpression = false;
  {
    IBundleProjectConfig _eclipsePlugin = this.getProjectConfig().getEclipsePlugin();
    IXtextGeneratorFileSystemAccess _srcGen = null;
    if (_eclipsePlugin!=null) {
      _srcGen=_eclipsePlugin.getSrcGen();
    }
    boolean _tripleNotEquals = (_srcGen != null);
    if (_tripleNotEquals) {
      final GeneratedJavaFileAccess file = this.fileAccessFactory.createGeneratedJavaFile(this._xtextGeneratorNaming.getEclipsePluginEditor(this.getGrammar()));
      StringConcatenationClient _client = new StringConcatenationClient() {
        @Override
        protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
          _builder.append("/**");
          _builder.newLine();
          _builder.append(" ");
          _builder.append("* This class was generated. Customizations should only happen in a newly");
          _builder.newLine();
          _builder.append(" ");
          _builder.append("* introduced subclass.");
          _builder.newLine();
          _builder.append(" ");
          _builder.append("*/");
          _builder.newLine();
          _builder.append("public class ");
          String _simpleName = XbaseGeneratorFragment2.this._xtextGeneratorNaming.getEclipsePluginEditor(XbaseGeneratorFragment2.this.getGrammar()).getSimpleName();
          _builder.append(_simpleName);
          _builder.append(" extends ");
          TypeReference _eclipsePluginXbaseEditor = XbaseGeneratorFragment2.this._xtextGeneratorNaming.getEclipsePluginXbaseEditor(XbaseGeneratorFragment2.this.getGrammar());
          _builder.append(_eclipsePluginXbaseEditor);
          _builder.append(" {");
          _builder.newLineIfNotEmpty();
          _builder.append("}");
          _builder.newLine();
        }
      };
      file.setContent(_client);
      file.writeTo(this.getProjectConfig().getEclipsePlugin().getSrcGen());
    }
    boolean _xifexpression = false;
    ManifestAccess _manifest = this.getProjectConfig().getEclipsePlugin().getManifest();
    boolean _tripleNotEquals_1 = (_manifest != null);
    if (_tripleNotEquals_1) {
      Set<String> _exportedPackages = this.getProjectConfig().getEclipsePlugin().getManifest().getExportedPackages();
      String _packageName = this._xtextGeneratorNaming.getEclipsePluginEditor(this.getGrammar()).getPackageName();
      _xifexpression = _exportedPackages.add(_packageName);
    }
    _xblockexpression = _xifexpression;
  }
  return _xblockexpression;
}
 
Example 3
Source File: QuickfixProviderFragment2.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void generate() {
  GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory();
  TypeReference _typeReference = new TypeReference("org.eclipse.xtext.ui.editor.quickfix.IssueResolutionProvider");
  _bindingFactory.addTypeToType(_typeReference, 
    this.getQuickfixProviderClass(this.getGrammar())).contributeTo(this.getLanguage().getEclipsePluginGenModule());
  boolean _isGenerateStub = this.isGenerateStub();
  if (_isGenerateStub) {
    IBundleProjectConfig _eclipsePlugin = this.getProjectConfig().getEclipsePlugin();
    IXtextGeneratorFileSystemAccess _src = null;
    if (_eclipsePlugin!=null) {
      _src=_eclipsePlugin.getSrc();
    }
    boolean _tripleNotEquals = (_src != null);
    if (_tripleNotEquals) {
      boolean _isGenerateXtendStub = this.isGenerateXtendStub();
      if (_isGenerateXtendStub) {
        this.generateXtendQuickfixProvider();
      } else {
        this.generateJavaQuickfixProvider();
      }
    }
    ManifestAccess _manifest = this.getProjectConfig().getEclipsePlugin().getManifest();
    boolean _tripleNotEquals_1 = (_manifest != null);
    if (_tripleNotEquals_1) {
      Set<String> _exportedPackages = this.getProjectConfig().getEclipsePlugin().getManifest().getExportedPackages();
      String _packageName = this.getQuickfixProviderClass(this.getGrammar()).getPackageName();
      _exportedPackages.add(_packageName);
    }
    PluginXmlAccess _pluginXml = this.getProjectConfig().getEclipsePlugin().getPluginXml();
    boolean _tripleNotEquals_2 = (_pluginXml != null);
    if (_tripleNotEquals_2) {
      this.addRegistrationToPluginXml();
    }
  } else {
    IBundleProjectConfig _eclipsePlugin_1 = this.getProjectConfig().getEclipsePlugin();
    IXtextGeneratorFileSystemAccess _srcGen = null;
    if (_eclipsePlugin_1!=null) {
      _srcGen=_eclipsePlugin_1.getSrcGen();
    }
    boolean _tripleNotEquals_3 = (_srcGen != null);
    if (_tripleNotEquals_3) {
      this.generateGenQuickfixProvider();
    }
    ManifestAccess _manifest_1 = this.getProjectConfig().getEclipsePlugin().getManifest();
    boolean _tripleNotEquals_4 = (_manifest_1 != null);
    if (_tripleNotEquals_4) {
      Set<String> _exportedPackages_1 = this.getProjectConfig().getEclipsePlugin().getManifest().getExportedPackages();
      String _packageName_1 = this.getQuickfixProviderClass(this.getGrammar()).getPackageName();
      _exportedPackages_1.add(_packageName_1);
    }
  }
}