String keyWithPrefix = subs[i].getKeyWithPrefix(fSubstitutionPrefix); String s = getBundleString(bundle, keyWithPrefix); if (s != null) { if (!hasSameValue(s, subs[i])) { String[] args = { keyWithPrefix, s, subs[i].fNLSElement.getValue()}; String msg = NLSMessages.getFormattedString("NLSrefactoring.already_exists", args); result.addFatalError(msg); } else { subs[i].putToPropertyFile = false; String[] args = { keyWithPrefix, s}; String msg = NLSMessages.getFormattedString("NLSrefactoring.already_in_bundle", args); result.addWarning(msg);
NLSSubstitution substitution = subs[i]; if ((substitution.getState() == NLSSubstitution.EXTERNALIZED) && substitution.hasStateChanged()) { String key = substitution.getKey(); String s = getBundleString(bundle, key); if (s != null) { if (!s.equals(substitution.getValue())) { String[] args = { key, s, substitution.getValue()}; String msg = NLSMessages.getFormattedString("NLSrefactoring.already_exists", args); result.addFatalError(msg); } else { String[] args = { key, s}; String msg = NLSMessages.getFormattedString("NLSrefactoring.already_in_bundle", args); result.addWarning(msg); }
    private RefactoringStatus checkForKeysAlreadyDefined() throws JavaModelException {        if (!propertyFileExists()) return null;        RefactoringStatus result = new RefactoringStatus();        PropertyResourceBundle bundle = getPropertyBundle();        if (bundle == null) { return null; }        NLSSubstitution[] subs = fNlsHolder.getSubstitutions();        for (int i = 0; i < subs.length; i++) {            String keyWithPrefix = subs[i].getKeyWithPrefix(fSubstitutionPrefix);            String s = getBundleString(bundle, keyWithPrefix);            if (s != null) {                if (!hasSameValue(s, subs[i])) {                    String[] args = { keyWithPrefix, s, subs[i].fNLSElement.getValue()};                    String msg = NLSMessages.getFormattedString("NLSrefactoring.already_exists", args); //$NON-NLS-1$                    result.addFatalError(msg);                } else {                    subs[i].putToPropertyFile = false;                    String[] args = { keyWithPrefix, s};                    String msg = NLSMessages.getFormattedString("NLSrefactoring.already_in_bundle", args); //$NON-NLS-1$                    result.addWarning(msg);                }            }        }        return result;    }