Program: 125460
Project: 125460
Buggy source:
/** 
 * Main Fields addControls.
 */
@Override protected void addFieldsListeners(){
  Listener listener=new Listener(){
    @Override public void handleEvent(    final Event e){
      if (isContextMode()) {
      }
 else {
        if (dbTypeCombo.getSelectionIndex() == -1) {
          dbTypeCombo.forceFocus();
        }
        setPropertiesFormEditable(dbTypeCombo.getSelectionIndex() > -1);
        urlConnectionStringText.setEditable(false);
      }
    }
  }
;
  usernameText.addListener(SWT.FocusIn,listener);
  passwordText.addListener(SWT.FocusIn,listener);
  serverText.addListener(SWT.FocusIn,listener);
  portText.addListener(SWT.FocusIn,listener);
  sidOrDatabaseText.addListener(SWT.FocusIn,listener);
  datasourceText.addListener(SWT.FocusIn,listener);
  schemaText.addListener(SWT.FocusIn,listener);
  additionParamText.addListener(SWT.FocusIn,listener);
  urlConnectionStringText.addListener(SWT.FocusIn,listener);
  mappingFileText.addListener(SWT.FocusIn,listener);
  serverText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        if (!urlConnectionStringText.getEditable()) {
          getConnection().setServerName(serverText.getText());
          modifyFieldValue();
        }
      }
    }
  }
);
  portText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        if (!urlConnectionStringText.getEditable()) {
          getConnection().setPort(portText.getText());
          modifyFieldValue();
        }
        boolean b=true;
        String databaseType=getConnection().getDatabaseType();
        if (databaseType != null) {
          if (databaseType.equals("String_Node_Str")) {
            b=Pattern.matches(Messages.getString("String_Node_Str"),portText.getText());
          }
 else {
            b=Pattern.matches(Messages.getString("String_Node_Str"),portText.getText());
          }
        }
        if (b) {
          b=portText.getText().length() <= 5;
        }
        evaluateTextField(b);
      }
    }
  }
);
  portText.addKeyListener(new KeyAdapter(){
    @Override public void keyPressed(    KeyEvent e){
      if (!Character.isLetterOrDigit(e.character) && !Character.isIdentifierIgnorable(e.character)) {
        e.doit=false;
      }
    }
  }
);
  usernameText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        if (!urlConnectionStringText.getEditable()) {
          getConnection().setUsername(usernameText.getText());
          getConnection().getParameters().put(ConnParameterKeys.CONN_PARA_KEY_USERNAME,usernameText.getText());
        }
      }
    }
  }
);
  passwordText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        if (!urlConnectionStringText.getEditable()) {
          getConnection().setRawPassword(passwordText.getText());
        }
      }
    }
  }
);
  sidOrDatabaseText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        if (!urlConnectionStringText.getEditable()) {
          getConnection().setSID(sidOrDatabaseText.getText());
          modifyFieldValue();
        }
      }
    }
  }
);
  datasourceText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        if (!urlConnectionStringText.getEditable()) {
          getConnection().setDatasourceName(datasourceText.getText());
          modifyFieldValue();
        }
      }
    }
  }
);
  schemaText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        if (!urlConnectionStringText.getEditable()) {
          getConnection().setUiSchema(schemaText.getText());
          modifyFieldValue();
        }
      }
    }
  }
);
  schemaText.addFocusListener(new FocusListener(){
    @Override public void focusGained(    FocusEvent e){
    }
    @Override public void focusLost(    FocusEvent e){
      if (!isContextMode()) {
        if (originalUischema != null) {
          if (!originalUischema.equalsIgnoreCase(schemaText.getText())) {
            ConnectionHelper.setIsConnNeedReload(getConnection(),Boolean.TRUE);
          }
 else {
            checkURLIsChanged();
          }
        }
      }
    }
  }
);
  dbVersionCombo.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        EDatabaseVersion4Drivers version=EDatabaseVersion4Drivers.indexOfByVersionDisplay(dbVersionCombo.getText());
        if (version != null) {
          getConnection().setDbVersionString(version.getVersionValue());
        }
        urlConnectionStringText.setText(getStringConnection());
        checkFieldsValue();
      }
    }
  }
);
  hideDbVersion();
  additionParamText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        if (!urlConnectionStringText.getEditable()) {
          getConnection().setAdditionalParams(additionParamText.getText());
          modifyFieldValue();
        }
      }
    }
  }
);
  additionalJDBCSettingsText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        getConnection().getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HIVE_ADDITIONAL_JDBC_SETTINGS,additionalJDBCSettingsText.getText());
        urlConnectionStringText.setText(getStringConnection());
      }
    }
  }
);
  standardButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (!isContextMode()) {
        getConnection().setStandardSQL(standardButton.getSelection());
        getConnection().setSystemSQL(systemButton.getSelection());
      }
    }
  }
);
  systemButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (!isContextMode()) {
        getConnection().setStandardSQL(standardButton.getSelection());
        getConnection().setSystemSQL(systemButton.getSelection());
      }
    }
  }
);
  button1.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (!isContextMode()) {
        getConnection().setSQLMode(button1.getSelection());
      }
    }
  }
);
  button2.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (!isContextMode()) {
        getConnection().setSQLMode(!button2.getSelection());
      }
    }
  }
);
  dbTypeCombo.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      getConnection().getParameters().clear();
      resetControls();
      urlConnectionStringText.setEditable(false);
      authenticationGrpForImpala.setVisible(false);
      authenticationGrpForImpala.getParent().layout();
      clearFiledsForDiffDbTypes();
      boolean isGeneralJDBC=isGeneralJDBC();
      if (isGeneralJDBC) {
        if (generalJdbcUrlText != null) {
          generalJdbcUrlText.setText("String_Node_Str");
        }
        if (generalJdbcUserText != null) {
          generalJdbcUserText.setText("String_Node_Str");
        }
        if (generalJdbcPasswordText != null) {
          generalJdbcPasswordText.setText("String_Node_Str");
        }
      }
 else       if (isHiveDBConnSelected()) {
        if (urlConnectionStringText != null) {
          urlConnectionStringText.setText("String_Node_Str");
        }
        if (usernameText != null) {
          usernameText.setText("String_Node_Str");
        }
        if (passwordText != null) {
          passwordText.setText("String_Node_Str");
        }
        hideControl(authenticationGrpForHBase,true);
        initHiveInfo();
      }
 else       if (isDBTypeSelected(EDatabaseConnTemplate.HBASE)) {
        hideControl(authenticationCom,true);
        hideControl(znodeparentGrp,false);
        initHBaseSettings();
      }
 else       if (isDBTypeSelected(EDatabaseConnTemplate.MAPRDB)) {
        hideControl(authenticationCom,true);
        hideControl(znodeparentGrp,false);
        hideControl(tableInfoPartOfMapRDBComp,false);
        initMaprdbSettings();
      }
 else       if (isDBTypeSelected(EDatabaseConnTemplate.IMPALA)) {
        hideControl(authenticationCom,true);
        hideControl(authenticationComForHBase,true);
        initImpalaSettings();
        getConnection().setDbVersionString("String_Node_Str");
      }
 else {
        if (urlConnectionStringText != null) {
          urlConnectionStringText.setText("String_Node_Str");
        }
        if (usernameText != null) {
          usernameText.setText("String_Node_Str");
        }
        if (passwordText != null) {
          passwordText.setText("String_Node_Str");
        }
      }
      if (schemaText != null) {
        schemaText.setText("String_Node_Str");
      }
      if (serverText != null) {
        serverText.setText("String_Node_Str");
      }
      if (sidOrDatabaseText != null) {
        sidOrDatabaseText.setText("String_Node_Str");
      }
      if (portText != null && portText.getText() != null) {
        portText.setText("String_Node_Str");
      }
      if (fileField != null) {
        fileField.setText("String_Node_Str");
      }
      if (datasourceText != null) {
        datasourceText.setText("String_Node_Str");
      }
      if (additionParamText != null) {
        additionParamText.setText("String_Node_Str");
      }
      if (generalJdbcClassNameText != null) {
        generalJdbcClassNameText.setText("String_Node_Str");
      }
      if (generalJdbcDriverjarText != null) {
        generalJdbcDriverjarText.setText("String_Node_Str");
      }
      if (additionParamText != null) {
        additionParamText.setText("String_Node_Str");
      }
      if (mappingFileText != null) {
        mappingFileText.setText("String_Node_Str");
      }
      boolean hiddenGeneral=!isGeneralJDBC();
      switchBetweenTypeandGeneralDB(!isGeneralJDBC());
      if (!isContextMode()) {
        getConnection().setDatabaseType(dbTypeCombo.getText());
        EDatabaseConnTemplate template=EDatabaseConnTemplate.indexOfTemplate(getConnection().getDatabaseType());
        if (template != null) {
          portText.setText(template.getDefaultPort());
        }
        final String product=EDatabaseTypeName.getTypeFromDisplayName(getConnection().getDatabaseType()).getProduct();
        getConnection().setProductId(product);
        String mapping=null;
        if (product == null || product.equals(EDatabaseConnTemplate.GENERAL_JDBC.getDBDisplayName())) {
          mapping=generalMappingFileText.getText();
        }
 else {
          if (MetadataTalendType.getDefaultDbmsFromProduct(product) != null) {
            mapping=MetadataTalendType.getDefaultDbmsFromProduct(product).getId();
          }
        }
        if (mapping == null) {
          mapping="String_Node_Str";
        }
        getConnection().setDbmsId(mapping);
        setPropertiesFormEditable(true);
        additionParamText.setText(EDatabaseConnTemplate.getAdditionProperty(dbTypeCombo.getText()));
        if (dbTypeCombo.getText().equals(EDatabaseConnTemplate.INFORMIX.getDBDisplayName())) {
          datasourceText.setLabelText(Messages.getString("String_Node_Str"));
        }
        checkAndSetIniSQLModel();
        checkAS400SpecificCase();
        checkFieldsValue();
        hideDbVersion();
        if (!schemaText.getEditable()) {
          schemaText.setText("String_Node_Str");
        }
        if (isHiveDBConnSelected()) {
          doHiveDBTypeSelected();
          fillDefaultsWhenHiveVersionChanged();
          fillDefaultsWhenHiveModeChanged(isHiveEmbeddedMode());
        }
 else {
          doHiveDBTypeNotSelected();
        }
        if (isHBaseDBConnSelected()) {
          fillDefaultsWhenHBaseVersionChanged();
        }
        if (isImpalaDBConnSelected()) {
          fillDefaultsWhenImpalaVersionChanged();
        }
      }
      if (isHiveDBConnSelected()) {
        scrolledComposite.setMinSize(newParent.computeSize(SWT.DEFAULT,SWT.DEFAULT));
      }
 else       if (isImpalaDBConnSelected()) {
        scrolledComposite.setMinSize(newParent.computeSize(SWT.DEFAULT,550));
      }
 else {
        checkScrolledCompositeSize();
      }
      if (!isDBTypeSelected(EDatabaseConnTemplate.HBASE) && !isDBTypeSelected(EDatabaseConnTemplate.MAPRDB) && !isDBTypeSelected(EDatabaseConnTemplate.HIVE)&& !isDBTypeSelected(EDatabaseConnTemplate.IMPALA)) {
        clearHadoopRelatedParameters();
      }
    }
  }
);
  fileField.addListener(SWT.FocusIn,new Listener(){
    @Override public void handleEvent(    final Event e){
      if (!isContextMode()) {
        if (dbTypeCombo.getSelectionIndex() == -1) {
          dbTypeCombo.forceFocus();
        }
 else {
          EDatabaseConnTemplate template=EDatabaseConnTemplate.indexOfTemplate(getConnection().getDatabaseType());
          EDatabaseVersion4Drivers version=EDatabaseVersion4Drivers.indexOfByVersionDisplay(getConnection().getDbVersionString());
          if (template != null && template.getUrlTemplate(version).contains(EDatabaseConnVar.FILENAME.getVariable())) {
            setPropertiesFormEditable(true);
            urlConnectionStringText.setEditable(false);
          }
          getConnection().setFileFieldName(PathUtils.getPortablePath(fileField.getText()));
        }
      }
    }
  }
);
  fileField.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        if (!urlConnectionStringText.getEditable()) {
          getConnection().setFileFieldName(fileField.getText());
          modifyFieldValue();
        }
      }
    }
  }
);
  directoryField.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        if (!urlConnectionStringText.getEditable()) {
          String text=directoryField.getText();
          getConnection().setDBRootPath(text);
          checkFieldsValue();
        }
      }
    }
  }
);
  sqlSyntaxCombo.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        getConnection().setSqlSynthax(sqlSyntaxCombo.getText());
      }
    }
  }
);
  nullCharText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        getConnection().setNullChar(nullCharText.getText());
      }
    }
  }
);
  stringQuoteText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        getConnection().setStringQuote(stringQuoteText.getText());
      }
    }
  }
);
  addGeneralDbFieldsListeners();
  addHBaseSettingFieldsListeners();
  addMaprdbSettingFieldsListeners();
  addImpalaSettingFieldsListeners();
  regHiveRelatedWidgetsListeners();
  if (canLinkToHadoopCluster()) {
    addHadoopClusterLinkListeners();
  }
}

