當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。