private void handleDispose() {
   Protocol.invokeAndWait(
       new Runnable() {
         public void run() {
           disconnectPeer();
           fFileSystem = null;
           fDisplay = null;
         }
       });
 }
  /**
   * Closes the given channel and handle the given exception.
   *
   * @param channel The channel instance or <code>null</code>.
   * @param exception The exception to handle. Must be not <code>null</code>.
   */
  protected void handleException(IChannel channel, Throwable exception) {
    Assert.isNotNull(exception);

    // Close the backend channel
    if (channel != null) {
      final IChannel finChannel = channel;
      if (Protocol.isDispatchThread()) {
        finChannel.close();
      } else {
        Protocol.invokeAndWait(
            new Runnable() {
              @Override
              public void run() {
                finChannel.close();
              }
            });
      }
    }

    // Get the status handler
    IStatusHandler[] handler = StatusHandlerManager.getInstance().getHandler(getClass());
    if (handler != null && handler.length > 0) {
      // If the exception is a core exception, we can pass on the status object to the handler
      IStatus status = null;
      if (exception instanceof CoreException) ((CoreException) exception).getStatus();
      else {
        // Construct the status from the exception
        status =
            new Status(
                IStatus.ERROR,
                UIPlugin.getUniqueIdentifier(),
                0,
                exception.getLocalizedMessage(),
                exception);
      }

      // Handle the status (Take the first status handler in the list)
      if (status != null) {
        IPropertiesContainer data = new PropertiesContainer();
        data.setProperty(IStatusHandlerConstants.PROPERTY_TITLE, getStatusDialogTitle());
        data.setProperty(
            IStatusHandlerConstants.PROPERTY_CONTEXT_HELP_ID, getStatusDialogContextHelpId());
        data.setProperty(
            IStatusHandlerConstants.PROPERTY_DONT_ASK_AGAIN_ID, getStatusDialogDontAskAgainKey());
        data.setProperty(IStatusHandlerConstants.PROPERTY_CALLER, this);

        handler[0].handleStatus(status, data, null);
      }
    }
  }
 public void setInput(IPeer peer) {
   if (peer == fPeer) {
     return;
   }
   if (fPeer != null) {
     Protocol.invokeAndWait(
         new Runnable() {
           public void run() {
             disconnectPeer();
           }
         });
   }
   fileTree.setItemCount(0);
   fRootInfo.children = null;
   fPeer = peer;
   if (fPeer != null) {
     Protocol.invokeAndWait(
         new Runnable() {
           public void run() {
             connectPeer();
           }
         });
   }
 }