/** * Creates and returns a new {@link Property} based on key and value inputs.<br> */ private static Property newProperty(String key, String value) { Property property = PropertiesFactory.eINSTANCE.createProperty(); property.setKey(key); property.setValue(value); return property; }
if(matcher.matches()) property = PropertiesFactory.eINSTANCE.createProperty(); property.setKey(matcher.group(1).replace("\\n", "\n")); if(comment.length()>0)
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if(is("header",uri,qName,localName)) { srcLanguage = attributes.getValue("", "srclang"); } else if(is("tu",uri,qName,localName)) { current = PropertiesFactory.eINSTANCE.createProperty(); } else if(is("tuv",uri,qName,localName)) { currentLanguage = attributes.getValue("xml:lang"); } else if(is("seg",uri,qName,localName)) { currentValue = new StringBuilder(); } }
public Property getOrCreateTranslation() { Property property = getTranslation(); if(property==null) { property = PropertiesFactory.eINSTANCE.createProperty(); property.setKey(getTemplate().getKey()); this.translation = property; } return property; }
property = PropertiesFactory.eINSTANCE.createProperty(); if(comment.length()>0) { property.setComment(comment.toString());
return null; Document translationDoc = searchResult.getSearcher().doc(searchResult.getTopDocs().scoreDocs[0].doc); Property property = PropertiesFactory.eINSTANCE.createProperty(); property.setKey(key); property.setValue(translationDoc.get(QueryService.FIELD_VALUE));
/** * If we make it here, we know that the {@link Property} exists in the master * {@link PropertyFileDescriptor}, but we don't know if a corresponding {@link Property} exists * for the existing {@link PropertyFile}. If it does not, we create a new {@link Property}.<br> * * Hence perform a quick check, and create a new {@link Property} which we add to this * {@link PropertyFileDescriptor} if it does not yet exist.<br> */ private static void updateExistingProperty(PropertyFile existingFile, Property existingProperty, Property newProperty) { if (existingProperty == null) { existingProperty = PropertiesFactory.eINSTANCE.createProperty(); existingProperty.setKey(newProperty.getKey()); existingFile.getProperties().add(existingProperty); } existingProperty.setValue(newProperty.getValue()); existingProperty.setComment(newProperty.getComment()); }
Property translation = translated.remove(property.getKey()); if (translation == null) translation = PropertiesFactory.eINSTANCE.createProperty(); translation.setKey(property.getKey()); PropertyPair pair = new PropertyPair(EcoreUtil.copy(property), EcoreUtil.copy(translation), isTemplateOnly ? ProjectLocale.TEMPLATE_LOCALE : descriptor.getVariant(), descriptor.cdoID());
Property newProperty = PropertiesFactory.eINSTANCE.createProperty(); newProperty.setKey(prop.getKey()); original.getProperties().add(newProperty);