List of usage examples for org.apache.commons.configuration PropertiesConfiguration setProperty
public void setProperty(String key, Object value)
From source file:umich.ms.batmass.filesupport.core.types.descriptor.FileDescriptor.java
/** * Saves a FileDescriptor to a properties based file. * @param file File to save the descriptor to * @param desc Descriptor to be saved/*w w w. j a v a2 s . co m*/ * @throws org.apache.commons.configuration.ConfigurationException */ public static void writeToFile(File file, FileDescriptor desc) throws ConfigurationException { PropertiesConfiguration conf = new PropertiesConfiguration(file); conf.setProperty(PROP_UID, desc.getUID()); conf.setProperty(PROP_PATH, desc.getPath().toString()); conf.setProperty(PROP_SIZE, desc.getSize()); conf.setProperty(PROP_FILE_CATEGORY, desc.getFileCategory()); conf.setProperty(PROP_FILE_TYPE, desc.getFileType()); List<Path> children = desc.getChildren(); String[] paths = new String[children.size()]; for (int i = 0; i < paths.length; i++) { paths[i] = children.get(i).toString(); } conf.setProperty(PROP_CHILDREN, paths); conf.save(); }
From source file:umich.ms.batmass.projects.core.type.defaultoperations.BMProjectMoveOrRenameoperation.java
@Override public void notifyRenamed(String nueName) throws IOException { NotifyDescriptor.InputLine input = new NotifyDescriptor.InputLine("new name is", "In CustomerProjectMoveOrRenameOperation.notifyRenamed()"); input.setInputText(nueName);//w ww . j a v a2 s . co m Object result = DialogDisplayer.getDefault().notify(input); try { if (this == null) { throw new IllegalArgumentException("Project is null"); } if (!ProjectOperations.isMoveOperationSupported(project)) { throw new IllegalArgumentException("Attempt to rename project that does not support move."); } PropertiesConfiguration config = project.getConfig(); config.setProperty("project.name", nueName); config.save(); } catch (ConfigurationException ex) { Exceptions.printStackTrace(ex); } }