/**
* Closes a profile.
*/
public void closeProfile() {
CloseProfileAction closeAction = new CloseProfileAction(droidMainUi.getProfileManager(), context, this);
JOptionPaneProxy dialog = new JOptionPaneProxy() {
@Override
public int getResponse() {
int result = JOptionPane.showConfirmDialog(ProfileForm.this, "Save this profile?", "Warning",
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
int response = JOptionPaneProxy.CANCEL;
if (result == JOptionPane.YES_OPTION) {
response = JOptionPaneProxy.YES;
} else if (result == JOptionPane.NO_OPTION) {
response = JOptionPaneProxy.NO;
}
return response;
}
};
closeAction.setUserOptionDialog(dialog);
final JFileChooser fileChooser = context.getProfileFileChooser();
FileChooserProxy chooserProxy = new FileChooserProxyImpl(this, fileChooser);
closeAction.setSaveAction(new SaveProfileWorker(droidMainUi.getProfileManager(), this, chooserProxy));
closeAction.start();
}