Bug 16986 JavaViewer example should remember path
The JavaViewer example does not remember the path of the last file opened. Every time the user opens a file, he has to walk the file system again. This can be easily done by keeping the FileDialog around.
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaViewer.java
createStyledText ();
	shell.open ();
	return shell;
}
void openFile() {	
	final String textString;
	FileDialog fileDialog = new FileDialog(shell, SWT.OPEN);
	fileDialog.setFilterExtensions(new String[] {"*.java", "*.*"});
	fileDialog.open();
	String name = fileDialog.getFileName();
	
	if ((name == null) || (name.length() == 0)) return;
	File file = new File(fileDialog.getFilterPath(), name);
	if (!file.exists()) {
		String message = MessageFormat.format(resources.getString("Err_file_no_exist"), new String[] {file.getName()});
		displayError(message);
		return;
	}
	try {
		FileInputStream stream= new FileInputStream(file.getPath());
		try {
			Reader in = new BufferedReader(new InputStreamReader(stream));
			char[] readBuffer= new char[2048];
			StringBuffer buffer= new StringBuffer((int) file.length());
			int n;
			while ((n = in.read(readBuffer)) > 0) {
				buffer.append(readBuffer, 0, n);
			}
			textString = buffer.toString();
			stream.close();