I've just found this library of database models. It is a big collection of database models useful for faster kick-offs.
It is hosted by Database Answers and there are far more useful information there. It's a great resource.
./M6
SWT File Dialog
During the development of an Rich Client Platform (RCP) I needed to perform a file browse, here's how to show a file dialog in SWT:
The snippet above filters by text files (*.txt) and all files (*.*) only, and it can be easily applied to any button or file menu option click event.
./M6
import org.eclipse.swt.widgets.FileDialog;
FileDialog dialog = new FileDialog(this.getShell(), SWT.NULL);
dialog.setFilterExtensions(new String[] { "*.txt", "*.*" });
dialog.setFilterNames(new String[] { "Text files", "All files" });
String path = dialog.open();
if (path != null) {
File file = new File(path);
if (file.isFile()) {
System.out.println(file.toString());
}
}
The snippet above filters by text files (*.txt) and all files (*.*) only, and it can be easily applied to any button or file menu option click event.
./M6
Subscribe to:
Posts (Atom)