protected RemoteServer getRemoteServer() {
   if (serverWC != null) {
     return (RemoteServer) serverWC.loadAdapter(RemoteServer.class, null);
   } else {
     return null;
   }
 }
  public void propertyChange(PropertyChangeEvent evt) {
    if (IRemoteServer.ATTR_HOSTNAME.equals(evt.getPropertyName())
        || IRemoteServer.ATTR_HTTP_PORT.equals(evt.getPropertyName())
        || IRemoteServer.ATTR_USERNAME.equals(evt.getPropertyName())
        || IRemoteServer.ATTR_PASSWORD.equals(evt.getPropertyName())
        || IRemoteServer.ATTR_LIFERAY_PORTAL_CONTEXT_PATH.equals(evt.getPropertyName())
        || IRemoteServer.ATTR_SERVER_MANAGER_CONTEXT_PATH.equals(evt.getPropertyName())) {

      LiferayServerCore.updateConnectionSettings(
          (IRemoteServer) serverWC.loadAdapter(IRemoteServer.class, null));
    }
  }
  public void setServer(IServerWorkingCopy newServer) {
    if (newServer == null) {
      serverWC = null;
      remoteServerWC = null;
    } else {
      serverWC = newServer;
      remoteServerWC =
          (IRemoteServerWorkingCopy) serverWC.loadAdapter(IRemoteServerWorkingCopy.class, null);

      serverWC.addPropertyChangeListener(this);
    }

    disableValidation = true;
    initialize();
    disableValidation = false;
    validate();
  }