I have a preference page with a list and few text boxes. I want to pop a warning dialog, to the user after he makes some changes and without hitting “apply” or “OK”, he presses cancel.
Something like “You have unsaved changes. Are you sure you want to cancel?”.
I tried putValue(String,String) but preference stores it immediately. How do I maintain an “intermediate” state sort of? Checking every text box’s value or list’s value would not be a good idea.
There is a method needsSaving() but I dont know how it works. How do i make it return true?
You can override
performCancelof the PreferencePage.Nevertheless I would recommend not do that (except for an RCP application). The general workflow for managing preferences is given by the surrounding framework and it might be confusing for users, if they get a warning when canceling your preferences, but not when canceling other warnings in the same Eclipse installation.