XComponent xComponent = null;
try {
// instantiate the folder picker and retrieve the necessary interfaces...
Object oFolderPicker = m_xMCF.createInstanceWithContext("com.sun.star.ui.dialogs.FolderPicker", m_xContext);
XFolderPicker xFolderPicker = (XFolderPicker) UnoRuntime.queryInterface(XFolderPicker.class, oFolderPicker);
XExecutableDialog xExecutable = (XExecutableDialog) UnoRuntime.queryInterface(XExecutableDialog.class, oFolderPicker);
xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, oFolderPicker);
xFolderPicker.setDisplayDirectory(_sDisplayDirectory);
// set the dialog title...
xFolderPicker.setTitle(_sTitle);
// show the dialog...
short nResult = xExecutable.execute();
// User has clicked "Select" button...
if (nResult == com.sun.star.ui.dialogs.ExecutableDialogResults.OK){
sReturnFolder = xFolderPicker.getDirectory();
}