本文整理汇总了Java中com.intellij.psi.PsiMember.getModifierList方法的典型用法代码示例。如果您正苦于以下问题:Java PsiMember.getModifierList方法的具体用法?Java PsiMember.getModifierList怎么用?Java PsiMember.getModifierList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.PsiMember
的用法示例。
在下文中一共展示了PsiMember.getModifierList方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setVisibilityIcon
import com.intellij.psi.PsiMember; //导入方法依赖的package包/类
@Override
protected void setVisibilityIcon(MemberInfo memberInfo, RowIcon icon) {
PsiMember member = memberInfo.getMember();
PsiModifierList modifiers = member != null ? member.getModifierList() : null;
if (modifiers != null) {
VisibilityIcons.setVisibilityIcon(modifiers, icon);
}
else {
icon.setIcon(IconUtil.getEmptyIcon(true), VISIBILITY_ICON_POSITION);
}
}
示例2: setVisibilityIcon
import com.intellij.psi.PsiMember; //导入方法依赖的package包/类
@Override
protected void setVisibilityIcon(GrMemberInfo memberInfo, RowIcon icon) {
PsiMember member = memberInfo.getMember();
PsiModifierList modifiers = member != null ? member.getModifierList() : null;
if (modifiers != null) {
VisibilityIcons.setVisibilityIcon(modifiers, icon);
}
else {
icon.setIcon(IconUtil.getEmptyIcon(true), VISIBILITY_ICON_POSITION);
}
}
示例3: addApplicableProcessors
import com.intellij.psi.PsiMember; //导入方法依赖的package包/类
private void addApplicableProcessors(@NotNull PsiMember psiMember, @NotNull Collection<LombokProcessorData> target) {
final PsiModifierList psiModifierList = psiMember.getModifierList();
if (null != psiModifierList) {
for (PsiAnnotation psiAnnotation : psiModifierList.getAnnotations()) {
for (Processor processor : getProcessors(psiAnnotation)) {
target.add(new LombokProcessorData(processor, psiAnnotation));
}
}
}
}
示例4: fixModifierList
import com.intellij.psi.PsiMember; //导入方法依赖的package包/类
private void fixModifierList(PsiMember member, PsiMember newMember, final UsageInfo[] usages) throws IncorrectOperationException
{
PsiModifierList modifierList = newMember.getModifierList();
if(modifierList != null && myTargetClass.isInterface())
{
modifierList.setModifierProperty(PsiModifier.PUBLIC, false);
modifierList.setModifierProperty(PsiModifier.PROTECTED, false);
modifierList.setModifierProperty(PsiModifier.PRIVATE, false);
if(newMember instanceof PsiClass)
{
modifierList.setModifierProperty(PsiModifier.STATIC, false);
}
return;
}
if(myNewVisibility == null)
{
return;
}
final List<UsageInfo> filtered = new ArrayList<UsageInfo>();
for(UsageInfo usage : usages)
{
if(usage instanceof MoveMembersUsageInfo && member == ((MoveMembersUsageInfo) usage).member)
{
filtered.add(usage);
}
}
UsageInfo[] infos = filtered.toArray(new UsageInfo[filtered.size()]);
VisibilityUtil.fixVisibility(UsageViewUtil.toElements(infos), newMember, myNewVisibility);
}
示例5: insert
import com.intellij.psi.PsiMember; //导入方法依赖的package包/类
@Override
public void insert(@NotNull final PsiClass aClass, @Nullable PsiElement anchor, boolean before) throws IncorrectOperationException
{
final PsiMember existingMember;
if(myMember instanceof PsiField)
{
existingMember = aClass.findFieldByName(myMember.getName(), false);
}
else if(myMember instanceof PsiMethod)
{
existingMember = aClass.findMethodBySignature((PsiMethod) myMember, false);
}
else
{
existingMember = null;
}
if(existingMember == null || !myMergeIfExists)
{
PsiElement newMember = GenerateMembersUtil.insert(aClass, myMember, anchor, before);
myMember = (T) JavaCodeStyleManager.getInstance(aClass.getProject()).shortenClassReferences(newMember);
LOG.assertTrue(myMember.isValid(), myMember);
}
else
{
final PsiModifierList modifierList = myMember.getModifierList();
final PsiModifierList existingModifierList = existingMember.getModifierList();
if(modifierList != null && existingModifierList != null)
{
final PsiAnnotation[] psiAnnotations = modifierList.getAnnotations();
PsiElement annoAnchor = existingModifierList.getAnnotations().length > 0 ? existingModifierList.getAnnotations()[0] : existingModifierList.getFirstChild();
if(psiAnnotations.length > 0)
{
for(PsiAnnotation annotation : psiAnnotations)
{
final PsiAnnotation existingAnno = existingModifierList.findAnnotation(annotation.getQualifiedName());
if(existingAnno != null)
{
annoAnchor = existingAnno.replace(annotation);
}
else
{
existingModifierList.addBefore(annotation, annoAnchor);
}
}
}
}
myMember = (T) existingMember;
if(!myMember.isValid())
{
LOG.error("invalid member: " + myMember +
" existing member: " + existingMember.isValid() +
" self modified list: " + modifierList +
" existing modified list: " + existingModifierList);
}
}
}