private void conversionBtnActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_conversionBtnActionPerformed
    // TODO add your handling code here:
    try {
      if (Validation.validationTypeOfSQL(
              sourceFileWithOutComments, tokenization, subtractValuesFromListSQL)
          == true) {
        // System.out.println("this is Sql Server");
        SyntaxRule rule = new SyntaxRule();

        ArrayList<Token> createSourceCodeTokens =
            tokenization.createSourceCodeTokens(sourceFileWithOutComments);
        if (Validation.tokenValidation(createSourceCodeTokens) == true) {
          createSourceCodeTokens = rule.replaceSQLServerFunctions(createSourceCodeTokens);
          createSourceCodeTokens = rule.replaceSQLServerDataType(createSourceCodeTokens);

          for (int i = 0; i < createSourceCodeTokens.size(); i++) {
            createSourceCodeTokens
                .get(i)
                .setToken(rule.changeForiegnKey(createSourceCodeTokens.get(i)));
          }
          file.writeToFile(
              "result.sql",
              createSourceCodeTokens,
              "C:/Users/dacorie/Documents/JavaProject/SqlServerToMySqlMitgrationTool/src/assets/");

          String list = "";
          for (Token x : createSourceCodeTokens) {
            list += x.getToken();
          }
          String[] listArray = list.split(",");

          for (String x : listArray) {
            mysqlSoucreCode.setText(
                (mysqlSoucreCode.getText() + " " + x + "," + "\n").replace(";,", ";"));
          }

          JOptionPane.showMessageDialog(
              null,
              "File Conversation Was successfull",
              "Successs",
              JOptionPane.INFORMATION_MESSAGE);
        }
      } else {
        JOptionPane.showMessageDialog(
            null,
            "Not Sql Server File ",
            "This is not Sql Server File",
            JOptionPane.WARNING_MESSAGE);
      }
    } catch (Exception ex) {
      JOptionPane.showMessageDialog(
          null, "Not Sql Server File ", "This is not Sql Server File", JOptionPane.WARNING_MESSAGE);
    }
  } // GEN-LAST:event_conversionBtnActionPerformed
  private void selectFilebtnActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_selectFilebtnActionPerformed
    // TODO add your handling code here:
    SyntaxRule syntaxRule = new SyntaxRule();
    JFileChooser fileChooser = new JFileChooser();
    int returnValue = fileChooser.showOpenDialog(null);

    if (returnValue == JFileChooser.APPROVE_OPTION) {
      File selectedFile = fileChooser.getSelectedFile();
      sqlFile = selectedFile.getAbsolutePath();

      if (validation.checkIfFileExtensionIsSql(sqlFile, "sql")) {

        sqlSourceFile = file.readFileToString(sqlFile);
        //  boolean test =    validation.checkIfEqualAmountOfbraces(sqlSourceFile);

        // if (validation.checkIfEqualAmountOfsemeilcon(sqlSourceFile)) {
        String databaseName = syntaxRule.getDatabaseNameFromMySqlServerFile(sqlFile);
        syntaxRule.databaseName = databaseName;

        sqlSourceFile = syntaxRule.removeAlterDatabaseStatements(sqlSourceFile, databaseName);
        sqlSourceFile = syntaxRule.replaceSQLServerSymbols(sqlSourceFile);
        sqlSourceFile = syntaxRule.CreateDatabaseStatement(sqlSourceFile, databaseName);

        // validation.checkIfEqualInsertValues(sqlSourceFile);
        // ArrayList<Token> createSourceCodeTokens =
        // tokenization.createSourceCodeTokens(sqlSourceFile);
        // validation.checkIfInsertToken(createSourceCodeTokens);
        sourceFileWithOutComments = sqlSourceFile;

        String[] sourceCodeSplit = sourceFileWithOutComments.split(",");
        for (String x : sourceCodeSplit) {
          if (x.toLowerCase().contains("primary key")) {
            sqlServerSourceCodetxt.setText(sqlServerSourceCodetxt.getText() + " " + x + "\n");
          } else {
            sqlServerSourceCodetxt.setText(
                sqlServerSourceCodetxt.getText() + " " + x + " ," + "\n");
          }
        }
        //  }
      } else {
        JOptionPane.showMessageDialog(
            null,
            "Wrong file Type! Please Select A file Type ",
            "File Type Error",
            JOptionPane.ERROR_MESSAGE);
      }
    }
  } // GEN-LAST:event_selectFilebtnActionPerformed