protected PropertyFileDescriptor createDescriptor(ProjectLocale projectLocale, URI childURI) { PropertyFileDescriptor fileDescriptor = PropertiesFactory.eINSTANCE.createPropertyFileDescriptor(); fileDescriptor.setLocation(childURI); fileDescriptor.setName(childURI.lastSegment()); fileDescriptor.setVariant(projectLocale.getLocale()); projectLocale.getDescriptors().add(fileDescriptor); Resolvable<?, Resolvable<?, ?>> parent = getOrCreateParent(projectLocale, childURI); parent.getChildren().add(fileDescriptor); return fileDescriptor; }
translatedDescriptor.setLocation(derivedLocation); translatedDescriptor.setName(derivedLocation.lastSegment()); translatedDescriptor.setMaster(descriptor);
private static void createMissingChildren(ProjectLocale template, ProjectLocale other) { EList<PropertyFileDescriptor> descriptors = template.getDescriptors(); for (PropertyFileDescriptor descriptor : descriptors) { URI derivedLocation = computeLocaleResourceLocation(other.getLocale(), other.getParent(), descriptor.getLocation()); Resolvable<?, ?> child = other.resolveChild(derivedLocation); if(child==null){ Resolvable<?, ?> folder = getOrCreateFolder(other, derivedLocation.trimSegments(1).segments()); PropertyFileDescriptor localeDescriptor = PropertiesFactory.eINSTANCE.createPropertyFileDescriptor(); localeDescriptor.setMaster(descriptor); localeDescriptor.setVariant(other.getLocale()); localeDescriptor.setLocation(derivedLocation); localeDescriptor.setProjectLocale(other); localeDescriptor.setParent(folder); localeDescriptor.setName(URI.decode(derivedLocation.lastSegment())); } } }