本文整理汇总了Java中com.intellij.psi.PsiModifierList.setModifierProperty方法的典型用法代码示例。如果您正苦于以下问题:Java PsiModifierList.setModifierProperty方法的具体用法?Java PsiModifierList.setModifierProperty怎么用?Java PsiModifierList.setModifierProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.PsiModifierList
的用法示例。
在下文中一共展示了PsiModifierList.setModifierProperty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doFix
import com.intellij.psi.PsiModifierList; //导入方法依赖的package包/类
@Override
protected void doFix(final Project project, ProblemDescriptor descriptor) throws IncorrectOperationException {
final PsiMethod method = PsiTreeUtil.getParentOfType(descriptor.getPsiElement(), PsiMethod.class);
if (method != null) {
final PsiModifierList modifierList = method.getModifierList();
if (!modifierList.hasModifierProperty(PsiModifier.PUBLIC)) {
modifierList.setModifierProperty(PsiModifier.PUBLIC, true);
}
if (!modifierList.hasModifierProperty(PsiModifier.STATIC)) {
modifierList.setModifierProperty(PsiModifier.STATIC, true);
}
if (method.getReturnType() != PsiType.VOID) {
ChangeSignatureProcessor csp =
new ChangeSignatureProcessor(project, method, false, PsiModifier.PUBLIC, method.getName(), PsiType.VOID,
new ParameterInfoImpl[0]);
csp.run();
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:BeforeClassOrAfterClassIsPublicStaticVoidNoArgInspection.java
示例2: doFix
import com.intellij.psi.PsiModifierList; //导入方法依赖的package包/类
@Override
public void doFix(Project project, ProblemDescriptor descriptor)
throws IncorrectOperationException {
final PsiElement element = descriptor.getPsiElement();
final PsiModifierListOwner modifierListOwner =
PsiTreeUtil.getParentOfType(element, PsiModifierListOwner.class);
if (modifierListOwner == null) {
return;
}
final PsiModifierList modifiers = modifierListOwner.getModifierList();
if (modifiers == null) {
return;
}
modifiers.setModifierProperty(modifierText, true);
}
示例3: fixModifierList
import com.intellij.psi.PsiModifierList; //导入方法依赖的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);
}
示例4: copyModifiers
import com.intellij.psi.PsiModifierList; //导入方法依赖的package包/类
private void copyModifiers(PsiModifierList fromModifierList, PsiModifierList resultModifierList) {
for (String modifier : PsiModifier.MODIFIERS) {
resultModifierList.setModifierProperty(modifier, fromModifierList.hasModifierProperty(modifier));
}
}
示例5: setVisibility
import com.intellij.psi.PsiModifierList; //导入方法依赖的package包/类
public static void setVisibility(PsiModifierList modifierList, @PsiModifier.ModifierConstant String newVisibility) throws IncorrectOperationException
{
modifierList.setModifierProperty(newVisibility, true);
}