本文整理汇总了Java中com.intellij.psi.impl.source.tree.java.PsiCompositeModifierList类的典型用法代码示例。如果您正苦于以下问题:Java PsiCompositeModifierList类的具体用法?Java PsiCompositeModifierList怎么用?Java PsiCompositeModifierList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PsiCompositeModifierList类属于com.intellij.psi.impl.source.tree.java包,在下文中一共展示了PsiCompositeModifierList类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compute
import com.intellij.psi.impl.source.tree.java.PsiCompositeModifierList; //导入依赖的package包/类
@Override
public Result<PsiModifierList> compute() {
List<PsiModifierList> modifiers = ContainerUtil.newArrayList();
for(PsiDirectory directory: getDirectories()) {
PsiFile file = directory.findFile(PACKAGE_INFO_FILE);
PsiPackageStatement stmt = file == null ? null : PsiTreeUtil.getChildOfType(file, PsiPackageStatement.class);
PsiModifierList modifierList = stmt == null ? null : stmt.getAnnotationList();
ContainerUtil.addIfNotNull(modifiers, modifierList);
}
for (PsiClass aClass : getFacade().findClasses(getQualifiedName() + ".package-info", allScope())) {
ContainerUtil.addIfNotNull(modifiers, aClass.getModifierList());
}
PsiCompositeModifierList result = modifiers.isEmpty() ? null : new PsiCompositeModifierList(getManager(), modifiers);
return new Result<PsiModifierList>(result, PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT);
}
示例2: compute
import com.intellij.psi.impl.source.tree.java.PsiCompositeModifierList; //导入依赖的package包/类
@Override
public Result<PsiModifierList> compute() {
List<PsiModifierList> list = new ArrayList<PsiModifierList>();
for(PsiDirectory directory: getDirectories()) {
PsiFile file = directory.findFile(PACKAGE_INFO_FILE);
if (file != null) {
PsiPackageStatement stmt = PsiTreeUtil.getChildOfType(file, PsiPackageStatement.class);
if (stmt != null) {
final PsiModifierList modifierList = stmt.getAnnotationList();
if (modifierList != null) {
list.add(modifierList);
}
}
}
}
final JavaPsiFacade facade = getFacade();
final GlobalSearchScope scope = allScope();
for (PsiClass aClass : facade.findClasses(getQualifiedName() + ".package-info", scope)) {
ContainerUtil.addIfNotNull(aClass.getModifierList(), list);
}
return new Result<PsiModifierList>(list.isEmpty() ? null : new PsiCompositeModifierList(getManager(), list), OOCB_DEPENDENCY);
}
示例3: compute
import com.intellij.psi.impl.source.tree.java.PsiCompositeModifierList; //导入依赖的package包/类
@Override
public Result<PsiModifierList> compute()
{
List<PsiModifierList> list = new ArrayList<PsiModifierList>();
for(PsiDirectory directory : getDirectories())
{
PsiFile file = directory.findFile(PACKAGE_INFO_FILE);
if(file != null)
{
PsiPackageStatement stmt = PsiTreeUtil.getChildOfType(file, PsiPackageStatement.class);
if(stmt != null)
{
final PsiModifierList modifierList = stmt.getAnnotationList();
if(modifierList != null)
{
list.add(modifierList);
}
}
}
}
final JavaPsiFacade facade = getFacade();
final GlobalSearchScope scope = allScope();
for(PsiClass aClass : facade.findClasses(getQualifiedName() + ".package-info", scope))
{
ContainerUtil.addIfNotNull(aClass.getModifierList(), list);
}
return new Result<PsiModifierList>(list.isEmpty() ? null : new PsiCompositeModifierList(getManager(), list), OOCB_DEPENDENCY);
}
示例4: generateDelegateMethod
import com.intellij.psi.impl.source.tree.java.PsiCompositeModifierList; //导入依赖的package包/类
private static PsiMethod generateDelegateMethod(PsiMethod method,
PsiClass superClass,
PsiSubstitutor substitutor,
boolean keepParameterAnnotations) {
final LightMethodBuilder builder = new LightMethodBuilder(superClass.getManager(), GroovyLanguage.INSTANCE, method.getName());
builder.setContainingClass(superClass);
builder.setMethodReturnType(substitutor.substitute(method.getReturnType()));
builder.setNavigationElement(method);
builder.addModifier(PsiModifier.PUBLIC);
final PsiTypeParameter[] typeParameters = method.getTypeParameters();
final PsiClass containingClass = method.getContainingClass();
boolean isRaw = containingClass != null && PsiUtil.isRawSubstitutor(containingClass, substitutor);
if (isRaw) {
substitutor = JavaPsiFacade.getInstance(method.getProject()).getElementFactory().createRawSubstitutor(substitutor, typeParameters);
}
if (!isRaw) {
for (PsiTypeParameter typeParameter : typeParameters) {
builder.addTypeParameter(typeParameter);
}
}
final PsiParameter[] originalParameters = method.getParameterList().getParameters();
for (int i = 0; i < originalParameters.length; i++) {
PsiParameter originalParameter = originalParameters[i];
PsiType type;
if (isRaw) {
type = TypeConversionUtil.erasure(substitutor.substitute(originalParameter.getType()));
}
else {
type = substitutor.substitute(originalParameter.getType());
}
if (type == null) {
type = TypesUtil.getJavaLangObject(superClass);
}
final LightParameter lightParameter = new LightParameter(StringUtil.notNullize(originalParameter.getName(), "p" + i), type, builder, JavaLanguage.INSTANCE);
if (keepParameterAnnotations) {
final PsiCompositeModifierList delegatingModifierList = new PsiCompositeModifierList(method.getManager(), Collections.singletonList(originalParameter.getModifierList()));
lightParameter.setModifierList(delegatingModifierList);
}
builder.addParameter(lightParameter);
}
builder.setBaseIcon(JetgroovyIcons.Groovy.Method);
return new DelegatedMethod(builder, method);
}