Skip to content

Commit

Permalink
[INTERNAL][I] Move xmpp error callback into lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
m273d15 committed May 27, 2020
1 parent 26b435e commit b87e670
Showing 1 changed file with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
package saros.intellij.ui.eventhandler;

import saros.account.XMPPAccount;
import saros.communication.connection.ConnectionHandler;
import saros.communication.connection.IConnectingFailureCallback;
import saros.intellij.ui.util.NotificationPanel;
import saros.ui.CoreMessages;

/** Callback handler informing the user of a failed XMPP connection attempt. */
public class ConnectingFailureHandler {

@SuppressWarnings("FieldCanBeLocal")
private final IConnectingFailureCallback connectingFailureCallback = this::handleConnectionFailed;

public ConnectingFailureHandler(ConnectionHandler connectionHandler) {
connectionHandler.setCallback(connectingFailureCallback);
}

public void handleConnectionFailed(XMPPAccount account, String errorMessage) {
// TODO offer user possibility of adjusting settings and re-connect
NotificationPanel.showError(errorMessage, CoreMessages.ConnectingFailureHandler_title);
connectionHandler.setCallback(
(account, errorMessage) -> {
// TODO offer user possibility of adjusting settings and re-connect
NotificationPanel.showError(errorMessage, CoreMessages.ConnectingFailureHandler_title);
});
}
}

0 comments on commit b87e670

Please sign in to comment.