use of org.eclipse.swt.widgets.FileDialog in project translationstudio8 by heartsome.
the class RTFCleanerDialog method handleFile.
/**
* 处理 RTF 文件 ;
*/
private void handleFile() {
FileDialog dialog = new FileDialog(getShell(), SWT.MULTI);
dialog.setText(Messages.getString("dialog.RTFCleanerDialog.dialogTitle"));
String[] extensions = { "*.rtf", "*" };
String[] filters = { Messages.getString("dialog.RTFCleanerDialog.filters1"), Messages.getString("dialog.RTFCleanerDialog.filters2") };
dialog.setFilterExtensions(extensions);
dialog.setFilterNames(filters);
dialog.setFilterPath(System.getProperty("user.home"));
dialog.open();
String[] arrSource = dialog.getFileNames();
if (arrSource == null || arrSource.length == 0) {
return;
}
int errors = 0;
for (int i = 0; i < arrSource.length; i++) {
//$NON-NLS-1$
File f = new File(dialog.getFilterPath() + System.getProperty("file.separator") + arrSource[i]);
Hashtable<String, String> params = new Hashtable<String, String>();
//$NON-NLS-1$
params.put("source", f.getAbsolutePath());
//$NON-NLS-1$
params.put("output", f.getAbsolutePath());
Vector<String> result = RTFCleaner.run(params);
if (!"0".equals(result.get(0))) {
//$NON-NLS-1$
String msg = MessageFormat.format(Messages.getString("dialog.RTFCleanerDialog.msg1"), arrSource[i]) + (String) result.get(1);
MessageDialog.openInformation(getShell(), Messages.getString("dialog.RTFCleanerDialog.msgTitle"), msg);
errors++;
}
}
if (errors < arrSource.length) {
MessageDialog.openInformation(getShell(), Messages.getString("dialog.RTFCleanerDialog.msgTitle"), Messages.getString("dialog.RTFCleanerDialog.msg2"));
}
}
use of org.eclipse.swt.widgets.FileDialog in project translationstudio8 by heartsome.
the class PluginHelpDialog method openFile.
private void openFile() {
FileDialog fileDialog = new FileDialog(getShell(), SWT.OPEN);
String[] extensions = { "*.xml", "*.*" };
String[] filterNames = { Messages.getString("dialog.PluginHelpDialog.filterNames0"), Messages.getString("dialog.PluginHelpDialog.filterNames1") };
fileDialog.setFilterExtensions(extensions);
fileDialog.setFilterNames(filterNames);
fileDialog.setFilterPath(System.getProperty("user.home"));
String name = fileDialog.open();
if (name == null) {
return;
}
File file = new File(name);
getShell().setText(file.getName());
loadTree(file.getAbsolutePath());
}
use of org.eclipse.swt.widgets.FileDialog in project translationstudio8 by heartsome.
the class TMX2TXTConverterDialog method selecteTMXFile.
/**
* 选择TMX文件
*/
private void selecteTMXFile() {
FileDialog fd = new FileDialog(getShell(), SWT.OPEN);
String[] extensions = { "*.tmx", "*.*" };
fd.setFilterExtensions(extensions);
String[] names = { Messages.getString("dialog.TMX2TXTConverterDialog.TMXNames1"), Messages.getString("dialog.TMX2TXTConverterDialog.TMXNames2") };
fd.setFilterNames(names);
String file = fd.open();
if (file != null) {
tmxTxt.setText(file);
if (txtTxt.getText().equals("")) {
txtTxt.setText(file.substring(0, file.lastIndexOf(".")) + ".txt");
}
}
}
use of org.eclipse.swt.widgets.FileDialog in project translationstudio8 by heartsome.
the class TMX2TXTConverterDialog method selecteTXTFile.
/**
* 选择TXT文件 ;
*/
private void selecteTXTFile() {
FileDialog fd = new FileDialog(getShell(), SWT.OPEN);
String[] extensions = { "*.txt", "*.*" };
fd.setFilterExtensions(extensions);
String[] names = { Messages.getString("dialog.TMX2TXTConverterDialog.TXTNames1"), Messages.getString("dialog.TMX2TXTConverterDialog.TXTNames2") };
fd.setFilterNames(names);
String file = fd.open();
if (file != null) {
txtTxt.setText(file);
}
}
use of org.eclipse.swt.widgets.FileDialog in project translationstudio8 by heartsome.
the class TMXValidatorDialog method openFile.
/**
* 打开文件
*/
private void openFile() {
FileDialog fd = new FileDialog(getShell(), SWT.OPEN);
//$NON-NLS-1$ //$NON-NLS-2$
String[] extensions = { "*.tmx", "*.*" };
fd.setFilterExtensions(extensions);
String[] names = { Messages.getString("dialog.TMXValidatorDialog.names1"), Messages.getString("dialog.TMXValidatorDialog.names2") };
fd.setFilterNames(names);
String name = fd.open();
if (name != null) {
validate(name);
}
}
Aggregations