Activator.getDefault().getLog().log(new Status(Status.ERROR, Activator.PLUGIN_ID, "Can't create propertyfile : " + labelFile.getLocation(), e));
}
}
// stores labelfile
FileOutputStream labelFileStream = null;
BufferedWriter writer = null;
try {
if (isSortLabelFiles()) {
Properties labelProperties = loadLabel(labelFile);
labelProperties.setProperty(key, value);
SortedProperties sortedProperties = new SortedProperties();
sortedProperties.putAll(labelProperties);
labelFileStream = new FileOutputStream(labelFile.getLocation().toString());
sortedProperties.store(labelFileStream, null);
} else {
// append new label to existing file
Properties labelProperties = loadLabel(labelFile);
if (!labelProperties.containsKey(key)) {
writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(labelFile.getLocation().toFile(), true), "8859_1"));
if(labelProperties.entrySet().size()>0){
writer.newLine();
}
writer.write(LabelFileEncodingHelper.saveConvert(key, true));
writer.write("=");
writer.write(LabelFileEncodingHelper.saveConvert(value, false));
writer.flush();
}
}
labelFile.refreshLocal(IResource.DEPTH_ZERO, new NullProgressMonitor());
} catch (FileNotFoundException e) {
Activator.getDefault().getLog().log(new Status(Status.ERROR, Activator.PLUGIN_ID, "Can't find propertyfile : " + labelFile.getLocation(), e));
} catch (IOException e) {
Activator.getDefault().getLog().log(new Status(Status.ERROR, Activator.PLUGIN_ID, "Can't write propertyfile : " + labelFile.getLocation(), e));
} catch (CoreException e) {
Activator.getDefault().getLog().log(new Status(Status.ERROR, Activator.PLUGIN_ID, "Can't find propertyfile : " + labelFile.getLocation(), e));
}finally{
if(labelFileStream!=null){
try {
labelFileStream.close();
} catch (IOException e) {
}
}
if(writer!=null){
try {