
cox_tj1.5524906347442546E12 asked a question.
How to restart Window service AFTER user "cancels" during install??
During my install, I shutdown a particular window's service. This works fine. However, if the user cancels from the installation, I would like a chance to restart the service that I earlier shutdown. There is no onCancelling even that gets fired for the install (IS11.5MP Windows). I looked at putting some code in the Cancel Frame dialog's clicked event, but once the wizardUI.doCancel(); executes, there user was already presented with a Yes/No cancel dialog and it seems like I cant execute any useful code after this - I get an illegal state exception saying the wizardservice is already shutdown
Any ideas on how to restart a windows service once the user says "Yes" to the Are you sure you want to cancel the install?
Thanks!
import com.installshield.product.ProductActionSupport;
import com.installshield.product.ProductException;
import javax.swing.*;
public class RollbackAction extends ProductAction {
/* (non-Javadoc)
* @see com.installshield.product.ProductActionuninstall(com.installshield.product.ProductActionSupport)
*/
public void uninstall(ProductActionSupport support) throws ProductException {
if (support.getOperationState().isCanceled()) {
JOptionPane.showMessageDialog(null, "Rolling back action "+getBeanId());
// Do Rollback here
}
else {
JOptionPane.showMessageDialog(null, "Uninstalling action "+getBeanId()+ " normally.");
// Normal uninstall here or more likely no-op
}
}
}
Note that this will only work if the user cancels the install during the progress bar. On any panel in the post-install sequence, it is too late--they must run the separate uninstaller.