private NLSSubstitution[] createSubstitutions(NLSLine[] lines, Properties props, CompilationUnit astRoot) { List<NLSSubstitution> result= new ArrayList<>(); for (int i= 0; i < lines.length; i++) { NLSElement[] elements= lines[i].getElements(); for (int j= 0; j < elements.length; j++) { NLSElement nlsElement= elements[j]; if (nlsElement.hasTag()) { AccessorClassReference accessorClassReference= NLSHintHelper.getAccessorClassReference(astRoot, nlsElement); if (accessorClassReference == null) { // no accessor class => not translated result.add(new NLSSubstitution(NLSSubstitution.IGNORED, stripQuotes(nlsElement.getValue()), nlsElement)); } else { String key= stripQuotes(nlsElement.getValue()); String value= props.getProperty(key); result.add(new NLSSubstitution(NLSSubstitution.EXTERNALIZED, key, value, nlsElement, accessorClassReference)); } } else if (nlsElement.isEclipseNLS()) { String key= nlsElement.getValue(); result.add(new NLSSubstitution(NLSSubstitution.EXTERNALIZED, key, props.getProperty(key), nlsElement, nlsElement.getAccessorClassReference())); } else { result.add(new NLSSubstitution(NLSSubstitution.INTERNALIZED, stripQuotes(nlsElement.getValue()), nlsElement)); } } } return result.toArray(new NLSSubstitution[result.size()]); }
private NLSSubstitution[] createSubstitutions(NLSLine[] lines, Properties props, CompilationUnit astRoot) { List<NLSSubstitution> result= new ArrayList<>(); for (int i= 0; i < lines.length; i++) { NLSElement[] elements= lines[i].getElements(); for (int j= 0; j < elements.length; j++) { NLSElement nlsElement= elements[j]; if (nlsElement.hasTag()) { AccessorClassReference accessorClassReference= NLSHintHelper.getAccessorClassReference(astRoot, nlsElement); if (accessorClassReference == null) { // no accessor class => not translated result.add(new NLSSubstitution(NLSSubstitution.IGNORED, stripQuotes(nlsElement.getValue()), nlsElement)); } else { String key= stripQuotes(nlsElement.getValue()); String value= props.getProperty(key); result.add(new NLSSubstitution(NLSSubstitution.EXTERNALIZED, key, value, nlsElement, accessorClassReference)); } } else if (nlsElement.isEclipseNLS()) { String key= nlsElement.getValue(); result.add(new NLSSubstitution(NLSSubstitution.EXTERNALIZED, key, props.getProperty(key), nlsElement, nlsElement.getAccessorClassReference())); } else { result.add(new NLSSubstitution(NLSSubstitution.INTERNALIZED, stripQuotes(nlsElement.getValue()), nlsElement)); } } } return result.toArray(new NLSSubstitution[result.size()]); }
private NLSSubstitution[] createSubstitutions(NLSLine[] lines, Properties props, CompilationUnit astRoot) { List result= new ArrayList(); for (int i= 0; i < lines.length; i++) { NLSElement[] elements= lines[i].getElements(); for (int j= 0; j < elements.length; j++) { NLSElement nlsElement= elements[j]; if (nlsElement.hasTag()) { AccessorClassReference accessorClassReference= NLSHintHelper.getAccessorClassReference(astRoot, nlsElement); if (accessorClassReference == null) { // no accessor class => not translated result.add(new NLSSubstitution(NLSSubstitution.IGNORED, stripQuotes(nlsElement.getValue()), nlsElement)); } else { String key= stripQuotes(nlsElement.getValue()); String value= props.getProperty(key); result.add(new NLSSubstitution(NLSSubstitution.EXTERNALIZED, key, value, nlsElement, accessorClassReference)); } } else if (nlsElement.isEclipseNLS()) { String key= nlsElement.getValue(); result.add(new NLSSubstitution(NLSSubstitution.EXTERNALIZED, key, props.getProperty(key), nlsElement, nlsElement.getAccessorClassReference())); } else { result.add(new NLSSubstitution(NLSSubstitution.INTERNALIZED, stripQuotes(nlsElement.getValue()), nlsElement)); } } } return (NLSSubstitution[]) result.toArray(new NLSSubstitution[result.size()]); }