Java Code Examples for org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess

The following examples show how to use org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess. These examples are extracted from open source projects. 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
public void generate(final Grammar it, final AntlrOptions options, final IXtextGeneratorFileSystemAccess fsa) {
  this.keywordHelper = KeywordHelper.getHelper(it);
  this.originalGrammar = it;
  final RuleFilter filter = new RuleFilter();
  filter.setDiscardUnreachableRules(options.isSkipUnusedRules());
  final RuleNames ruleNames = RuleNames.getRuleNames(it, true);
  final Grammar flattened = new FlattenedGrammarAccess(ruleNames, filter).getFlattenedGrammar();
  boolean _isCombinedGrammar = this.isCombinedGrammar();
  new CombinedGrammarMarker(_isCombinedGrammar).attachToEmfObject(flattened);
  fsa.generateFile(this.getGrammarNaming().getParserGrammar(it).getGrammarFileName(), this.compileParser(flattened, options));
  boolean _isCombinedGrammar_1 = this.isCombinedGrammar();
  boolean _not = (!_isCombinedGrammar_1);
  if (_not) {
    fsa.generateFile(this.getGrammarNaming().getLexerGrammar(it).getGrammarFileName(), this.compileLexer(flattened, options));
  }
}
 
Example 2
protected void cleanupLexerTokensFile(final AntlrGrammar lexerGrammar, final KeywordHelper helper, final IXtextGeneratorFileSystemAccess fsa) {
  try {
    boolean _isBacktrackLexer = this.options.isBacktrackLexer();
    if (_isBacktrackLexer) {
      final MutableTokenDefProvider provider = this.createLexerTokensProvider(lexerGrammar, helper, fsa);
      final Iterator<Map.Entry<Integer, String>> entries = provider.getTokenDefMap().entrySet().iterator();
      while (entries.hasNext()) {
        {
          final String value = entries.next().getValue();
          if ((((!helper.isKeywordRule(value)) && (!value.startsWith("RULE_"))) && (!value.startsWith("SUPER_")))) {
            entries.remove();
          }
        }
      }
      final CharArrayWriter writer = new CharArrayWriter();
      PrintWriter _printWriter = new PrintWriter(writer);
      provider.writeTokenFile(_printWriter);
      String _tokensFileName = lexerGrammar.getTokensFileName();
      char[] _charArray = writer.toCharArray();
      String _string = new String(_charArray);
      fsa.generateFile(_tokensFileName, _string);
    }
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
Example 3
@Override
public RuntimeProjectConfig getRuntime() {
  return new RuntimeProjectConfig() {
    @Override
    public String getName() {
      return "projectName";
    }
    
    @Override
    public String getEcoreModelFolder() {
      return "rootFolder/ecoreFolder";
    }
    
    @Override
    public IXtextGeneratorFileSystemAccess getSrcGen() {
      return new XtextGeneratorFileSystemAccess("rootFolder/src-gen", false);
    }
    
    @Override
    public IXtextGeneratorFileSystemAccess getRoot() {
      return new XtextGeneratorFileSystemAccess("rootFolder", false);
    }
  };
}
 
Example 4
@Override
public void generate() {
	Grammar grammar = getGrammar();
	String macros = read(patternPath);
	String rules = read(additionalRulePath);
	final String encoding = codeConfig.getEncoding();
	String fileName = "Internal" + GrammarUtil.getSimpleName(grammar) + "Flexer.flex";
	
	final IXtextGeneratorFileSystemAccess fsa;
	final GrammarNaming grammarNaming;
	
	if (ui) {
		grammarNaming = contentAssistNaming;
		fsa = this.getProjectConfig().getGenericIde().getSrcGen();
		
	} else {
		grammarNaming = productionNaming;
		fsa = this.getProjectConfig().getRuntime().getSrcGen();
	}
	
	String srcGenPath = fsa.getPath();
	String parserName = grammarNaming.getInternalParserClass(grammar).getName();
	String baseName = grammarNaming.getParserGrammar(grammar).getGrammarFileName();
	baseName = baseName.substring(0, baseName.lastIndexOf('/'));
	String directory = srcGenPath + "/" + baseName;
	String contents = templatex.generateFlexer(grammar, parserName, macros, rules, codeConfig);
	fsa.generateFile(baseName + "/" + fileName, contents);
	String javaFileName = directory + "/" + "Internal" + GrammarUtil.getSimpleName(grammar) + "Flexer.java";
	String[] args = new String[] { "-d", directory, directory + "/" + fileName };
	main.runJFlex(args);
	Charset charset = Charset.forName(encoding);
	String javaCode = readFileIntoString(javaFileName, charset);
	javaCode = new NewlineNormalizer(codeConfig.getLineDelimiter()).normalizeLineDelimiters(javaCode);
	javaCode = removeTimestamps(javaCode);
	writeStringIntoFile(javaFileName, javaCode, charset);
}
 
Example 5
protected void splitParserClassFile(final IXtextGeneratorFileSystemAccess fsa, final TypeReference parser) {
  final String content = fsa.readTextFile(parser.getJavaPath()).toString();
  int _fieldsPerClass = this.getOptions().getFieldsPerClass();
  final AntlrParserSplitter splitter = new AntlrParserSplitter(content, _fieldsPerClass);
  String _transform = splitter.transform();
  int _methodsPerClass = this.getOptions().getMethodsPerClass();
  final PartialClassExtractor extractor = new PartialClassExtractor(_transform, _methodsPerClass);
  fsa.generateFile(parser.getJavaPath(), extractor.transform());
}
 
Example 6
protected void simplifyUnorderedGroupPredicates(final IXtextGeneratorFileSystemAccess fsa, final TypeReference parser) {
  final String content = fsa.readTextFile(parser.getJavaPath()).toString();
  UnorderedGroupsSplitter splitter = new UnorderedGroupsSplitter(content);
  String transformed = splitter.transform();
  SyntacticPredicateFixup fixup = new SyntacticPredicateFixup(transformed);
  transformed = fixup.transform();
  BacktrackingGuardForUnorderedGroupsRemover remover = new BacktrackingGuardForUnorderedGroupsRemover(transformed);
  String newContent = remover.transform();
  fsa.generateFile(parser.getJavaPath(), newContent);
}
 
Example 7
protected void normalizeTokens(final IXtextGeneratorFileSystemAccess fsa, final String tokenFile) {
  String content = fsa.readTextFile(tokenFile).toString();
  content = this.newLineNormalizer.postProcess(fsa.getURI(tokenFile), content).toString();
  final List<String> splitted = Strings.split(content, this.codeConfig.getLineDelimiter());
  Collections.<String>sort(splitted);
  String _concat = Strings.concat(this.codeConfig.getLineDelimiter(), splitted);
  String _lineDelimiter = this.codeConfig.getLineDelimiter();
  String _plus = (_concat + _lineDelimiter);
  content = _plus;
  fsa.generateFile(tokenFile, content);
}
 
Example 8
protected void splitParserAndLexerIfEnabled(final IXtextGeneratorFileSystemAccess fsa, final TypeReference parser, final TypeReference lexer) {
  this.improveCodeQuality(fsa, lexer, parser);
  boolean _isClassSplitting = this.getOptions().isClassSplitting();
  if (_isClassSplitting) {
    this.splitLexerClassFile(fsa, lexer);
    this.splitParserClassFile(fsa, parser);
  }
}
 
Example 9
protected void improveParserCodeQuality(final IXtextGeneratorFileSystemAccess fsa, final TypeReference parser) {
  String parserContent = fsa.readTextFile(parser.getJavaPath()).toString();
  parserContent = this.codeQualityHelper.stripUnnecessaryComments(parserContent, this.options);
  parserContent = this.codeQualityHelper.removeDuplicateBitsets(parserContent, this.options);
  parserContent = this.codeQualityHelper.removeDuplicateDFAs(parserContent, this.options);
  fsa.generateFile(parser.getJavaPath(), parserContent);
}
 
Example 10
protected MutableTokenDefProvider createLexerTokensProvider(final AntlrGrammar lexerGrammar, final KeywordHelper helper, final IXtextGeneratorFileSystemAccess fsa) {
  Charset _forName = Charset.forName(this.codeConfig.getEncoding());
  final MutableTokenDefProvider provider = new MutableTokenDefProvider(helper, _forName);
  final IAntlrTokenFileProvider _function = () -> {
    return fsa.readBinaryFile(lexerGrammar.getTokensFileName());
  };
  provider.setAntlrTokenFileProvider(_function);
  return provider;
}
 
Example 11
protected void cleanupParserTokensFile(final AntlrGrammar lexerGrammar, final AntlrGrammar parserGrammar, final KeywordHelper helper, final IXtextGeneratorFileSystemAccess fsa) {
  try {
    final MutableTokenDefProvider provider = this.createLexerTokensProvider(lexerGrammar, helper, fsa);
    Set<Map.Entry<Integer, String>> _entrySet = provider.getTokenDefMap().entrySet();
    for (final Map.Entry<Integer, String> entry : _entrySet) {
      {
        final String value = entry.getValue();
        boolean _isKeywordRule = helper.isKeywordRule(value);
        if (_isKeywordRule) {
          final String keywordAsAntlrString = AntlrGrammarGenUtil.toAntlrString(helper.getKeywordValue(value));
          entry.setValue((("\'" + keywordAsAntlrString) + "\'"));
        } else {
          boolean _startsWith = value.startsWith("\'");
          if (_startsWith) {
            String _antlrString = AntlrGrammarGenUtil.toAntlrString(value);
            String _plus = ("\'" + _antlrString);
            String _plus_1 = (_plus + "\'");
            entry.setValue(_plus_1);
          }
        }
      }
    }
    final CharArrayWriter writer = new CharArrayWriter();
    PrintWriter _printWriter = new PrintWriter(writer);
    provider.writeTokenFile(_printWriter);
    String _tokensFileName = parserGrammar.getTokensFileName();
    char[] _charArray = writer.toCharArray();
    String _string = new String(_charArray);
    fsa.generateFile(_tokensFileName, _string);
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
Example 12
@Override
protected void doGenerate() {
  Grammar _grammar = this.getGrammar();
  boolean _isIgnoreCase = this.getOptions().isIgnoreCase();
  new KeywordHelper(_grammar, _isIgnoreCase, this.grammarUtil);
  boolean _isCombinedGrammar = this.isCombinedGrammar();
  new CombinedGrammarMarker(_isCombinedGrammar).attachToEmfObject(this.getGrammar());
  if (this.debugGrammar) {
    this.generateDebugGrammar();
  }
  this.generateProductionGrammar();
  IXtextGeneratorFileSystemAccess _srcGen = this.getProjectConfig().getGenericIde().getSrcGen();
  boolean _tripleNotEquals = (_srcGen != null);
  if (_tripleNotEquals) {
    this.generateContentAssistGrammar();
    this.addIdeBindingsAndImports();
  }
  this.generateProductionParser().writeTo(this.getProjectConfig().getRuntime().getSrcGen());
  this.generateAntlrTokenFileProvider().writeTo(this.getProjectConfig().getRuntime().getSrcGen());
  this.generateContentAssistParser().writeTo(this.getProjectConfig().getGenericIde().getSrcGen());
  boolean _hasSyntheticTerminalRule = this.hasSyntheticTerminalRule();
  if (_hasSyntheticTerminalRule) {
    this.generateProductionTokenSource().writeTo(this.getProjectConfig().getRuntime().getSrc());
    this.generateContentAssistTokenSource().writeTo(this.getProjectConfig().getGenericIde().getSrc());
  }
  this.addRuntimeBindingsAndImports();
  this.addIdeBindingsAndImports();
  this.addUiBindingsAndImports();
}
 
Example 13
protected void generateProductionGrammar() {
  @Extension
  final GrammarNaming naming = this.productionNaming;
  final IXtextGeneratorFileSystemAccess fsa = this.getProjectConfig().getRuntime().getSrcGen();
  this.productionGenerator.generate(this.getGrammar(), this.getOptions(), fsa);
  this.runAntlr(naming.getParserGrammar(this.getGrammar()), naming.getLexerGrammar(this.getGrammar()), fsa);
  this.simplifyUnorderedGroupPredicatesIfRequired(this.getGrammar(), fsa, naming.getInternalParserClass(this.getGrammar()));
  this.splitParserAndLexerIfEnabled(fsa, naming.getInternalParserClass(this.getGrammar()), naming.getLexerClass(this.getGrammar()));
  this.normalizeTokens(fsa, naming.getLexerGrammar(this.getGrammar()).getTokensFileName());
  this.suppressWarnings(fsa, naming.getInternalParserClass(this.getGrammar()), naming.getLexerClass(this.getGrammar()));
  this.normalizeLineDelimiters(fsa, naming.getInternalParserClass(this.getGrammar()), naming.getLexerClass(this.getGrammar()));
}
 
Example 14
protected void generateContentAssistGrammar() {
  @Extension
  final ContentAssistGrammarNaming naming = this.contentAssistNaming;
  final IXtextGeneratorFileSystemAccess fsa = this.getProjectConfig().getGenericIde().getSrcGen();
  this.contentAssistGenerator.generate(this.getGrammar(), this.getOptions(), fsa);
  this.runAntlr(naming.getParserGrammar(this.getGrammar()), naming.getLexerGrammar(this.getGrammar()), fsa);
  this.simplifyUnorderedGroupPredicatesIfRequired(this.getGrammar(), fsa, naming.getInternalParserClass(this.getGrammar()));
  this.splitParserAndLexerIfEnabled(fsa, naming.getInternalParserClass(this.getGrammar()), naming.getLexerClass(this.getGrammar()));
  this.normalizeTokens(fsa, naming.getLexerGrammar(this.getGrammar()).getTokensFileName());
  this.suppressWarnings(fsa, naming.getInternalParserClass(this.getGrammar()), naming.getLexerClass(this.getGrammar()));
  this.normalizeLineDelimiters(fsa, naming.getLexerClass(this.getGrammar()), naming.getInternalParserClass(this.getGrammar()));
  if (this.removeBacktrackingGuards) {
    this.removeBackTrackingGuards(fsa, naming.getInternalParserClass(this.getGrammar()), this.lookaheadThreshold);
  }
}
 
Example 15
Source Project: xtext-core   Source File: XtextGenerator.java    License: Eclipse Public License 2.0 5 votes vote down vote up
protected void generateExecutableExtensionFactory(final IXtextGeneratorLanguage language) {
  IXtextGeneratorFileSystemAccess _srcGen = this.projectConfig.getEclipsePlugin().getSrcGen();
  boolean _tripleNotEquals = (_srcGen != null);
  if (_tripleNotEquals) {
    this.templates.createEclipsePluginExecutableExtensionFactory(language, IterableExtensions.<XtextGeneratorLanguage>head(this.languageConfigs)).writeTo(this.projectConfig.getEclipsePlugin().getSrcGen());
  }
}
 
Example 16
Source Project: xtext-core   Source File: XtextGenerator.java    License: Eclipse Public License 2.0 5 votes vote down vote up
protected void mergeManifest(final ManifestAccess manifest, final IXtextGeneratorFileSystemAccess metaInf) throws IOException {
  InputStream in = null;
  try {
    in = metaInf.readBinaryFile(manifest.getPath());
    String _bundleName = manifest.getBundleName();
    final MergeableManifest2 merge = new MergeableManifest2(in, _bundleName);
    merge.setLineDelimiter(this.codeConfig.getLineDelimiter());
    merge.addExportedPackages(manifest.getExportedPackages());
    merge.addRequiredBundles(manifest.getRequiredBundles());
    merge.addImportedPackages(manifest.getImportedPackages());
    if (((manifest.getActivator() != null) && StringExtensions.isNullOrEmpty(merge.getBundleActivator()))) {
      merge.setBundleActivator(manifest.getActivator().getName());
    }
    boolean _isModified = merge.isModified();
    if (_isModified) {
      final ByteArrayOutputStream out = new ByteArrayOutputStream();
      merge.write(out);
      String _path = manifest.getPath();
      byte[] _byteArray = out.toByteArray();
      ByteArrayInputStream _byteArrayInputStream = new ByteArrayInputStream(_byteArray);
      metaInf.generateFile(_path, _byteArrayInputStream);
    }
  } finally {
    if ((in != null)) {
      in.close();
    }
  }
}
 
Example 17
@Override
public void generate() {
  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");
  }
  boolean _isGenerateStub = this.isGenerateStub();
  boolean _not = (!_isGenerateStub);
  if (_not) {
    return;
  }
  IXtextGeneratorFileSystemAccess _src = this.getProjectConfig().getEclipsePlugin().getSrc();
  boolean _tripleNotEquals_1 = (_src != null);
  if (_tripleNotEquals_1) {
    boolean _isGenerateXtendStub = this.isGenerateXtendStub();
    if (_isGenerateXtendStub) {
      this.generateXtendOutlineTreeProvider();
    } else {
      this.generateJavaOutlineTreeProvider();
    }
  }
  GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory();
  TypeReference _typeReference = new TypeReference("org.eclipse.xtext.ui.editor.outline.IOutlineTreeProvider");
  GuiceModuleAccess.BindingFactory _addTypeToType = _bindingFactory.addTypeToType(_typeReference, 
    this.getOutlineTreeProviderClass(this.getGrammar()));
  TypeReference _typeReference_1 = new TypeReference("org.eclipse.xtext.ui.editor.outline.impl.IOutlineTreeStructureProvider");
  _addTypeToType.addTypeToType(_typeReference_1, 
    this.getOutlineTreeProviderClass(this.getGrammar())).contributeTo(this.getLanguage().getEclipsePluginGenModule());
}
 
Example 18
@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 19
Source Project: xtext-extras   Source File: FragmentAdapter.java    License: Eclipse Public License 2.0 4 votes vote down vote up
protected Naming createNaming() {
  final IXtextGeneratorLanguage config2 = this.getLanguage();
  Naming _naming = new Naming();
  final Procedure1<Naming> _function = (Naming it) -> {
    IXtextGeneratorFileSystemAccess _root = this.getProjectConfig().getRuntime().getRoot();
    String _path = null;
    if (_root!=null) {
      _path=_root.getPath();
    }
    it.setProjectNameRt(this.getLastSegment(_path));
    IXtextGeneratorFileSystemAccess _root_1 = this.getProjectConfig().getGenericIde().getRoot();
    String _path_1 = null;
    if (_root_1!=null) {
      _path_1=_root_1.getPath();
    }
    it.setProjectNameIde(this.getLastSegment(_path_1));
    IXtextGeneratorFileSystemAccess _root_2 = this.getProjectConfig().getEclipsePlugin().getRoot();
    String _path_2 = null;
    if (_root_2!=null) {
      _path_2=_root_2.getPath();
    }
    it.setProjectNameUi(this.getLastSegment(_path_2));
    it.setIdeBasePackage(this._xtextGeneratorNaming.getGenericIdeBasePackage(config2.getGrammar()));
    it.setUiBasePackage(this._xtextGeneratorNaming.getEclipsePluginBasePackage(config2.getGrammar()));
    TypeReference _eclipsePluginActivator = this._xtextGeneratorNaming.getEclipsePluginActivator();
    String _name = null;
    if (_eclipsePluginActivator!=null) {
      _name=_eclipsePluginActivator.getName();
    }
    it.setActivatorName(_name);
    IXtextGeneratorFileSystemAccess _root_3 = this.getProjectConfig().getRuntimeTest().getRoot();
    String _path_3 = null;
    if (_root_3!=null) {
      _path_3=_root_3.getPath();
    }
    it.setPathTestProject(_path_3);
    it.setLineDelimiter(this.codeConfig.getLineDelimiter());
    it.setFileHeader(this.codeConfig.getFileHeader());
    it.setClassAnnotations(this.codeConfig.getClassAnnotationsAsString());
    it.setAnnotationImports(this.codeConfig.getAnnotationImportsAsString());
    String _projectNameUi = it.getProjectNameUi();
    boolean _tripleNotEquals = (_projectNameUi != null);
    it.setHasUI(_tripleNotEquals);
    String _projectNameIde = it.getProjectNameIde();
    boolean _tripleNotEquals_1 = (_projectNameIde != null);
    it.setHasIde(_tripleNotEquals_1);
    it.setGrammarId(config2.getGrammar().getName());
  };
  final Naming result = ObjectExtensions.<Naming>operator_doubleArrow(_naming, _function);
  if ((this.fragment instanceof NamingAware)) {
    ((NamingAware)this.fragment).registerNaming(result);
  }
  return result;
}
 
Example 20
@Override
protected void splitParserClassFile(IXtextGeneratorFileSystemAccess fsa, TypeReference parser) {
	// no-op
}
 
Example 21
@Override
protected void improveParserCodeQuality(IXtextGeneratorFileSystemAccess fsa, TypeReference parser) {
	// no-op
}
 
Example 22
Source Project: xtext-core   Source File: WebProjectConfig.java    License: Eclipse Public License 2.0 4 votes vote down vote up
public IXtextGeneratorFileSystemAccess getAssets() {
	return assets;
}
 
Example 23
Source Project: xtext-core   Source File: SubProjectConfig.java    License: Eclipse Public License 2.0 4 votes vote down vote up
public IXtextGeneratorFileSystemAccess getRoot() {
	return root;
}
 
Example 24
Source Project: xtext-core   Source File: SubProjectConfig.java    License: Eclipse Public License 2.0 4 votes vote down vote up
public IXtextGeneratorFileSystemAccess getMetaInf() {
	return metaInf;
}
 
Example 25
Source Project: xtext-core   Source File: SubProjectConfig.java    License: Eclipse Public License 2.0 4 votes vote down vote up
public IXtextGeneratorFileSystemAccess getSrc() {
	return src;
}
 
Example 26
Source Project: xtext-core   Source File: SubProjectConfig.java    License: Eclipse Public License 2.0 4 votes vote down vote up
public IXtextGeneratorFileSystemAccess getSrcGen() {
	return srcGen;
}
 
Example 27
Source Project: xtext-core   Source File: SubProjectConfig.java    License: Eclipse Public License 2.0 4 votes vote down vote up
public IXtextGeneratorFileSystemAccess getIcons() {
	return icons;
}
 
Example 28
protected IXtextGeneratorFileSystemAccess getOutputLocation() {
	return outputLocation;
}
 
Example 29
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 30
protected void splitLexerClassFile(final IXtextGeneratorFileSystemAccess fsa, final TypeReference lexer) {
  final String content = fsa.readTextFile(lexer.getJavaPath()).toString();
  AntlrLexerSplitter splitter = new AntlrLexerSplitter(content);
  splitter.setCasesPerSpecialStateSwitch(this.options.getCasesPerSpecialStateSwitch());
  fsa.generateFile(lexer.getJavaPath(), splitter.transform());
}