2013-07-23 27 views
0

我用嚮導頁創建了一個嚮導,用於導出文件夾中的文件。 如何在我的嚮導中保存上次選擇的文件夾? 因此,如果用戶再次打開該向導,則應該在上面寫入他上次選擇的選項。用Java保存WizardPage設置

+0

序列化設置對象http://docs.oracle.com/javase/tutorial/jndi/objects/serial.html – AurA

回答

1

你可以嘗試以下操作:

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"); 
+0

完美的作品,謝謝 – Iron