Program: 128312
Project: 128312
Buggy source:
/** 
 * SetEditable fields.
 * @param boolean
 */
@SuppressWarnings("String_Node_Str") private void setPropertiesFormEditable(boolean visible){
  clearContextParams();
  EDBParamName sidOrDatabase=null;
  if (EDatabaseTypeName.ORACLEFORSID.getProduct().equals(getConnection().getProductId())) {
    if (EDatabaseConnTemplate.ORACLESN.getDBDisplayName().equals(getConnection().getDatabaseType())) {
      sidOrDatabaseText.setLabelText(Messages.getString("String_Node_Str"));
      sidOrDatabaseText.setLabelWidth(65);
      sidOrDatabase=EDBParamName.ServiceName;
    }
 else     if (EDatabaseConnTemplate.ORACLEFORSID.getDBDisplayName().equals(getConnection().getDatabaseType())) {
      sidOrDatabaseText.setLabelText(Messages.getString("String_Node_Str"));
      sidOrDatabase=EDBParamName.Sid;
    }
 else     if (EDatabaseConnTemplate.ORACLE_OCI.getDBDisplayName().equals(getConnection().getDatabaseType())) {
      sidOrDatabaseText.setLabelText(Messages.getString("String_Node_Str"));
      sidOrDatabase=EDBParamName.Sid;
    }
  }
 else {
    sidOrDatabaseText.setLabelText(Messages.getString("String_Node_Str"));
    sidOrDatabase=EDBParamName.Database;
    if (EDatabaseConnTemplate.INFORMIX.getDBDisplayName().equals(getConnection().getDatabaseType())) {
      sidOrDatabaseText.setLabelText(Messages.getString("String_Node_Str"));
    }
  }
  if (EDatabaseTypeName.MSODBC.getDisplayName().equals(dbTypeCombo.getText())) {
    sidOrDatabaseText.setLabelText(Messages.getString("String_Node_Str"));
  }
  if (EDatabaseTypeName.GODBC.getDisplayName().equals(dbTypeCombo.getText())) {
    sidOrDatabaseText.setLabelText(Messages.getString("String_Node_Str"));
  }
  if (EDatabaseConnTemplate.GENERAL_JDBC.getDBTypeName().equals(dbTypeCombo.getText())) {
    addContextParams(EDBParamName.JdbcUrl,visible);
    addContextParams(EDBParamName.DriverJar,visible);
    addContextParams(EDBParamName.MappingFile,visible);
    addContextParams(EDBParamName.ClassName,visible);
  }
  addContextParams(EDBParamName.Login,visible);
  addContextParams(EDBParamName.Password,visible);
  boolean isOracle=visible && oracleVersionEnable();
  boolean isAS400=visible && as400VersionEnable();
  boolean isMySQL=visible && asMySQLVersionEnable();
  boolean isVertica=visible && asVerticaVersionEnable();
  boolean isSAS=visible && asSASVersionEnable();
  boolean isHbase=visible && asHbaseVersionEnable();
  dbVersionCombo.setEnabled(!isReadOnly() && (isOracle || isAS400 || isMySQL|| isVertica|| isSAS|| EDatabaseConnTemplate.ACCESS.getDBTypeName().equals(dbTypeCombo.getText())|| EDatabaseConnTemplate.MSSQL05_08.getDBDisplayName().equals(dbTypeCombo.getText())));
  usernameText.setEditable(visible);
  passwordText.setEditable(visible);
  serverText.setEditable(false);
  portText.setEditable(false);
  sidOrDatabaseText.setEditable(false);
  datasourceText.setEditable(false);
  additionParamText.setEditable(false);
  schemaText.setEditable(false);
  fileField.setEditable(false);
  directoryField.setEditable(false);
  mappingFileText.setEditable(false);
  mappingSelectButton.setEnabled(false);
  if (EDatabaseConnTemplate.GODBC.getDBTypeName().equals(dbTypeCombo.getText()) || EDatabaseConnTemplate.GENERAL_JDBC.getDBTypeName().equals(dbTypeCombo.getText())) {
    addContextParams(EDBParamName.MappingFile,true);
    mappingFileText.show();
    mappingFileText.setEditable(true);
    mappingSelectButton.setVisible(true);
    mappingSelectButton.setEnabled(true);
  }
 else {
    addContextParams(EDBParamName.MappingFile,false);
    mappingFileText.hide();
    mappingFileText.setEditable(false);
    mappingSelectButton.setVisible(false);
    mappingSelectButton.setEnabled(false);
  }
  if (dbTypeCombo.getSelectionIndex() < 0) {
    urlConnectionStringText.setEditable(false);
  }
 else {
    EDatabaseConnTemplate template=EDatabaseConnTemplate.indexOfTemplate(dbTypeCombo.getText());
    String s="String_Node_Str";
    if (template != null) {
      EDatabaseVersion4Drivers version=EDatabaseVersion4Drivers.indexOfByVersionDisplay(dbVersionCombo.getText());
      s=template.getUrlTemplate(version);
    }
    if (isHbase) {
      urlConnectionStringText.setVisible(false);
    }
    urlConnectionStringText.setEditable(!visible);
    boolean schemaTextIsShow=true;
    if (template == EDatabaseConnTemplate.MSSQL) {
      schemaText.show();
      schemaText.setEditable(true);
      addContextParams(EDBParamName.Schema,true);
    }
 else     if (template == EDatabaseConnTemplate.VERTICA || template == EDatabaseConnTemplate.INFORMIX) {
      schemaText.show();
      schemaText.setEditable(true);
      addContextParams(EDBParamName.Schema,true);
    }
 else     if (template == EDatabaseConnTemplate.GENERAL_JDBC) {
      String jdbcUrlString="String_Node_Str";
      if (isContextMode()) {
        if (selectedContextType == null) {
          selectedContextType=ConnectionContextHelper.getContextTypeForContextMode(getShell(),getConnection(),true);
        }
        if (selectedContextType != null) {
          jdbcUrlString=ConnectionContextHelper.getOriginalValue(selectedContextType,getConnection().getURL());
        }
      }
 else {
        jdbcUrlString=generalJdbcUrlText.getText();
      }
      if (jdbcUrlString.contains("String_Node_Str")) {
        jDBCschemaText.setHideWidgets(false);
        addContextParams(EDBParamName.Schema,true);
      }
 else {
        jDBCschemaText.setHideWidgets(true);
        addContextParams(EDBParamName.Schema,false);
      }
    }
 else {
      schemaTextIsShow=false;
    }
    if (s.contains(EDatabaseConnVar.HOST.getVariable()) || isHbase) {
      if (!EDatabaseConnTemplate.GENERAL_JDBC.getDBTypeName().equals(dbTypeCombo.getText())) {
        serverText.show();
        serverText.setEditable(visible);
        if (isHbase) {
          String serverName=getConnection().getServerName();
          if (serverName == null || "String_Node_Str".equals(serverName)) {
            serverText.setText(EDatabaseConnTemplate.HBASE.getUrlTemplate(EDatabaseVersion4Drivers.HBASE));
          }
        }
        addContextParams(EDBParamName.Server,visible);
      }
    }
 else {
      serverText.hide();
      addContextParams(EDBParamName.Server,false);
    }
    if (s.contains(EDatabaseConnVar.PORT.getVariable()) || isHbase) {
      portText.show();
      portText.setEditable(visible);
      addContextParams(EDBParamName.Port,visible);
    }
 else {
      portText.hide();
      addContextParams(EDBParamName.Port,false);
    }
    if (s.contains(EDatabaseConnVar.SID.getVariable()) || s.contains(EDatabaseConnVar.SERVICE_NAME.getVariable())) {
      if (!EDatabaseConnTemplate.GENERAL_JDBC.getDBTypeName().equals(dbTypeCombo.getText())) {
        sidOrDatabaseText.show();
        sidOrDatabaseText.setEditable(visible);
        addContextParams(sidOrDatabase,visible);
      }
 else {
        sidOrDatabaseText.hide();
        addContextParams(sidOrDatabase,false);
      }
    }
 else {
      if (template.getDbType() != EDatabaseTypeName.JAVADB_EMBEDED) {
        sidOrDatabaseText.hide();
        addContextParams(sidOrDatabase,false);
      }
    }
    if (s.contains(EDatabaseConnVar.FILENAME.getVariable())) {
      fileField.show();
      fileField.setEditable(!isReadOnly() && visible);
      addContextParams(EDBParamName.File,visible);
      boolean isSqlLite=false;
      if (template.getDbType() == EDatabaseTypeName.SQLITE) {
        isSqlLite=true;
        usernameText.hide();
        passwordText.hide();
      }
 else {
        isSqlLite=false;
        usernameText.show();
        passwordText.show();
      }
      usernameText.setEditable(!isSqlLite);
      passwordText.setEditable(!isSqlLite);
      addContextParams(EDBParamName.Login,!isSqlLite);
      addContextParams(EDBParamName.Password,!isSqlLite);
    }
 else {
      fileField.hide();
      addContextParams(EDBParamName.File,false);
      usernameText.show();
      passwordText.show();
      if (isHbase) {
        usernameText.hide();
        passwordText.hide();
      }
      addContextParams(EDBParamName.Login,true);
      addContextParams(EDBParamName.Password,true);
    }
    if (s.contains(EDatabaseConnVar.DATASOURCE.getVariable())) {
      datasourceText.show();
      datasourceText.setEditable(visible);
      addContextParams(EDBParamName.Datasource,visible);
    }
 else {
      datasourceText.hide();
      addContextParams(EDBParamName.Datasource,false);
    }
    if (s.contains(EDatabaseConnVar.DBROOTPATH.getVariable())) {
      directoryField.show();
      directoryField.setEditable(visible);
      sidOrDatabaseText.setEditable(visible);
      addContextParams(EDBParamName.DBRootPath,visible);
      addContextParams(sidOrDatabase,visible);
    }
 else {
      directoryField.hide();
      addContextParams(EDBParamName.DBRootPath,false);
    }
    if (EDatabaseConnTemplate.isSchemaNeeded(getConnection().getDatabaseType())) {
      schemaText.show();
      schemaText.setEditable(visible);
      if (isHbase) {
        schemaText.setLabelText("String_Node_Str");
      }
      addContextParams(EDBParamName.Schema,visible);
    }
 else {
      if (!schemaTextIsShow) {
        schemaText.hide();
        addContextParams(EDBParamName.Schema,false);
      }
    }
    if (EDatabaseConnTemplate.isAddtionParamsNeeded(getConnection().getDatabaseType()) && !EDatabaseConnTemplate.GENERAL_JDBC.getDBTypeName().equals(dbTypeCombo.getText()) && visible) {
      additionParamText.show();
      additionParamText.setEditable(true);
      addContextParams(EDBParamName.AdditionalParams,true);
    }
 else {
      additionParamText.hide();
      addContextParams(EDBParamName.AdditionalParams,false);
    }
    if (EDatabaseConnTemplate.FIREBIRD.equals(template)) {
      portText.show();
      portText.setEditable(true);
      addContextParams(EDBParamName.Port,true);
    }
  }
  compositeDbSettings.layout();
  typeDbCompositeParent.layout();
  newParent.layout();
  databaseSettingGroup.layout();
  compositeGroupDbSettings.layout();
}

