本文整理汇总了Java中com.intellij.lang.properties.psi.PropertiesFile.isAlphaSorted方法的典型用法代码示例。如果您正苦于以下问题:Java PropertiesFile.isAlphaSorted方法的具体用法?Java PropertiesFile.isAlphaSorted怎么用?Java PropertiesFile.isAlphaSorted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.lang.properties.psi.PropertiesFile
的用法示例。
在下文中一共展示了PropertiesFile.isAlphaSorted方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildVisitor
import com.intellij.lang.properties.psi.PropertiesFile; //导入方法依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
return new PsiElementVisitor() {
@Override
public void visitFile(PsiFile file) {
final PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(file);
if (!(propertiesFile instanceof PropertiesFileImpl)) {
return;
}
for (AlphaUnsortedPropertiesFileInspectionSuppressor filter : AlphaUnsortedPropertiesFileInspectionSuppressor.EP_NAME.getExtensions()) {
if (filter.suppressInspectionFor(propertiesFile)) {
return;
}
}
final ResourceBundle resourceBundle = propertiesFile.getResourceBundle();
final String resourceBundleBaseName = resourceBundle.getBaseName();
if (!isResourceBundleAlphaSortedExceptOneFile(resourceBundle, propertiesFile)) {
final List<PropertiesFile> allFiles = resourceBundle.getPropertiesFiles();
holder.registerProblem(file, String.format(MESSAGE_TEMPLATE_WHOLE_RESOURCE_BUNDLE, resourceBundleBaseName),
ProblemHighlightType.INFO,
new PropertiesSorterQuickFix(true, allFiles.toArray(new PropertiesFile[allFiles.size()])));
return;
}
if (!propertiesFile.isAlphaSorted()) {
holder.registerProblem(file, "Properties file is unsorted", ProblemHighlightType.INFO, new PropertiesSorterQuickFix(true, propertiesFile));
}
}
};
}
示例2: isResourceBundleAlphaSortedExceptOneFile
import com.intellij.lang.properties.psi.PropertiesFile; //导入方法依赖的package包/类
private static boolean isResourceBundleAlphaSortedExceptOneFile(final @NotNull ResourceBundle resourceBundle,
final @NotNull PropertiesFile exceptedFile) {
for (PropertiesFile file : resourceBundle.getPropertiesFiles()) {
if (!(file instanceof PropertiesFileImpl)) {
return true;
}
if (!file.equals(exceptedFile) && !file.isAlphaSorted()) {
return false;
}
}
return true;
}
示例3: applyFix
import com.intellij.lang.properties.psi.PropertiesFile; //导入方法依赖的package包/类
@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
final boolean force = myFilesToSort.length == 1;
for (PropertiesFile file : myFilesToSort) {
if (!force && file.isAlphaSorted()) {
continue;
}
sortPropertiesFile(file);
}
}