String path= dialog.open();
if (path == null)
return;
IFileStore fileStore= EFS.getLocalFileSystem().getStore(new Path(path));
IFileInfo fileInfo= fileStore.fetchInfo();
if (fileInfo.getAttribute(EFS.ATTRIBUTE_HIDDEN)) {
String title= TextEditorTemplateMessages.TemplatePreferencePage_export_error_title;
String message= NLSUtility.format(TextEditorTemplateMessages.TemplatePreferencePage_export_error_hidden, fileStore.toString());
MessageDialog.openError(getShell(), title, message);
return;
}
if (fileInfo.exists() && fileInfo.getAttribute(EFS.ATTRIBUTE_READ_ONLY)) {
String title= TextEditorTemplateMessages.TemplatePreferencePage_export_error_title;
String message= NLSUtility.format(TextEditorTemplateMessages.TemplatePreferencePage_export_error_canNotWrite, fileStore.toString());
MessageDialog.openError(getShell(), title, message);
return;
}
if (!fileInfo.exists() || confirmOverwrite(fileStore)) {
OutputStream output= null;
try {
output= new BufferedOutputStream(fileStore.openOutputStream(EFS.NONE, null));
TemplateReaderWriter writer= new TemplateReaderWriter();
writer.save(templates, output);
} catch (CoreException e) {
openWriteErrorDialog();
} catch (IOException e) {