Java 类org.eclipse.xtext.xtext.generator.model.JavaFileAccess 实例源码

项目:xtext-core    文件:SimpleProjectWizardFragment2.java   
public void generateProjectInfo() {
  final TypeReference projectInfoClass = TypeReference.typeRef(this.getProjectInfoClassName());
  final JavaFileAccess file = this.fileAccessFactory.createJavaFile(projectInfoClass);
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("public class ");
      String _simpleName = projectInfoClass.getSimpleName();
      _builder.append(_simpleName);
      _builder.append(" extends ");
      TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ui.wizard.DefaultProjectInfo");
      _builder.append(_typeRef);
      _builder.append(" {");
      _builder.newLineIfNotEmpty();
      _builder.newLine();
      _builder.append("}");
      _builder.newLine();
    }
  };
  file.setContent(_client);
  file.writeTo(this.getProjectConfig().getEclipsePlugin().getSrc());
}
项目:xtext-core    文件:SimpleProjectWizardFragment2.java   
public void generateWizardNewProjectCreationPage() {
  final TypeReference mainPageClass = TypeReference.typeRef(this.getProjectWizardCreationPageClassName());
  final JavaFileAccess file = this.fileAccessFactory.createJavaFile(mainPageClass);
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("public class ");
      String _simpleName = mainPageClass.getSimpleName();
      _builder.append(_simpleName);
      _builder.append(" extends ");
      TypeReference _typeRef = TypeReference.typeRef("org.eclipse.ui.dialogs.WizardNewProjectCreationPage");
      _builder.append(_typeRef);
      _builder.append(" {");
      _builder.newLineIfNotEmpty();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("public ");
      String _simpleName_1 = mainPageClass.getSimpleName();
      _builder.append(_simpleName_1, "\t");
      _builder.append("(String pageName) {");
      _builder.newLineIfNotEmpty();
      _builder.append("\t\t");
      _builder.append("super(pageName);");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("}");
      _builder.newLine();
      _builder.newLine();
      _builder.append("}");
      _builder.newLine();
    }
  };
  file.setContent(_client);
  file.writeTo(this.getProjectConfig().getEclipsePlugin().getSrc());
}
项目:xtext-core    文件:IdeaPluginGenerator.java   
public JavaFileAccess compilePomDeclarationSearcher(final Grammar it) {
  TypeReference _pomDeclarationSearcher = this._ideaPluginClassNames.getPomDeclarationSearcher(it);
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("public class ");
      String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getPomDeclarationSearcher(it).getSimpleName();
      _builder.append(_simpleName);
      _builder.append(" extends ");
      TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.idea.pom.AbstractXtextPomDeclarationSearcher");
      _builder.append(_typeRef);
      _builder.append(" {");
      _builder.newLineIfNotEmpty();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("public ");
      String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getPomDeclarationSearcher(it).getSimpleName();
      _builder.append(_simpleName_1, "\t");
      _builder.append("() {");
      _builder.newLineIfNotEmpty();
      _builder.append("\t\t");
      _builder.append("super(");
      TypeReference _ideaLanguage = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(IdeaPluginGenerator.this.getGrammar());
      _builder.append(_ideaLanguage, "\t\t");
      _builder.append(".INSTANCE);");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.append("}");
      _builder.newLine();
      _builder.append("}");
      _builder.newLine();
    }
  };
  return this.fileAccessFactory.createJavaFile(_pomDeclarationSearcher, _client);
}
项目:xtext-core    文件:IdeaPluginGenerator.java   
public JavaFileAccess compileAntlrTokenFileProvider(final Grammar grammar) {
  TypeReference _antlrTokenFileProvider = this._ideaPluginClassNames.getAntlrTokenFileProvider(grammar);
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("public class ");
      String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getAntlrTokenFileProvider(grammar).getSimpleName();
      _builder.append(_simpleName);
      _builder.append(" implements ");
      _builder.append(IAntlrTokenFileProvider.class);
      _builder.append(" {");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.append("@");
      _builder.append(Override.class, "\t");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.append("public ");
      _builder.append(InputStream.class, "\t");
      _builder.append(" getAntlrTokenFile() {");
      _builder.newLineIfNotEmpty();
      _builder.append("\t\t");
      _builder.append(ClassLoader.class, "\t\t");
      _builder.append(" classLoader = getClass().getClassLoader();");
      _builder.newLineIfNotEmpty();
      _builder.append("\t\t");
      _builder.append("return classLoader.getResourceAsStream(\"");
      String _tokens = IdeaPluginGenerator.this._ideaPluginClassNames.getTokens(grammar);
      _builder.append(_tokens, "\t\t");
      _builder.append("\");");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.append("}");
      _builder.newLine();
      _builder.append("}");
      _builder.newLine();
    }
  };
  return this.fileAccessFactory.createJavaFile(_antlrTokenFileProvider, _client);
}
项目:xtext-core    文件:IdeaPluginGenerator.java   
public JavaFileAccess compileSemanticHighlightVisitor(final Grammar grammar) {
  TypeReference _semanticHighlightVisitor = this._ideaPluginClassNames.getSemanticHighlightVisitor(grammar);
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("public class ");
      String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getSemanticHighlightVisitor(grammar).getSimpleName();
      _builder.append(_simpleName);
      _builder.append(" extends ");
      TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.idea.highlighting.SemanticHighlightVisitor");
      _builder.append(_typeRef);
      _builder.append(" {");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.append("public ");
      String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getSemanticHighlightVisitor(grammar).getSimpleName();
      _builder.append(_simpleName_1, "\t");
      _builder.append("() {");
      _builder.newLineIfNotEmpty();
      _builder.append("\t\t");
      TypeReference _ideaLanguage = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar);
      _builder.append(_ideaLanguage, "\t\t");
      _builder.append(".INSTANCE.injectMembers(this);");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.append("}");
      _builder.newLine();
      _builder.append("}");
      _builder.newLine();
    }
  };
  return this.fileAccessFactory.createJavaFile(_semanticHighlightVisitor, _client);
}
项目:xtext-core    文件:IdeaPluginGenerator.java   
public JavaFileAccess compileAbstractCompletionContributor(final Grammar grammar) {
  TypeReference _abstractCompletionContributor = this._ideaPluginClassNames.getAbstractCompletionContributor(grammar);
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("public class ");
      String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getAbstractCompletionContributor(grammar).getSimpleName();
      _builder.append(_simpleName);
      _builder.append(" extends ");
      TypeReference _completionContributorSuperClass = IdeaPluginGenerator.this._ideaPluginClassNames.getCompletionContributorSuperClass(grammar);
      _builder.append(_completionContributorSuperClass);
      _builder.append(" {");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.append("public ");
      String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getAbstractCompletionContributor(grammar).getSimpleName();
      _builder.append(_simpleName_1, "\t");
      _builder.append("(");
      TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.idea.lang.AbstractXtextLanguage");
      _builder.append(_typeRef, "\t");
      _builder.append(" lang) {");
      _builder.newLineIfNotEmpty();
      _builder.append("\t\t");
      _builder.append("super(lang);");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("}");
      _builder.newLine();
      _builder.append("}");
      _builder.newLine();
    }
  };
  return this.fileAccessFactory.createJavaFile(_abstractCompletionContributor, _client);
}
项目:CooperateModelingEnvironment    文件:AutomatedIssueResolutionFragment2.java   
private void generateIAutomatedIssueResolutionProvider() {
    JavaFileAccess jva = fileAccessFactory.createJavaFile(typeRef(getAutomatedIssueResolutionProviderName()));
    AutomatedIssueResolutionProviderGenerator generator = new AutomatedIssueResolutionProviderGenerator(naming,
            grammar);
    generator.create(jva, getAutomatedIssueResolutionProviderSimpleName());
    jva.writeTo(getProjectConfig().getRuntime().getSrc());
    getProjectConfig().getRuntime().getManifest().getExportedPackages().add(getIssuesPackageName());
}
项目:CooperateModelingEnvironment    文件:AutomatedIssueResolutionFragment2.java   
private void generateAutomatedIssueResolutionFactoryBase() {
    TypeReference tr = typeRef(getAutomatedIssueResolutionFactoryBaseName());
    JavaFileAccess jva = fileAccessFactory.createJavaFile(tr);
    AutomatedIssueResolutionFactoryBaseGenerator generator = new AutomatedIssueResolutionFactoryBaseGenerator(
            naming, grammar);
    generator.create(jva, tr.getSimpleName());
    jva.writeTo(getProjectConfig().getRuntime().getSrc());
    getProjectConfig().getRuntime().getManifest().getExportedPackages().add(getIssuesPackageName());
}
项目:CooperateModelingEnvironment    文件:DerivedStateCalculationFragment2.java   
private void generateDerivedStateElementComparator() {
    TypeReference tr = getDerivedStateElementComparatorName();
    JavaFileAccess jva = fileAccessFactory.createJavaFile(tr);
    DerivedStateElementComparatorGenerator generator = new DerivedStateElementComparatorGenerator();
    generator.create(jva, tr.getSimpleName());
    jva.writeTo(getProjectConfig().getRuntime().getSrc());
}
项目:xtext-core    文件:XtextAntlrGeneratorFragment2.java   
public JavaFileAccess generateAntlrTokenFileProvider() {
  GeneratedJavaFileAccess _xblockexpression = null;
  {
    @Extension
    final GrammarNaming naming = this.productionNaming;
    final GeneratedJavaFileAccess file = this.fileFactory.createGeneratedJavaFile(naming.getAntlrTokenFileProviderClass(this.getGrammar()));
    StringConcatenationClient _client = new StringConcatenationClient() {
      @Override
      protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
        _builder.append("public class ");
        String _simpleName = naming.getAntlrTokenFileProviderClass(XtextAntlrGeneratorFragment2.this.getGrammar()).getSimpleName();
        _builder.append(_simpleName);
        _builder.append(" implements ");
        _builder.append(IAntlrTokenFileProvider.class);
        _builder.append(" {");
        _builder.newLineIfNotEmpty();
        _builder.newLine();
        _builder.append("\t");
        _builder.append("@Override");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("public ");
        _builder.append(InputStream.class, "\t");
        _builder.append(" getAntlrTokenFile() {");
        _builder.newLineIfNotEmpty();
        _builder.append("\t\t");
        _builder.append(ClassLoader.class, "\t\t");
        _builder.append(" classLoader = getClass().getClassLoader();");
        _builder.newLineIfNotEmpty();
        _builder.append("\t\t");
        _builder.append("return classLoader.getResourceAsStream(\"");
        String _tokensFileName = naming.getParserGrammar(XtextAntlrGeneratorFragment2.this.getGrammar()).getTokensFileName();
        _builder.append(_tokensFileName, "\t\t");
        _builder.append("\");");
        _builder.newLineIfNotEmpty();
        _builder.append("\t");
        _builder.append("}");
        _builder.newLine();
        _builder.append("}");
        _builder.newLine();
      }
    };
    file.setContent(_client);
    _xblockexpression = file;
  }
  return _xblockexpression;
}
项目:xtext-core    文件:Junit4Fragment2.java   
protected JavaFileAccess generateUiInjectorProvider() {
  JavaFileAccess _xblockexpression = null;
  {
    final JavaFileAccess file = this.fileAccessFactory.createJavaFile(this.uiInjectorProvider());
    StringConcatenationClient _client = new StringConcatenationClient() {
      @Override
      protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
        _builder.append("public class ");
        String _simpleName = Junit4Fragment2.this.uiInjectorProvider().getSimpleName();
        _builder.append(_simpleName);
        _builder.append(" implements ");
        TypeReference _iInjectorProvider = Junit4Fragment2.this.iInjectorProvider();
        _builder.append(_iInjectorProvider);
        _builder.append(" {");
        _builder.newLineIfNotEmpty();
        _builder.newLine();
        _builder.append("\t");
        _builder.append("@Override");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("public ");
        _builder.append(Injector.class, "\t");
        _builder.append(" getInjector() {");
        _builder.newLineIfNotEmpty();
        _builder.append("\t\t");
        _builder.append("return ");
        TypeReference _eclipsePluginActivator = Junit4Fragment2.this._xtextGeneratorNaming.getEclipsePluginActivator();
        _builder.append(_eclipsePluginActivator, "\t\t");
        _builder.append(".getInstance().getInjector(\"");
        String _name = Junit4Fragment2.this.getGrammar().getName();
        _builder.append(_name, "\t\t");
        _builder.append("\");");
        _builder.newLineIfNotEmpty();
        _builder.append("\t");
        _builder.append("}");
        _builder.newLine();
        _builder.newLine();
        _builder.append("}");
        _builder.newLine();
      }
    };
    file.setContent(_client);
    _xblockexpression = file;
  }
  return _xblockexpression;
}
项目:xtext-core    文件:GeneratedJavaFileAccess.java   
public void setTypeComment(final StringConcatenationClient javaContent) {
  final JavaFileAccess.JavaTypeAwareStringConcatenation javaStringConcat = new JavaFileAccess.JavaTypeAwareStringConcatenation(this);
  javaStringConcat.append(javaContent);
  this.typeComment = javaStringConcat;
}
项目:xtext-core    文件:FileAccessFactory.java   
public JavaFileAccess createJavaFile(final TypeReference typeRef) {
  return new JavaFileAccess(typeRef, this.codeConfig);
}
项目:xtext-core    文件:FileAccessFactory.java   
public JavaFileAccess createJavaFile(final TypeReference typeRef, final StringConcatenationClient content) {
  final JavaFileAccess result = this.createJavaFile(typeRef);
  result.setContent(content);
  return result;
}
项目:xtext-core    文件:SingletonClassAnnotation.java   
@Override
public boolean appliesTo(final JavaFileAccess javaFile) {
  return true;
}
项目:xtext-core    文件:GeneratedClassAnnotation.java   
@Override
public boolean appliesTo(final JavaFileAccess javaFile) {
  return javaFile.isMarkedAsGenerated();
}
项目:xtext-core    文件:SuppressWarningsAnnotation.java   
@Override
public boolean appliesTo(final JavaFileAccess javaFile) {
  return true;
}
项目:xtext-core    文件:IdeaPluginGenerator.java   
public JavaFileAccess compileExtensionFactory(final Grammar grammar) {
  TypeReference _extensionFactory = this._ideaPluginClassNames.getExtensionFactory(grammar);
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("public class ");
      String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getExtensionFactory(grammar).getSimpleName();
      _builder.append(_simpleName);
      _builder.append(" implements ");
      TypeReference _typeRef = TypeReference.typeRef("com.intellij.openapi.extensions.ExtensionFactory");
      _builder.append(_typeRef);
      _builder.append(" {");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.append("@Override");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("public Object createInstance(");
      _builder.append(String.class, "\t");
      _builder.append(" factoryArgument, ");
      _builder.append(String.class, "\t");
      _builder.append(" implementationClass) {");
      _builder.newLineIfNotEmpty();
      _builder.append("\t\t");
      _builder.append(Class.class, "\t\t");
      _builder.append("<?> clazz;");
      _builder.newLineIfNotEmpty();
      _builder.append("\t\t");
      _builder.append("try {");
      _builder.newLine();
      _builder.append("\t\t\t");
      _builder.append("clazz = ");
      _builder.append(Class.class, "\t\t\t");
      _builder.append(".forName(implementationClass);");
      _builder.newLineIfNotEmpty();
      _builder.append("\t\t");
      _builder.append("} catch (");
      _builder.append(ClassNotFoundException.class, "\t\t");
      _builder.append(" e) {");
      _builder.newLineIfNotEmpty();
      _builder.append("\t\t\t");
      _builder.append("throw new ");
      _builder.append(IllegalArgumentException.class, "\t\t\t");
      _builder.append("(\"Couldn\'t load \"+implementationClass, e);");
      _builder.newLineIfNotEmpty();
      _builder.append("\t\t");
      _builder.append("}");
      _builder.newLine();
      _builder.append("\t\t");
      _builder.append("return ");
      TypeReference _ideaLanguage = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar);
      _builder.append(_ideaLanguage, "\t\t");
      _builder.append(".INSTANCE.<Object> getInstance(clazz);");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.append("}");
      _builder.newLine();
      _builder.append("}");
      _builder.newLine();
    }
  };
  return this.fileAccessFactory.createJavaFile(_extensionFactory, _client);
}
项目:xtext-core    文件:IdeaPluginGenerator.java   
public JavaFileAccess compileCodeBlockModificationListener(final Grammar grammar) {
  TypeReference _codeBlockModificationListener = this._ideaPluginClassNames.getCodeBlockModificationListener(grammar);
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("public class ");
      String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getCodeBlockModificationListener(grammar).getSimpleName();
      _builder.append(_simpleName);
      _builder.append(" extends ");
      TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.psi.BaseXtextCodeBlockModificationListener");
      _builder.append(_typeRef);
      _builder.append(" {");
      _builder.newLineIfNotEmpty();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("public ");
      String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getCodeBlockModificationListener(grammar).getSimpleName();
      _builder.append(_simpleName_1, "\t");
      _builder.append("(");
      TypeReference _typeRef_1 = TypeReference.typeRef("com.intellij.psi.util.PsiModificationTracker");
      _builder.append(_typeRef_1, "\t");
      _builder.append(" psiModificationTracker) {");
      _builder.newLineIfNotEmpty();
      _builder.append("\t\t");
      _builder.append("super(");
      TypeReference _ideaLanguage = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar);
      _builder.append(_ideaLanguage, "\t\t");
      _builder.append(".INSTANCE, psiModificationTracker);");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.append("}");
      _builder.newLine();
      {
        boolean _inheritsXbase = IdeaPluginGenerator.this._xbaseUsageDetector.inheritsXbase(grammar);
        if (_inheritsXbase) {
          _builder.append("\t");
          _builder.append("protected boolean hasJavaStructuralChanges(");
          TypeReference _typeRef_2 = TypeReference.typeRef("com.intellij.psi.impl.PsiTreeChangeEventImpl");
          _builder.append(_typeRef_2, "\t");
          _builder.append(" event) {");
          _builder.newLineIfNotEmpty();
          _builder.append("\t");
          _builder.append("\t");
          _builder.append("return true;");
          _builder.newLine();
          _builder.append("\t");
          _builder.append("}");
          _builder.newLine();
        }
      }
      _builder.newLine();
      _builder.append("}");
      _builder.newLine();
    }
  };
  return this.fileAccessFactory.createJavaFile(_codeBlockModificationListener, _client);
}
项目:xtext-core    文件:IdeaPluginGenerator.java   
public JavaFileAccess compileFileImpl(final Grammar grammar) {
  TypeReference _fileImpl = this._ideaPluginClassNames.getFileImpl(grammar);
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("public final class ");
      String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getFileImpl(grammar).getSimpleName();
      _builder.append(_simpleName);
      _builder.append(" extends ");
      TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.psi.impl.BaseXtextFile");
      _builder.append(_typeRef);
      _builder.append(" {");
      _builder.newLineIfNotEmpty();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("public ");
      String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getFileImpl(grammar).getSimpleName();
      _builder.append(_simpleName_1, "\t");
      _builder.append("(");
      TypeReference _typeRef_1 = TypeReference.typeRef("com.intellij.psi.FileViewProvider");
      _builder.append(_typeRef_1, "\t");
      _builder.append(" viewProvider) {");
      _builder.newLineIfNotEmpty();
      _builder.append("\t\t");
      _builder.append("super(viewProvider, ");
      TypeReference _ideaLanguage = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar);
      _builder.append(_ideaLanguage, "\t\t");
      _builder.append(".INSTANCE);");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.append("}");
      _builder.newLine();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("@Override");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("public ");
      TypeReference _typeRef_2 = TypeReference.typeRef("com.intellij.openapi.fileTypes.FileType");
      _builder.append(_typeRef_2, "\t");
      _builder.append(" getFileType() {");
      _builder.newLineIfNotEmpty();
      _builder.append("\t\t");
      _builder.append("return ");
      TypeReference _fileType = IdeaPluginGenerator.this._ideaPluginClassNames.getFileType(grammar);
      _builder.append(_fileType, "\t\t");
      _builder.append(".INSTANCE;");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.append("}");
      _builder.newLine();
      _builder.append("}");
      _builder.newLine();
    }
  };
  return this.fileAccessFactory.createJavaFile(_fileImpl, _client);
}
项目:xtext-core    文件:IdeaPluginGenerator.java   
public JavaFileAccess compileFileTypeFactory(final Grammar grammar) {
  TypeReference _fileTypeFactory = this._ideaPluginClassNames.getFileTypeFactory(grammar);
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("public class ");
      String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getFileTypeFactory(grammar).getSimpleName();
      _builder.append(_simpleName);
      _builder.append(" extends ");
      TypeReference _typeRef = TypeReference.typeRef("com.intellij.openapi.fileTypes.FileTypeFactory");
      _builder.append(_typeRef);
      _builder.append(" {");
      _builder.newLineIfNotEmpty();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("@Override");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("public void createFileTypes(@");
      TypeReference _typeRef_1 = TypeReference.typeRef("org.jetbrains.annotations.NotNull");
      _builder.append(_typeRef_1, "\t");
      _builder.append(" ");
      TypeReference _typeRef_2 = TypeReference.typeRef("com.intellij.openapi.fileTypes.FileTypeConsumer");
      _builder.append(_typeRef_2, "\t");
      _builder.append(" consumer) {");
      _builder.newLineIfNotEmpty();
      _builder.append("\t\t");
      _builder.append("consumer.consume(");
      TypeReference _fileType = IdeaPluginGenerator.this._ideaPluginClassNames.getFileType(grammar);
      _builder.append(_fileType, "\t\t");
      _builder.append(".INSTANCE, ");
      TypeReference _abstractFileType = IdeaPluginGenerator.this._ideaPluginClassNames.getAbstractFileType(grammar);
      _builder.append(_abstractFileType, "\t\t");
      _builder.append(".DEFAULT_EXTENSION);");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.append("}");
      _builder.newLine();
      _builder.newLine();
      _builder.append("}");
      _builder.newLine();
    }
  };
  return this.fileAccessFactory.createJavaFile(_fileTypeFactory, _client);
}
项目:xtext-core    文件:IdeaPluginGenerator.java   
public JavaFileAccess compileLanguage(final Grammar grammar) {
  TypeReference _ideaLanguage = this._ideaPluginClassNames.getIdeaLanguage(grammar);
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("public final class ");
      String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar).getSimpleName();
      _builder.append(_simpleName);
      _builder.append(" extends ");
      TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.idea.lang.AbstractXtextLanguage");
      _builder.append(_typeRef);
      _builder.append(" {");
      _builder.newLineIfNotEmpty();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("public static final ");
      String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar).getSimpleName();
      _builder.append(_simpleName_1, "\t");
      _builder.append(" INSTANCE = new ");
      String _simpleName_2 = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar).getSimpleName();
      _builder.append(_simpleName_2, "\t");
      _builder.append("();");
      _builder.newLineIfNotEmpty();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("private ");
      String _simpleName_3 = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar).getSimpleName();
      _builder.append(_simpleName_3, "\t");
      _builder.append("() {");
      _builder.newLineIfNotEmpty();
      _builder.append("\t\t");
      _builder.append("super(\"");
      String _languageId = GrammarUtil.getLanguageId(grammar);
      _builder.append(_languageId, "\t\t");
      _builder.append("\");");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.append("}");
      _builder.newLine();
      _builder.newLine();
      _builder.append("}");
      _builder.newLine();
    }
  };
  return this.fileAccessFactory.createJavaFile(_ideaLanguage, _client);
}
项目:xtext-core    文件:IdeaPluginGenerator.java   
public JavaFileAccess compileSyntaxHighlighterFactory(final Grammar grammar) {
  final TypeReference syntaxHighlighter = TypeReference.typeRef("com.intellij.openapi.fileTypes.SyntaxHighlighter");
  final TypeReference lazySyntaxHighlighter = TypeReference.typeRef("com.intellij.openapi.fileTypes.SingleLazyInstanceSyntaxHighlighterFactory");
  TypeReference _syntaxHighlighterFactory = this._ideaPluginClassNames.getSyntaxHighlighterFactory(grammar);
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("public class ");
      String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getSyntaxHighlighterFactory(grammar).getSimpleName();
      _builder.append(_simpleName);
      _builder.append(" extends ");
      _builder.append(lazySyntaxHighlighter);
      _builder.append(" {");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("@Override");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("@");
      TypeReference _typeRef = TypeReference.typeRef("org.jetbrains.annotations.NotNull");
      _builder.append(_typeRef, "\t");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.append("protected ");
      _builder.append(syntaxHighlighter, "\t");
      _builder.append(" createHighlighter() {");
      _builder.newLineIfNotEmpty();
      _builder.append("\t\t");
      _builder.append("return ");
      TypeReference _ideaLanguage = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar);
      _builder.append(_ideaLanguage, "\t\t");
      _builder.append(".INSTANCE.getInstance(");
      _builder.append(syntaxHighlighter, "\t\t");
      _builder.append(".class);");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.append("}");
      _builder.newLine();
      _builder.append("}");
      _builder.newLine();
    }
  };
  return this.fileAccessFactory.createJavaFile(_syntaxHighlighterFactory, _client);
}
项目:xtext-core    文件:IdeaPluginGenerator.java   
public JavaFileAccess compileFacetType(final Grammar grammar) {
  final TypeReference faceTypeId = TypeReference.typeRef("com.intellij.facet.FacetTypeId", TypeReference.typeRef("com.intellij.facet.Facet", this._ideaPluginClassNames.getFacetConfiguration(grammar)));
  TypeReference _facetType = this._ideaPluginClassNames.getFacetType(grammar);
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("public class ");
      String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getFacetType(grammar).getSimpleName();
      _builder.append(_simpleName);
      _builder.append(" extends ");
      TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.idea.facet.AbstractFacetType", IdeaPluginGenerator.this._ideaPluginClassNames.getFacetConfiguration(grammar));
      _builder.append(_typeRef);
      _builder.append(" {");
      _builder.newLineIfNotEmpty();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("public static final ");
      _builder.append(faceTypeId, "\t");
      _builder.append(" TYPEID = new ");
      _builder.append(faceTypeId, "\t");
      _builder.append("(\"");
      String _name = grammar.getName();
      _builder.append(_name, "\t");
      _builder.append("\");");
      _builder.newLineIfNotEmpty();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("public ");
      String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getFacetType(grammar).getSimpleName();
      _builder.append(_simpleName_1, "\t");
      _builder.append("() {");
      _builder.newLineIfNotEmpty();
      _builder.append("\t\t");
      _builder.append("super(TYPEID, \"");
      String _name_1 = grammar.getName();
      _builder.append(_name_1, "\t\t");
      _builder.append("\", \"");
      String _simpleName_2 = IdeaPluginGenerator.this._ideaPluginExtension.getSimpleName(grammar);
      _builder.append(_simpleName_2, "\t\t");
      _builder.append("\");");
      _builder.newLineIfNotEmpty();
      _builder.append("\t\t");
      TypeReference _ideaLanguage = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar);
      _builder.append(_ideaLanguage, "\t\t");
      _builder.append(".INSTANCE.injectMembers(this);");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.append("}");
      _builder.newLine();
      _builder.append("}");
      _builder.newLine();
    }
  };
  return this.fileAccessFactory.createJavaFile(_facetType, _client);
}
项目:xtext-core    文件:IdeaPluginGenerator.java   
public JavaFileAccess compileBaseColorSettingsPage(final Grammar grammar) {
  TypeReference _baseColorSettingsPage = this._ideaPluginClassNames.baseColorSettingsPage(grammar);
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("public class ");
      String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.baseColorSettingsPage(grammar).getSimpleName();
      _builder.append(_simpleName);
      _builder.append(" extends ");
      TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.idea.highlighting.AbstractColorSettingsPage");
      _builder.append(_typeRef);
      _builder.append(" {");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("public ");
      String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginClassNames.baseColorSettingsPage(grammar).getSimpleName();
      _builder.append(_simpleName_1, "\t");
      _builder.append("() {");
      _builder.newLineIfNotEmpty();
      _builder.append("\t\t");
      TypeReference _ideaLanguage = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar);
      _builder.append(_ideaLanguage, "\t\t");
      _builder.append(".INSTANCE.injectMembers(this);");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.append("}");
      _builder.newLine();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("@Override");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("public String getDisplayName() {");
      _builder.newLine();
      _builder.append("\t\t");
      _builder.append("return ");
      TypeReference _ideaLanguage_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar);
      _builder.append(_ideaLanguage_1, "\t\t");
      _builder.append(".INSTANCE.getDisplayName();");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.append("}");
      _builder.newLine();
      _builder.append("}");
      _builder.newLine();
    }
  };
  return this.fileAccessFactory.createJavaFile(_baseColorSettingsPage, _client);
}
项目:xtext-core    文件:IClassAnnotation.java   
/**
 * Determine whether this annotation should be applied to the given Java file.
 */
public abstract boolean appliesTo(final JavaFileAccess javaFile);