本文整理汇总了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;
}
示例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;
}
示例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();
}
示例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");
}
示例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();
}
示例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");
}
示例7: createFile
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyFileImpl; //导入依赖的package包/类
@Override
public PsiFile createFile(FileViewProvider viewProvider) {
return new GroovyFileImpl(viewProvider);
}
示例8: createFile
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyFileImpl; //导入依赖的package包/类
public PsiFile createFile(FileViewProvider viewProvider) {
return new GroovyFileImpl(viewProvider);
}