diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/NewPropertyAction.java b/plugins/properties/src/com/intellij/lang/properties/editor/NewPropertyAction.java index 2c841c15c97c..52f8d4036237 100644 --- a/plugins/properties/src/com/intellij/lang/properties/editor/NewPropertyAction.java +++ b/plugins/properties/src/com/intellij/lang/properties/editor/NewPropertyAction.java @@ -207,11 +207,10 @@ class NewPropertyAction extends AnAction { final ResourceBundle resourceBundle = myResourceBundleEditor.getResourceBundle(); for (final PropertiesFile propertiesFile : resourceBundle.getPropertiesFiles()) { - for (final String propertyName : propertiesFile.getNamesMap().keySet()) { - if (newPropertyName.equals(propertyName)) { - Messages.showErrorDialog("Can't add new property. Property with key \'" + newPropertyName + "\' already exists.", "New Property"); - return false; - } + IProperty key = propertiesFile.findPropertyByKey(newPropertyName); + if (key != null) { + Messages.showErrorDialog("Can't add new property. Property with key \'" + newPropertyName + "\' already exists.", "New Property"); + return false; } }