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


Java PsiModifier.PUBLIC属性代码示例

本文整理汇总了Java中com.intellij.psi.PsiModifier.PUBLIC属性的典型用法代码示例。如果您正苦于以下问题:Java PsiModifier.PUBLIC属性的具体用法?Java PsiModifier.PUBLIC怎么用?Java PsiModifier.PUBLIC使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.intellij.psi.PsiModifier的用法示例。


在下文中一共展示了PsiModifier.PUBLIC属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getVisibility

@Nullable
public String getVisibility() {
  if (myRbPublic.isSelected()) {
    return PsiModifier.PUBLIC;
  }
  if (myRbPackageLocal.isSelected()) {
    return PsiModifier.PACKAGE_LOCAL;
  }
  if (myRbProtected.isSelected()) {
    return PsiModifier.PROTECTED;
  }
  if (myRbPrivate.isSelected()) {
    return PsiModifier.PRIVATE;
  }
  if (myRbEscalate != null && myRbEscalate.isSelected()) {
    return VisibilityUtil.ESCALATE_VISIBILITY;
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:JavaVisibilityPanel.java

示例2: doFix

@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,代码行数:20,代码来源:BeforeClassOrAfterClassIsPublicStaticVoidNoArgInspection.java

示例3: doTest

private static void doTest(final PsiClass aClass,
                           final String conflicts,
                           final boolean generateGetters,
                           final boolean generateSetters,
                           final PsiField... fields) {
  try {
    final Project project = aClass.getProject();
    EncapsulateFieldsProcessor processor = new EncapsulateFieldsProcessor(project, new EncapsulateFieldsDescriptor() {
      @Override
      public FieldDescriptor[] getSelectedFields() {
        final FieldDescriptor[] descriptors = new FieldDescriptor[fields.length];
        for (int i = 0; i < fields.length; i++) {
          descriptors[i] = new FieldDescriptorImpl(
            fields[i],
            GenerateMembersUtil.suggestGetterName(fields[i]),
            GenerateMembersUtil.suggestSetterName(fields[i]),
            isToEncapsulateGet() ? GenerateMembersUtil.generateGetterPrototype(fields[i]) : null,
            isToEncapsulateSet() ? GenerateMembersUtil.generateSetterPrototype(fields[i]) : null
          );
        }
        return descriptors;
      }

      @Override
      public boolean isToEncapsulateGet() {
        return generateGetters;
      }

      @Override
      public boolean isToEncapsulateSet() {
        return generateSetters;
      }

      @Override
      public boolean isToUseAccessorsWhenAccessible() {
        return true;
      }

      @Override
      public String getFieldsVisibility() {
        return null;
      }

      @Override
      public String getAccessorsVisibility() {
        return PsiModifier.PUBLIC;
      }

      @Override
      public int getJavadocPolicy() {
        return DocCommentPolicy.MOVE;
      }

      @Override
      public PsiClass getTargetClass() {
        return aClass;
      }
    });
    processor.run();
    LocalFileSystem.getInstance().refresh(false);
    FileDocumentManager.getInstance().saveAllDocuments();
  }
  catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
    if (conflicts != null) {
      Assert.assertEquals(conflicts, e.getMessage());
      return;
    }
    else {
      e.printStackTrace();
      fail(e.getMessage());
    }
  }
  if (conflicts != null) {
    fail("Conflicts were not detected: " + conflicts);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:76,代码来源:EncapsulateFieldsTest.java

示例4: buildFix

@Nullable
@Override
protected InspectionGadgetsFix buildFix(Object... infos) {
  return new ChangeModifierFix(PsiModifier.PUBLIC);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:NonPublicCloneInspection.java

示例5: GrMakeMemberPublicIntention

public GrMakeMemberPublicIntention() {
  super(PsiModifier.PUBLIC);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:3,代码来源:GrMakeMemberPublicIntention.java

示例6: getModifier

@Override
protected String getModifier() {
  return PsiModifier.PUBLIC;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:MakePublicIntention.java


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