/** Called by application in case of new events for observer. */
  @Override
  public void handleEvent(Application pApplication, ApplicationEvent pEvent) {
    pApplication.getLogger().log(this, "Got update event " + pEvent + " from " + pApplication);

    if (pEvent instanceof ApplicationEventConnectError) {
      ApplicationEventConnectError tEvConErr = (ApplicationEventConnectError) pEvent;
      NetworkException tExc = tEvConErr.getNetworkEception();

      if (tExc instanceof RoutingException) {
        MessageBoxDialog.open(
            getSite().getShell(),
            "Routing error",
            "The routing wasn't able to find a path to " + mRelayClient.getDestination(),
            SWT.ICON_ERROR);
      } else if (tExc instanceof RequirementsException) {
        MessageBoxDialog.open(
            getSite().getShell(),
            "Requirements error",
            "The given requirements \""
                + ((RequirementsException) tExc).getRequirements()
                + "\" for the connection couldn't be fullfilled.",
            SWT.ICON_ERROR);
      } else {
        MessageBoxDialog.open(
            getSite().getShell(), "Error", "Error: " + tExc.getMessage(), SWT.ICON_ERROR);
      }
    }

    if (pEvent instanceof ApplicationEventExit) {
      EditorUtils.closeEditor(getSite(), this);
    }
  }