Fixed version (ground truth):
/** 
 * Main Fields addControls.
 */
@Override protected void addFieldsListeners(){
  Listener listener=new Listener(){
    @Override public void handleEvent(    final Event e){
      if (isContextMode()) {
      }
 else {
        if (dbTypeCombo.getSelectionIndex() == -1) {
          dbTypeCombo.forceFocus();
        }
        setPropertiesFormEditable(dbTypeCombo.getSelectionIndex() > -1);
        urlConnectionStringText.setEditable(false);
      }
    }
  }
;
  usernameText.addListener(SWT.FocusIn,listener);
  passwordText.addListener(SWT.FocusIn,listener);
  serverText.addListener(SWT.FocusIn,listener);
  portText.addListener(SWT.FocusIn,listener);
  sidOrDatabaseText.addListener(SWT.FocusIn,listener);
  datasourceText.addListener(SWT.FocusIn,listener);
  schemaText.addListener(SWT.FocusIn,listener);
  additionParamText.addListener(SWT.FocusIn,listener);
  urlConnectionStringText.addListener(SWT.FocusIn,listener);
  mappingFileText.addListener(SWT.FocusIn,listener);
  serverText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        if (!urlConnectionStringText.getEditable()) {
          getConnection().setServerName(serverText.getText());
          modifyFieldValue();
        }
      }
    }
  }
);
  portText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        if (!urlConnectionStringText.getEditable()) {
          getConnection().setPort(portText.getText());
          modifyFieldValue();
        }
        boolean b=true;
        String databaseType=getConnection().getDatabaseType();
        if (databaseType != null) {
          if (databaseType.equals("String_Node_Str")) {
            b=Pattern.matches(Messages.getString("String_Node_Str"),portText.getText());
          }
 else {
            b=Pattern.matches(Messages.getString("String_Node_Str"),portText.getText());
          }
        }
        if (b) {
          b=portText.getText().length() <= 5;
        }
        evaluateTextField(b);
      }
    }
  }
);
  portText.addKeyListener(new KeyAdapter(){
    @Override public void keyPressed(    KeyEvent e){
      if (!Character.isLetterOrDigit(e.character) && !Character.isIdentifierIgnorable(e.character)) {
        e.doit=false;
      }
    }
  }
);
  usernameText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        if (!urlConnectionStringText.getEditable()) {
          getConnection().setUsername(usernameText.getText());
          getConnection().getParameters().put(ConnParameterKeys.CONN_PARA_KEY_USERNAME,usernameText.getText());
        }
      }
    }
  }
);
  passwordText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        if (!urlConnectionStringText.getEditable()) {
          getConnection().setRawPassword(passwordText.getText());
        }
      }
    }
  }
);
  sidOrDatabaseText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        if (!urlConnectionStringText.getEditable()) {
          getConnection().setSID(sidOrDatabaseText.getText());
          modifyFieldValue();
        }
      }
    }
  }
);
  datasourceText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        if (!urlConnectionStringText.getEditable()) {
          getConnection().setDatasourceName(datasourceText.getText());
          modifyFieldValue();
        }
      }
    }
  }
);
  schemaText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        if (!urlConnectionStringText.getEditable()) {
          getConnection().setUiSchema(schemaText.getText());
          modifyFieldValue();
        }
      }
    }
  }
);
  schemaText.addFocusListener(new FocusListener(){
    @Override public void focusGained(    FocusEvent e){
    }
    @Override public void focusLost(    FocusEvent e){
      if (!isContextMode()) {
        if (originalUischema != null) {
          if (!originalUischema.equalsIgnoreCase(schemaText.getText())) {
            ConnectionHelper.setIsConnNeedReload(getConnection(),Boolean.TRUE);
          }
 else {
            checkURLIsChanged();
          }
        }
      }
    }
  }
);
  dbVersionCombo.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        EDatabaseVersion4Drivers version=EDatabaseVersion4Drivers.indexOfByVersionDisplay(dbVersionCombo.getText());
        if (version != null) {
          getConnection().setDbVersionString(version.getVersionValue());
        }
        urlConnectionStringText.setText(getStringConnection());
        checkFieldsValue();
      }
    }
  }
);
  hideDbVersion();
  additionParamText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        if (!urlConnectionStringText.getEditable()) {
          getConnection().setAdditionalParams(additionParamText.getText());
          modifyFieldValue();
        }
      }
    }
  }
);
  additionalJDBCSettingsText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        getConnection().getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HIVE_ADDITIONAL_JDBC_SETTINGS,additionalJDBCSettingsText.getText());
        urlConnectionStringText.setText(getStringConnection());
      }
    }
  }
);
  standardButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (!isContextMode()) {
        getConnection().setStandardSQL(standardButton.getSelection());
        getConnection().setSystemSQL(systemButton.getSelection());
      }
    }
  }
);
  systemButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (!isContextMode()) {
        getConnection().setStandardSQL(standardButton.getSelection());
        getConnection().setSystemSQL(systemButton.getSelection());
      }
    }
  }
);
  button1.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (!isContextMode()) {
        getConnection().setSQLMode(button1.getSelection());
      }
    }
  }
);
  button2.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (!isContextMode()) {
        getConnection().setSQLMode(!button2.getSelection());
      }
    }
  }
);
  dbTypeCombo.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      getConnection().getParameters().clear();
      getConnection().setDbVersionString(null);
      resetControls();
      urlConnectionStringText.setEditable(false);
      authenticationGrpForImpala.setVisible(false);
      authenticationGrpForImpala.getParent().layout();
      clearFiledsForDiffDbTypes();
      boolean isGeneralJDBC=isGeneralJDBC();
      if (isGeneralJDBC) {
        if (generalJdbcUrlText != null) {
          generalJdbcUrlText.setText("String_Node_Str");
        }
        if (generalJdbcUserText != null) {
          generalJdbcUserText.setText("String_Node_Str");
        }
        if (generalJdbcPasswordText != null) {
          generalJdbcPasswordText.setText("String_Node_Str");
        }
      }
 else       if (isHiveDBConnSelected()) {
        if (urlConnectionStringText != null) {
          urlConnectionStringText.setText("String_Node_Str");
        }
        if (usernameText != null) {
          usernameText.setText("String_Node_Str");
        }
        if (passwordText != null) {
          passwordText.setText("String_Node_Str");
        }
        hideControl(authenticationGrpForHBase,true);
        initHiveInfo();
      }
 else       if (isDBTypeSelected(EDatabaseConnTemplate.HBASE)) {
        hideControl(authenticationCom,true);
        hideControl(znodeparentGrp,false);
        initHBaseSettings();
      }
 else       if (isDBTypeSelected(EDatabaseConnTemplate.MAPRDB)) {
        hideControl(authenticationCom,true);
        hideControl(znodeparentGrp,false);
        hideControl(tableInfoPartOfMapRDBComp,false);
        initMaprdbSettings();
      }
 else       if (isDBTypeSelected(EDatabaseConnTemplate.IMPALA)) {
        hideControl(authenticationCom,true);
        hideControl(authenticationComForHBase,true);
        initImpalaSettings();
        getConnection().setDbVersionString("String_Node_Str");
      }
 else {
        if (urlConnectionStringText != null) {
          urlConnectionStringText.setText("String_Node_Str");
        }
        if (usernameText != null) {
          usernameText.setText("String_Node_Str");
        }
        if (passwordText != null) {
          passwordText.setText("String_Node_Str");
        }
      }
      if (schemaText != null) {
        schemaText.setText("String_Node_Str");
      }
      if (serverText != null) {
        serverText.setText("String_Node_Str");
      }
      if (sidOrDatabaseText != null) {
        sidOrDatabaseText.setText("String_Node_Str");
      }
      if (portText != null && portText.getText() != null) {
        portText.setText("String_Node_Str");
      }
      if (fileField != null) {
        fileField.setText("String_Node_Str");
      }
      if (datasourceText != null) {
        datasourceText.setText("String_Node_Str");
      }
      if (additionParamText != null) {
        additionParamText.setText("String_Node_Str");
      }
      if (generalJdbcClassNameText != null) {
        generalJdbcClassNameText.setText("String_Node_Str");
      }
      if (generalJdbcDriverjarText != null) {
        generalJdbcDriverjarText.setText("String_Node_Str");
      }
      if (additionParamText != null) {
        additionParamText.setText("String_Node_Str");
      }
      if (mappingFileText != null) {
        mappingFileText.setText("String_Node_Str");
      }
      boolean hiddenGeneral=!isGeneralJDBC();
      switchBetweenTypeandGeneralDB(!isGeneralJDBC());
      if (!isContextMode()) {
        getConnection().setDatabaseType(dbTypeCombo.getText());
        EDatabaseConnTemplate template=EDatabaseConnTemplate.indexOfTemplate(getConnection().getDatabaseType());
        if (template != null) {
          portText.setText(template.getDefaultPort());
        }
        final String product=EDatabaseTypeName.getTypeFromDisplayName(getConnection().getDatabaseType()).getProduct();
        getConnection().setProductId(product);
        String mapping=null;
        if (product == null || product.equals(EDatabaseConnTemplate.GENERAL_JDBC.getDBDisplayName())) {
          mapping=generalMappingFileText.getText();
        }
 else {
          if (MetadataTalendType.getDefaultDbmsFromProduct(product) != null) {
            mapping=MetadataTalendType.getDefaultDbmsFromProduct(product).getId();
          }
        }
        if (mapping == null) {
          mapping="String_Node_Str";
        }
        getConnection().setDbmsId(mapping);
        setPropertiesFormEditable(true);
        additionParamText.setText(EDatabaseConnTemplate.getAdditionProperty(dbTypeCombo.getText()));
        if (dbTypeCombo.getText().equals(EDatabaseConnTemplate.INFORMIX.getDBDisplayName())) {
          datasourceText.setLabelText(Messages.getString("String_Node_Str"));
        }
        checkAndSetIniSQLModel();
        checkAS400SpecificCase();
        checkFieldsValue();
        hideDbVersion();
        if (!schemaText.getEditable()) {
          schemaText.setText("String_Node_Str");
        }
        if (isHiveDBConnSelected()) {
          doHiveDBTypeSelected();
          fillDefaultsWhenHiveVersionChanged();
          fillDefaultsWhenHiveModeChanged(isHiveEmbeddedMode());
        }
 else {
          doHiveDBTypeNotSelected();
        }
        if (isHBaseDBConnSelected()) {
          fillDefaultsWhenHBaseVersionChanged();
        }
        if (isImpalaDBConnSelected()) {
          fillDefaultsWhenImpalaVersionChanged();
        }
      }
      if (isHiveDBConnSelected()) {
        scrolledComposite.setMinSize(newParent.computeSize(SWT.DEFAULT,SWT.DEFAULT));
      }
 else       if (isImpalaDBConnSelected()) {
        scrolledComposite.setMinSize(newParent.computeSize(SWT.DEFAULT,550));
      }
 else {
        checkScrolledCompositeSize();
      }
      if (!isDBTypeSelected(EDatabaseConnTemplate.HBASE) && !isDBTypeSelected(EDatabaseConnTemplate.MAPRDB) && !isDBTypeSelected(EDatabaseConnTemplate.HIVE)&& !isDBTypeSelected(EDatabaseConnTemplate.IMPALA)) {
        clearHadoopRelatedParameters();
      }
    }
  }
);
  fileField.addListener(SWT.FocusIn,new Listener(){
    @Override public void handleEvent(    final Event e){
      if (!isContextMode()) {
        if (dbTypeCombo.getSelectionIndex() == -1) {
          dbTypeCombo.forceFocus();
        }
 else {
          EDatabaseConnTemplate template=EDatabaseConnTemplate.indexOfTemplate(getConnection().getDatabaseType());
          EDatabaseVersion4Drivers version=EDatabaseVersion4Drivers.indexOfByVersionDisplay(getConnection().getDbVersionString());
          if (template != null && template.getUrlTemplate(version).contains(EDatabaseConnVar.FILENAME.getVariable())) {
            setPropertiesFormEditable(true);
            urlConnectionStringText.setEditable(false);
          }
          getConnection().setFileFieldName(PathUtils.getPortablePath(fileField.getText()));
        }
      }
    }
  }
);
  fileField.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        if (!urlConnectionStringText.getEditable()) {
          getConnection().setFileFieldName(fileField.getText());
          modifyFieldValue();
        }
      }
    }
  }
);
  directoryField.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        if (!urlConnectionStringText.getEditable()) {
          String text=directoryField.getText();
          getConnection().setDBRootPath(text);
          checkFieldsValue();
        }
      }
    }
  }
);
  sqlSyntaxCombo.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        getConnection().setSqlSynthax(sqlSyntaxCombo.getText());
      }
    }
  }
);
  nullCharText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        getConnection().setNullChar(nullCharText.getText());
      }
    }
  }
);
  stringQuoteText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        getConnection().setStringQuote(stringQuoteText.getText());
      }
    }
  }
);
  addGeneralDbFieldsListeners();
  addHBaseSettingFieldsListeners();
  addMaprdbSettingFieldsListeners();
  addImpalaSettingFieldsListeners();
  regHiveRelatedWidgetsListeners();
  if (canLinkToHadoopCluster()) {
    addHadoopClusterLinkListeners();
  }
}