Fixed version (ground truth):
/** 
 * SetEditable fields.
 * @param boolean
 */
@SuppressWarnings("String_Node_Str") private void setPropertiesFormEditable(boolean visible){
  clearContextParams();
  EDBParamName sidOrDatabase=null;
  if (EDatabaseTypeName.ORACLEFORSID.getProduct().equals(getConnection().getProductId())) {
    if (EDatabaseConnTemplate.ORACLESN.getDBDisplayName().equals(getConnection().getDatabaseType())) {
      sidOrDatabaseText.setLabelText(Messages.getString("String_Node_Str"));
      sidOrDatabaseText.setLabelWidth(65);
      sidOrDatabase=EDBParamName.ServiceName;
    }
 else     if (EDatabaseConnTemplate.ORACLEFORSID.getDBDisplayName().equals(getConnection().getDatabaseType())) {
      sidOrDatabaseText.setLabelText(Messages.getString("String_Node_Str"));
      sidOrDatabase=EDBParamName.Sid;
    }
 else     if (EDatabaseConnTemplate.ORACLE_OCI.getDBDisplayName().equals(getConnection().getDatabaseType())) {
      sidOrDatabaseText.setLabelText(Messages.getString("String_Node_Str"));
      sidOrDatabase=EDBParamName.Sid;
    }
  }
 else {
    sidOrDatabaseText.setLabelText(Messages.getString("String_Node_Str"));
    sidOrDatabase=EDBParamName.Database;
    if (EDatabaseConnTemplate.INFORMIX.getDBDisplayName().equals(getConnection().getDatabaseType())) {
      sidOrDatabaseText.setLabelText(Messages.getString("String_Node_Str"));
    }
  }
  if (EDatabaseTypeName.MSODBC.getDisplayName().equals(dbTypeCombo.getText())) {
    sidOrDatabaseText.setLabelText(Messages.getString("String_Node_Str"));
  }
  if (EDatabaseTypeName.GODBC.getDisplayName().equals(dbTypeCombo.getText())) {
    sidOrDatabaseText.setLabelText(Messages.getString("String_Node_Str"));
  }
  if (EDatabaseConnTemplate.GENERAL_JDBC.getDBTypeName().equals(dbTypeCombo.getText())) {
    addContextParams(EDBParamName.JdbcUrl,visible);
    addContextParams(EDBParamName.DriverJar,visible);
    addContextParams(EDBParamName.MappingFile,visible);
    addContextParams(EDBParamName.ClassName,visible);
  }
  addContextParams(EDBParamName.Login,visible);
  addContextParams(EDBParamName.Password,visible);
  boolean isOracle=visible && oracleVersionEnable();
  boolean isAS400=visible && as400VersionEnable();
  boolean isMySQL=visible && asMySQLVersionEnable();
  boolean isVertica=visible && asVerticaVersionEnable();
  boolean isSAS=visible && asSASVersionEnable();
  boolean isHbase=visible && asHbaseVersionEnable();
  dbVersionCombo.setEnabled(!isReadOnly() && (isOracle || isAS400 || isMySQL|| isVertica|| isSAS|| EDatabaseConnTemplate.ACCESS.getDBTypeName().equals(dbTypeCombo.getText())|| EDatabaseConnTemplate.MSSQL05_08.getDBDisplayName().equals(dbTypeCombo.getText())));
  usernameText.setEditable(visible);
  passwordText.setEditable(visible);
  serverText.setEditable(false);
  portText.setEditable(false);
  sidOrDatabaseText.setEditable(false);
  datasourceText.setEditable(false);
  additionParamText.setEditable(false);
  schemaText.setEditable(false);
  fileField.setEditable(false);
  directoryField.setEditable(false);
  mappingFileText.setEditable(false);
  mappingSelectButton.setEnabled(false);
  if (EDatabaseConnTemplate.GODBC.getDBTypeName().equals(dbTypeCombo.getText()) || EDatabaseConnTemplate.GENERAL_JDBC.getDBTypeName().equals(dbTypeCombo.getText())) {
    addContextParams(EDBParamName.MappingFile,true);
    mappingFileText.show();
    mappingFileText.setEditable(true);
    mappingSelectButton.setVisible(true);
    mappingSelectButton.setEnabled(true);
  }
 else {
    addContextParams(EDBParamName.MappingFile,false);
    mappingFileText.hide();
    mappingFileText.setEditable(false);
    mappingSelectButton.setVisible(false);
    mappingSelectButton.setEnabled(false);
  }
  if (dbTypeCombo.getSelectionIndex() < 0) {
    urlConnectionStringText.setEditable(false);
  }
 else {
    EDatabaseConnTemplate template=EDatabaseConnTemplate.indexOfTemplate(dbTypeCombo.getText());
    String s="String_Node_Str";
    if (template != null) {
      EDatabaseVersion4Drivers version=EDatabaseVersion4Drivers.indexOfByVersionDisplay(dbVersionCombo.getText());
      s=template.getUrlTemplate(version);
    }
    if (isHbase || isDBTypeSelected(EDatabaseConnTemplate.ORACLE_RAC)) {
      urlConnectionStringText.hide();
    }
 else {
      urlConnectionStringText.show();
    }
    if (isDBTypeSelected(EDatabaseConnTemplate.ORACLE_RAC)) {
      serverText.setLabelText(Messages.getString("String_Node_Str"));
    }
 else {
      serverText.setLabelText(Messages.getString("String_Node_Str"));
    }
    urlConnectionStringText.setEditable(!visible);
    boolean schemaTextIsShow=true;
    if (template == EDatabaseConnTemplate.MSSQL) {
      schemaText.show();
      schemaText.setEditable(true);
      addContextParams(EDBParamName.Schema,true);
    }
 else     if (template == EDatabaseConnTemplate.VERTICA || template == EDatabaseConnTemplate.INFORMIX) {
      schemaText.show();
      schemaText.setEditable(true);
      addContextParams(EDBParamName.Schema,true);
    }
 else     if (template == EDatabaseConnTemplate.GENERAL_JDBC) {
      String jdbcUrlString="String_Node_Str";
      if (isContextMode()) {
        if (selectedContextType == null) {
          selectedContextType=ConnectionContextHelper.getContextTypeForContextMode(getShell(),getConnection(),true);
        }
        if (selectedContextType != null) {
          jdbcUrlString=ConnectionContextHelper.getOriginalValue(selectedContextType,getConnection().getURL());
        }
      }
 else {
        jdbcUrlString=generalJdbcUrlText.getText();
      }
      if (jdbcUrlString.contains("String_Node_Str")) {
        jDBCschemaText.setHideWidgets(false);
        addContextParams(EDBParamName.Schema,true);
      }
 else {
        jDBCschemaText.setHideWidgets(true);
        addContextParams(EDBParamName.Schema,false);
      }
    }
 else {
      schemaTextIsShow=false;
    }
    if (s.contains(EDatabaseConnVar.HOST.getVariable()) || isHbase) {
      if (!EDatabaseConnTemplate.GENERAL_JDBC.getDBTypeName().equals(dbTypeCombo.getText())) {
        serverText.show();
        serverText.setEditable(visible);
        if (isHbase) {
          String serverName=getConnection().getServerName();
          if (serverName == null || "String_Node_Str".equals(serverName)) {
            serverText.setText(EDatabaseConnTemplate.HBASE.getUrlTemplate(EDatabaseVersion4Drivers.HBASE));
          }
        }
        addContextParams(EDBParamName.Server,visible);
      }
    }
 else {
      serverText.hide();
      addContextParams(EDBParamName.Server,false);
    }
    if (s.contains(EDatabaseConnVar.PORT.getVariable()) || isHbase) {
      portText.show();
      portText.setEditable(visible);
      addContextParams(EDBParamName.Port,visible);
    }
 else {
      portText.hide();
      addContextParams(EDBParamName.Port,false);
    }
    if (s.contains(EDatabaseConnVar.SID.getVariable()) || s.contains(EDatabaseConnVar.SERVICE_NAME.getVariable())) {
      if (!EDatabaseConnTemplate.GENERAL_JDBC.getDBTypeName().equals(dbTypeCombo.getText())) {
        sidOrDatabaseText.show();
        sidOrDatabaseText.setEditable(visible);
        addContextParams(sidOrDatabase,visible);
      }
 else {
        sidOrDatabaseText.hide();
        addContextParams(sidOrDatabase,false);
      }
    }
 else {
      if (template.getDbType() != EDatabaseTypeName.JAVADB_EMBEDED) {
        sidOrDatabaseText.hide();
        addContextParams(sidOrDatabase,false);
      }
    }
    if (s.contains(EDatabaseConnVar.FILENAME.getVariable())) {
      fileField.show();
      fileField.setEditable(!isReadOnly() && visible);
      addContextParams(EDBParamName.File,visible);
      boolean isSqlLite=false;
      if (template.getDbType() == EDatabaseTypeName.SQLITE) {
        isSqlLite=true;
        usernameText.hide();
        passwordText.hide();
      }
 else {
        isSqlLite=false;
        usernameText.show();
        passwordText.show();
      }
      usernameText.setEditable(!isSqlLite);
      passwordText.setEditable(!isSqlLite);
      addContextParams(EDBParamName.Login,!isSqlLite);
      addContextParams(EDBParamName.Password,!isSqlLite);
    }
 else {
      fileField.hide();
      addContextParams(EDBParamName.File,false);
      usernameText.show();
      passwordText.show();
      if (isHbase) {
        usernameText.hide();
        passwordText.hide();
      }
      addContextParams(EDBParamName.Login,true);
      addContextParams(EDBParamName.Password,true);
    }
    if (s.contains(EDatabaseConnVar.DATASOURCE.getVariable())) {
      datasourceText.show();
      datasourceText.setEditable(visible);
      addContextParams(EDBParamName.Datasource,visible);
    }
 else {
      datasourceText.hide();
      addContextParams(EDBParamName.Datasource,false);
    }
    if (s.contains(EDatabaseConnVar.DBROOTPATH.getVariable())) {
      directoryField.show();
      directoryField.setEditable(visible);
      sidOrDatabaseText.setEditable(visible);
      addContextParams(EDBParamName.DBRootPath,visible);
      addContextParams(sidOrDatabase,visible);
    }
 else {
      directoryField.hide();
      addContextParams(EDBParamName.DBRootPath,false);
    }
    if (EDatabaseConnTemplate.isSchemaNeeded(getConnection().getDatabaseType())) {
      schemaText.show();
      schemaText.setEditable(visible);
      if (isHbase) {
        schemaText.setLabelText("String_Node_Str");
      }
      addContextParams(EDBParamName.Schema,visible);
    }
 else {
      if (!schemaTextIsShow) {
        schemaText.hide();
        addContextParams(EDBParamName.Schema,false);
      }
    }
    if (EDatabaseConnTemplate.isAddtionParamsNeeded(getConnection().getDatabaseType()) && !EDatabaseConnTemplate.GENERAL_JDBC.getDBTypeName().equals(dbTypeCombo.getText()) && visible) {
      additionParamText.show();
      additionParamText.setEditable(true);
      addContextParams(EDBParamName.AdditionalParams,true);
    }
 else {
      additionParamText.hide();
      addContextParams(EDBParamName.AdditionalParams,false);
    }
    if (EDatabaseConnTemplate.FIREBIRD.equals(template)) {
      portText.show();
      portText.setEditable(true);
      addContextParams(EDBParamName.Port,true);
    }
  }
  compositeDbSettings.layout();
  typeDbCompositeParent.layout();
  newParent.layout();
  databaseSettingGroup.layout();
  compositeGroupDbSettings.layout();
}