本文整理匯總了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;
}