Search code examples
eclipse-pluginswteclipse-rcp

SWT DirectoryDialog - get last selected folder


I'm using the org.eclipse.swt.widgets.DirectoryDialog for folder selection. I'm not setting the filter path and I notice the the dialog somehow remembers the last selection. When I select a folder, and then reopen the dialog - it points to the last selected folder.

My question is - can I get this "remembered" last selected folder somehow in SWT or plain Java?

Thanks! Dinko


Solution

  • No there is nothing for this.

    DirectoryDialog is just a thin wrapper around the native open directory dialog. It is the native dialog that is remembering (if it does, this may vary on different platforms).

    Looking at the macOS version of DirectoryDialog there is nothing in the Java code that knows about the previous selection.