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; }
public void deletePropertyIfExist(String key, PropertiesFile file) { final IProperty property = file.findPropertyByKey(key); if (property != null && myKeysOrder != null) { boolean keyExistInOtherPropertiesFiles = false; for (PropertiesFile propertiesFile : myResourceBundle.getPropertiesFiles()) { if (!propertiesFile.equals(file) && propertiesFile.findPropertyByKey(key) != null) { keyExistInOtherPropertiesFiles = true; break; } } if (!keyExistInOtherPropertiesFiles) { myKeysOrder.remove(key); } } if (property != null) { PsiElement anElement = property.getPsiElement(); if (anElement instanceof PomTargetPsiElement) { final PomTarget xmlProperty = ((PomTargetPsiElement) anElement).getTarget(); LOG.assertTrue(xmlProperty instanceof XmlProperty); anElement = ((XmlProperty) xmlProperty).getNavigationElement(); } anElement.delete(); } }