/** * 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; }
property.setKey(matcher.group(1).replace("\\n", "\n")); if(comment.length()>0) property.setComment(comment.toString());
public Property getOrCreateTranslation() { Property property = getTranslation(); if(property==null) { property = PropertiesFactory.eINSTANCE.createProperty(); property.setKey(getTemplate().getKey()); this.translation = property; } return property; }
continue; property.setKey(parts[0]); property.setValue(parts[1]); checkedForHeader = true;
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)); property.setComment(translationDoc.get(QueryService.FIELD_COMMENT));
current.setKey(currentValue.toString());
/** * 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()); }
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()); String key = pair.getKey();
newProperty.setKey(prop.getKey()); original.getProperties().add(newProperty);