本文整理汇总了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);
}
示例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;
}
示例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));
}
}
示例4: TitleCapitalizationFix
import org.jetbrains.annotations.Nls; //导入方法依赖的package包/类
public TitleCapitalizationFix(String titleValue, Nls.Capitalization capitalization) {
myTitleValue = titleValue;
myCapitalization = capitalization;
}