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


Java PsiCompositeModifierList类代码示例

本文整理汇总了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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:PsiPackageImpl.java

示例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);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:PsiPackageImpl.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:31,代码来源:PsiPackageImpl.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:50,代码来源:DelegatedMethodsContributor.java


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