@Override
 public void stop(BundleContext context) throws Exception {
   plugin = null;
   if (connectionsRegistryListener != null) {
     ConnectionsRegistrySingleton.getInstance().removeListener(connectionsRegistryListener);
     connectionsRegistryListener = null;
   }
   super.stop(context);
 }
  @Override
  public void start(BundleContext context) throws Exception {
    super.start(context);
    plugin = this;

    connectionsRegistryListener =
        new ConnectionsRegistryAdapter() {
          @Override
          public void connectionAdded(IConnection connection) {
            try {
              OpenShiftUIUtils.showOpenShiftExplorer();
            } catch (Exception e) {
              // Can happen during workbench startup, while the core
              // plugins are starting.
              // Since mutiple connections would cause multiple errors,
              // it's probably better to swallow the exception, else a
              // user would see multiple
              // errors in the log, every time the workbench starts.
            }
          }
        };
    ConnectionsRegistrySingleton.getInstance().addListener(connectionsRegistryListener);
  }