mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
create groovy method from usage in java file
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -169,6 +169,34 @@ public class PsiElementFactoryImpl extends PsiJavaParserFacadeImpl implements Ps
|
||||
return new LightClassReference(myManager, type.getPresentableText(), refClass, resolveResult.getSubstitutor());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiTypeParameterList createTypeParameterList() {
|
||||
return createMethodFromText("void foo()", null).getTypeParameterList();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiTypeParameter createTypeParameter(String name, PsiClassType[] superTypes) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("public <").append(name);
|
||||
if (superTypes.length > 0) {
|
||||
builder.append(" extends ");
|
||||
for (PsiClassType type : superTypes) {
|
||||
builder.append(type.getCanonicalText()).append(',');
|
||||
}
|
||||
|
||||
builder.delete(builder.length() - 1, builder.length());
|
||||
}
|
||||
builder.append("> void foo(){}");
|
||||
try {
|
||||
return createMethodFromText(builder.toString(), null).getTypeParameters()[0];
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
throw new IncorrectOperationException("type parameter text: " + builder.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiField createField(@NotNull final String name, @NotNull final PsiType type) throws IncorrectOperationException {
|
||||
|
||||
Reference in New Issue
Block a user