private void deleteTable(
     TableDefinition tableDefinition, IDatabaseConnectionFactory connectionFactory)
     throws SQLException {
   Connection connection = connectionFactory.getDatabaseConnection();
   try {
     Statement createStatement = connection.createStatement();
     String name = tableDefinition.getFqn();
     createStatement.execute(DROP_TABLE + name);
   } finally {
     if (connection != null) {
       connection.close();
     }
   }
 }
  @SuppressWarnings("rawtypes")
  public void run() {
    IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
    TreeParent parent = null;

    for (Iterator nextSelection = selection.iterator(); nextSelection.hasNext(); ) {
      Object obj = nextSelection.next();
      if (TreeObject.class.isInstance(obj)) {
        if (((TreeObject) obj).getTableDefinition() != null) {
          TableDefinition tableDefinition = ((TreeObject) obj).getTableDefinition();

          boolean confirm =
              MessageDialog.openConfirm(
                  viewer.getControl().getShell(),
                  DELETE_TABLE,
                  String.format(
                      WARNING_THIS_ACTION_WILL_DELETE_THE_TABLE_AND_ALL_OF_ITS_CONTENT_CONTINUE,
                      tableDefinition.getTableName()));
          if (!confirm) {
            continue;
          }
          parent = ((TreeObject) obj).getParent();
          IDatabaseConnectionFactory connectionFactory = parent.getConnectionFactory();
          try {
            deleteTable(tableDefinition, connectionFactory);
          } catch (SQLException e) {
            showMessage(String.format(FAILED_TO_DELETE_TABLE_S, tableDefinition.getTableName()));
            logger.error(e.getMessage(), e);
          }
        }
      }
    }
    if (parent != null) {
      RefreshViewAction refresh = new RefreshViewAction(viewer, parent.getChildren()[0]);
      refresh.run();
    }
  }
 protected void executeSelectStatement(TableDefinition tableDefinition, ISQLConsole view) {
   String script = tableDefinition.getContentScript();
   view.setQuery(script);
   view.executeStatement(true);
 }