package com.onaro.sanscreen.client.error; import java.text.MessageFormat; import java.util.ResourceBundle; import javax.swing.JOptionPane; import com.onaro.commons.lang.OnaroExceptionUtils; import com.onaro.sanscreen.client.SANscreenClientPlugin; import com.onaro.sanscreen.server.license.data.LicenseException; public class LicenseExpirationErrorHandler extends MessageWindowHandler { /** * Gets the mesaages and titles from the resources. Set the options to "exit" and "ignore". * * @param bundle * locale dependant resources */ public LicenseExpirationErrorHandler(ResourceBundle bundle) { super(bundle.getString("server.license.expired.title"), //$NON-NLS-1$ MessageFormat.format(bundle.getString("server.license.expired.message"), SANscreenClientPlugin.getDefault().getBranding().getCompanyName()), //$NON-NLS-1$ JOptionPane.ERROR_MESSAGE); addActionExit(); } /** * Handle the error if the exception is any of: * * When checking for a match, the chain of causes is also searched. If an error is handled, make sure to flush the * {@link com.onaro.sanscreen.client.SessionsHelper}'s cache. * * @param shortDescription * an optional short description of the error * @param exception * only the above specified errors are handled * * @return true if the error was handled */ @Override public boolean handle(String shortDescription, Throwable exception) { if (OnaroExceptionUtils.isCause(exception, LicenseException.class)) { return super.handle(shortDescription, exception); } return false; } @Override protected boolean isLogOnly() { return false; } }