使用Java保存向导页面设置

使用Java保存向导页面设置,java,eclipse,eclipse-rcp,wizard,Java,Eclipse,Eclipse Rcp,Wizard,我创建了一个向导,向导页面用于导出文件夹中的文件。 如何保存向导中最后选定的文件夹? 因此,如果用户再次打开向导,他上次选择的选项应写入其中。您可以尝试以下操作: 1. Retrieve DialogSettings object. 2. Find your section. If it is null, create it. 3. Use it to store/load related information. IDialogSettings settings = Workbench

我创建了一个向导,向导页面用于导出文件夹中的文件。 如何保存向导中最后选定的文件夹?
因此,如果用户再次打开向导,他上次选择的选项应写入其中。

您可以尝试以下操作:

 1. Retrieve DialogSettings object.
 2. Find your section. If it is null, create it.
 3. Use it to store/load related information.

IDialogSettings settings = WorkbenchPlugin.getDefault().getDialogSettings();
IDialogSettings section = settings.getSection("your_section_name");
if (section == null) {
   section = settings.addNewSection("your_section_name");
} 
String lastSelectedFolder = section.get("your_last_selected_folder_key");
序列化设置对象