当前位置: 首页>>代码示例>>Java>>正文


Java GroovyFileImpl类代码示例

本文整理汇总了Java中org.jetbrains.plugins.groovy.lang.psi.impl.GroovyFileImpl的典型用法代码示例。如果您正苦于以下问题:Java GroovyFileImpl类的具体用法?Java GroovyFileImpl怎么用?Java GroovyFileImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GroovyFileImpl类属于org.jetbrains.plugins.groovy.lang.psi.impl包,在下文中一共展示了GroovyFileImpl类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateClosureMethod

import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyFileImpl; //导入依赖的package包/类
@NotNull
private GrMethod generateClosureMethod(@NotNull GrClosableBlock block) {
  final GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(context.project);
  final GrMethod method = factory.createMethodFromText("def doCall(){}", block);

  GrReferenceAdjuster.shortenAllReferencesIn(method.setReturnType(context.typeProvider.getReturnType(block)));
  if (block.hasParametersSection()) {
    method.getParameterList().replace(block.getParameterList());
  }
  else {
    final GrParameter[] allParameters = block.getAllParameters();
    LOG.assertTrue(allParameters.length == 1);
    final GrParameter itParameter = allParameters[0];
    final GrParameter parameter = factory.createParameter("it", itParameter.getType().getCanonicalText(), "null", block);
    method.getParameterList().add(parameter);
  }
  ((GroovyFileImpl)method.getContainingFile()).setContextNullable(null);
  return method;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ClosureGenerator.java

示例2: generateClosureMethod

import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyFileImpl; //导入依赖的package包/类
@NotNull
private GrMethod generateClosureMethod(@NotNull GrClosableBlock block) {
  final GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(context.project);
  final GrMethod method = factory.createMethodFromText("def doCall(){}", block);

  method.setReturnType(block.getReturnType());
  if (block.hasParametersSection()) {
    method.getParameterList().replace(block.getParameterList());
  }
  else {
    final GrParameter[] allParameters = block.getAllParameters();
    LOG.assertTrue(allParameters.length == 1);
    final GrParameter itParameter = allParameters[0];
    final GrParameter parameter = factory.createParameter("it", itParameter.getType().getCanonicalText(), "null", block);
    method.getParameterList().add(parameter);
  }
  ((GroovyFileImpl)method.getContainingFile()).setContextNullable(null);
  return method;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:ClosureGenerator.java

示例3: delete

import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyFileImpl; //导入依赖的package包/类
@Override
public void delete() throws IncorrectOperationException {
  PsiElement parent = getParent();
  if (parent instanceof GroovyFileImpl) {
    GroovyFileImpl file = (GroovyFileImpl)parent;
    if (file.getTypeDefinitions().length == 1 && !file.isScript()) {
      file.delete();
      return;
    }
  }

  super.delete();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:GrTypeDefinitionImpl.java

示例4: delete

import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyFileImpl; //导入依赖的package包/类
@Override
public void delete() throws IncorrectOperationException {
  PsiElement parent = getParent();
  if (parent instanceof GroovyFileImpl || parent instanceof GrTypeDefinitionBody) {
    super.delete();
    return;
  }
  throw new IncorrectOperationException("Invalid enclosing type definition");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:GrMethodBaseImpl.java

示例5: delete

import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyFileImpl; //导入依赖的package包/类
public void delete() throws IncorrectOperationException {
  PsiElement parent = getParent();
  if (parent instanceof GroovyFileImpl) {
    GroovyFileImpl file = (GroovyFileImpl)parent;
    if (file.getTypeDefinitions().length == 1 && !file.isScript()) {
      file.delete();
      return;
    }
  }

  super.delete();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:GrTypeDefinitionImpl.java

示例6: delete

import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyFileImpl; //导入依赖的package包/类
public void delete() throws IncorrectOperationException {
  PsiElement parent = getParent();
  if (parent instanceof GroovyFileImpl || parent instanceof GrTypeDefinitionBody) {
    super.delete();
    return;
  }
  throw new IncorrectOperationException("Invalid enclosing type definition");
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:GrMethodBaseImpl.java

示例7: createFile

import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyFileImpl; //导入依赖的package包/类
@Override
public PsiFile createFile(FileViewProvider viewProvider) {
  return new GroovyFileImpl(viewProvider);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:GroovyParserDefinition.java

示例8: createFile

import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyFileImpl; //导入依赖的package包/类
public PsiFile createFile(FileViewProvider viewProvider) {
  return new GroovyFileImpl(viewProvider);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:4,代码来源:GroovyParserDefinition.java


注:本文中的org.jetbrains.plugins.groovy.lang.psi.impl.GroovyFileImpl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。