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


Java Nls.Capitalization方法代码示例

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


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

示例1: invoke

import org.jetbrains.annotations.Nls; //导入方法依赖的package包/类
@Override
public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException {
  final PsiModifierListOwner modifierListOwner = getElement(editor, file);
  if (modifierListOwner == null) throw new IncorrectOperationException();

  BaseListPopupStep<Nls.Capitalization> step =
    new BaseListPopupStep<Nls.Capitalization>(null, Nls.Capitalization.Title, Nls.Capitalization.Sentence) {
      @Override
      public PopupStep onChosen(final Nls.Capitalization selectedValue, boolean finalChoice) {
        new WriteCommandAction.Simple(project) {
          @Override
          protected void run() throws Throwable {
            String nls = Nls.class.getName();
            PsiAnnotation annotation = JavaPsiFacade.getInstance(project).getElementFactory()
              .createAnnotationFromText("@" + nls + "(capitalization = " +
                                        nls + ".Capitalization." + selectedValue.toString() + ")", modifierListOwner);
            new AddAnnotationFix(Nls.class.getName(), modifierListOwner, annotation.getParameterList().getAttributes()).applyFix();
          }
        }.execute();
        return FINAL_CHOICE;
      }
    };
  JBPopupFactory.getInstance().createListPopup(step).showInBestPositionFor(editor);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:AnnotateCapitalizationIntention.java

示例2: getCapitalizationFromAnno

import org.jetbrains.annotations.Nls; //导入方法依赖的package包/类
public Nls.Capitalization getCapitalizationFromAnno(PsiModifierListOwner modifierListOwner) {
  PsiAnnotation nls = AnnotationUtil.findAnnotationInHierarchy(modifierListOwner, Collections.singleton(Nls.class.getName()));
  if (nls == null) return Nls.Capitalization.NotSpecified;
  PsiAnnotationMemberValue capitalization = nls.findAttributeValue("capitalization");
  Object cap = JavaPsiFacade.getInstance(modifierListOwner.getProject()).getConstantEvaluationHelper().computeConstantExpression(capitalization);
  return cap instanceof Nls.Capitalization ? (Nls.Capitalization)cap : Nls.Capitalization.NotSpecified;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:TitleCapitalizationInspection.java

示例3: checkCapitalization

import org.jetbrains.annotations.Nls; //导入方法依赖的package包/类
private static void checkCapitalization(PsiExpression element, @NotNull ProblemsHolder holder, Nls.Capitalization capitalization) {
  if (capitalization == Nls.Capitalization.NotSpecified) return;
  String titleValue = getTitleValue(element);
  if (!checkCapitalization(titleValue, capitalization)) {
    holder.registerProblem(element, "String '" + titleValue + "' is not properly capitalized. It should have " +
                                    StringUtil.toLowerCase(capitalization.toString()) + " capitalization",
                           ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new TitleCapitalizationFix(titleValue, capitalization));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:TitleCapitalizationInspection.java

示例4: TitleCapitalizationFix

import org.jetbrains.annotations.Nls; //导入方法依赖的package包/类
public TitleCapitalizationFix(String titleValue, Nls.Capitalization capitalization) {
  myTitleValue = titleValue;
  myCapitalization = capitalization;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:TitleCapitalizationInspection.java


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