private void showHideTexts() {
    if (passwordText != null && !passwordText.isDisposed()) {
      boolean enablePasswordField = false;
      if (connection != null) {
        IRepositoryFactory factory =
            RepositoryFactoryProvider.getRepositoriyById(connection.getRepositoryId());
        if (factory != null && factory.isAuthenticationNeeded()) {
          enablePasswordField = true;
        }
      } else if (getRepository() != null
          && RepositoryConstants.REPOSITORY_REMOTE_ID.equals(getRepository().getId())) {
        enablePasswordField = true;
      }

      if (enablePasswordField) {
        passwordText.setBackground(LoginDialogV2.WHITE_COLOR);
      } else {
        passwordText.setText(""); // $NON-NLS-1$
        passwordText.setBackground(LoginDialogV2.GREY_COLOR);
      }
      passwordText.setEnabled(enablePasswordField);
      passwordText.setEditable(enablePasswordField);

      hideControl(passwordText, !enablePasswordField, false);
      hideControl(passwordLabel, !enablePasswordField, false);

      passwordText.getParent().layout();
    }
  }
  private List<IRepositoryFactory> getUsableRepositoryProvider() {
    List<IRepositoryFactory> availableRepositories =
        RepositoryFactoryProvider.getAvailableRepositories();

    List<IRepositoryFactory> result = new ArrayList<IRepositoryFactory>();
    for (IRepositoryFactory repositoryFactory : availableRepositories) {
      if (repositoryFactory.isDisplayToUser()) {
        result.add(repositoryFactory);
      }
    }
    return result;
  }
  private void fillFields() {
    if (connection != null) {
      removeListeners();
      String repositoryId = connection.getRepositoryId();
      if (repositoryId == null || "".equals(repositoryId)) {
        if (getRepository() != null) {
          connection.setRepositoryId(getRepository().getId());
        } else {
          connection.setRepositoryId(RepositoryConstants.REPOSITORY_LOCAL_ID);
        }
      }
      IRepositoryFactory repositoriyById =
          RepositoryFactoryProvider.getRepositoriyById(repositoryId);
      repositoryCombo.setSelection(new StructuredSelection(new Object[] {repositoriyById}));

      if (getRepository() != null) {
        Map<String, LabelText> map = dynamicControls.get(getRepository());

        for (String fieldKey : map.keySet()) {
          LabelText current = map.get(fieldKey);
          String string = connection.getDynamicFields().get(fieldKey);
          current.setText(string == null ? "" : string); // $NON-NLS-1$
        }

        Map<String, LabelledCombo> map2 = dynamicChoices.get(getRepository());
        for (String fieldKey : map2.keySet()) {
          Combo combo = map2.get(fieldKey).getCombo();
          String value = connection.getDynamicFields().get(fieldKey);
          combo.deselectAll();
          for (DynamicChoiceBean dynamicChoiceBean : getRepository().getChoices()) {
            if (dynamicChoiceBean.getId().equals(fieldKey)) {
              combo.select(dynamicChoiceBean.getChoiceIndex(value));
            }
          }
        }
      }
      nameText.setText((connection.getName() == null ? "" : connection.getName())); // $NON-NLS-1$
      descriptionText.setText(
          (connection.getDescription() == null ? "" : connection.getDescription())); // $NON-NLS-1$
      userText.setText((connection.getUser() == null ? "" : connection.getUser())); // $NON-NLS-1$
      passwordText.setText(
          (connection.getPassword() == null ? "" : connection.getPassword())); // $NON-NLS-1$
      workSpaceText.setText(
          ("".equals(connection.getWorkSpace()) || connection.getWorkSpace() == null)
              ? getRecentWorkSpace()
              : connection.getWorkSpace()); // $NON-NLS-1$
      addListeners();
    }
  }
 private void showHideTexts() {
   if (connection != null) {
     IRepositoryFactory factory =
         RepositoryFactoryProvider.getRepositoriyById(connection.getRepositoryId());
     if (factory != null) {
       boolean authenticationNeeded = factory.isAuthenticationNeeded();
       if (authenticationNeeded) {
         passwordText.setEnabled(true);
         passwordText.setEditable(true);
         passwordText.setBackground(LoginComposite.WHITE_COLOR);
       } else {
         passwordText.setText(""); // $NON-NLS-1$
         passwordText.setEnabled(false);
         passwordText.setEditable(false);
         passwordText.setBackground(LoginComposite.GREY_COLOR);
       }
     }
   }
 }