quick fix to avoid deploying to primary when pressing secondary DB
authorchrislovsund@netbeans.org
Wed, 27 Mar 2013 17:59:57 +0100
changeset 366ce9f6b41f737
parent 365 f78fc8ad0687
child 367 fffd72497d67
quick fix to avoid deploying to primary when pressing secondary DB
misc refactoring
added output to show what DB is used when deploying
EADS-3568 - When deploying files to secondary DB the notification dialog only shows about every other time
PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlExecuteAction.java
PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlFileExecutor.java
     1.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlExecuteAction.java	Tue Mar 26 15:22:40 2013 +0100
     1.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlExecuteAction.java	Wed Mar 27 17:59:57 2013 +0100
     1.3 @@ -50,12 +50,9 @@
     1.4  import java.beans.PropertyChangeEvent;
     1.5  import java.beans.PropertyChangeListener;
     1.6  import java.io.IOException;
     1.7 -import java.sql.Connection;
     1.8 -import java.sql.SQLException;
     1.9  import java.util.ArrayList;
    1.10  import java.util.List;
    1.11  import java.util.Locale;
    1.12 -import java.util.logging.Level;
    1.13  import java.util.logging.Logger;
    1.14  import javax.swing.*;
    1.15  import javax.swing.event.PopupMenuEvent;
    1.16 @@ -82,9 +79,9 @@
    1.17      @ActionReference(path = "Shortcuts", name = "DS-E"),
    1.18      @ActionReference(path = "Shortcuts", name = "OS-E"),
    1.19      @ActionReference(path = "Editors/text/x-plsql/Popup", name = "org-netbeans-modules-plsql-execution-PlsqlExecuteAction",
    1.20 -    position = 405, separatorBefore = 404),
    1.21 +            position = 405, separatorBefore = 404),
    1.22      @ActionReference(path = "Editors/text/x-plsql/Toolbars/Default", name = "org-netbeans-modules-plsql-execution-PlsqlExecuteAction",
    1.23 -    position = 19500, separatorBefore = 19400)
    1.24 +            position = 19500, separatorBefore = 19400)
    1.25  })
    1.26  public class PlsqlExecuteAction extends AbstractAction implements ContextAwareAction, Presenter.Toolbar {
    1.27  
    1.28 @@ -163,19 +160,16 @@
    1.29              return;
    1.30          }
    1.31  
    1.32 +        final DatabaseConnection dc;
    1.33          // If autocommit OFF - take the connection from data object.
    1.34          if (!autoCommit) {
    1.35 -            setConnection(connectionProvider.getTemplateConnection());
    1.36 +            dc = dataObject.getLookup().lookup(DatabaseConnection.class);
    1.37 +        } else {
    1.38 +            dc = connectionProvider.getTemplateConnection();
    1.39          }
    1.40 -
    1.41 -        if (connection == null) {
    1.42 -            connection = connectionProvider.getTemplateConnection();
    1.43 +        if (setConnection(dc)) {
    1.44 +            saveAndExecute();
    1.45          }
    1.46 -
    1.47 -        if (connection == null) {
    1.48 -            return;
    1.49 -        }
    1.50 -        saveAndExecute();
    1.51      }
    1.52  
    1.53      @Override
    1.54 @@ -245,58 +239,37 @@
    1.55          }
    1.56      }
    1.57  
    1.58 -    private void setConnection(DatabaseConnection newConnection) {
    1.59 -        if (connection != null && connection.getName().equals(newConnection.getName())) {
    1.60 -            connection = dataObject.getLookup().lookup(DatabaseConnection.class);
    1.61 -        } else {
    1.62 -            if (connection != null) {
    1.63 -                connection = dataObject.getLookup().lookup(DatabaseConnection.class);
    1.64 -                if (commit.getCommit()) {
    1.65 -                    if (!OptionsUtilities.isDeployNoPromptEnabled()) {
    1.66 +    private boolean setConnection(DatabaseConnection newConnection) {
    1.67 +        if (connectionHasChanged(newConnection)) {
    1.68 +//            connection = dataObject.getLookup().lookup(DatabaseConnection.class);
    1.69 +            if (commit.getCommit()) {
    1.70 +                if (!OptionsUtilities.isDeployNoPromptEnabled()) {
    1.71 +                    String msg = "Commit transactions for " + connection.getDisplayName() + " ?";
    1.72 +                    String title = "Confirm!";
    1.73 +                    int dialogAnswer = JOptionPane.showOptionDialog(null, msg, title, JOptionPane.YES_NO_CANCEL_OPTION,
    1.74 +                            JOptionPane.QUESTION_MESSAGE, null, null, null);
    1.75  
    1.76 -                        String msg = "Commit transactions for " + connection.getDisplayName() + " ?";
    1.77 -                        String title = "Confirm!";
    1.78 -                        int showOptionDialog = JOptionPane.showOptionDialog(null,
    1.79 -                                msg,
    1.80 -                                title,
    1.81 -                                JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE,
    1.82 -                                null, null, null);
    1.83 -
    1.84 -                        if (showOptionDialog == JOptionPane.YES_OPTION) {
    1.85 -                            commit.commitTransaction(dataObject, connection, connectionProvider);
    1.86 -                        } else if (showOptionDialog == JOptionPane.NO_OPTION) {
    1.87 -                            commit.rollbackTransaction(dataObject, connection, connectionProvider);
    1.88 -                        } else {
    1.89 -                            return;
    1.90 -                        }
    1.91 +                    if (dialogAnswer == JOptionPane.YES_OPTION) {
    1.92 +                        commit.commitTransaction(dataObject, connection, connectionProvider);
    1.93 +                    } else if (dialogAnswer == JOptionPane.NO_OPTION) {
    1.94 +                        commit.rollbackTransaction(dataObject, connection, connectionProvider);
    1.95 +                    } else {
    1.96 +                        return false;
    1.97                      }
    1.98                  }
    1.99              }
   1.100 -            if (!connectionProvider.isDefaultDatabase(newConnection)) {
   1.101 -                if (!OptionsUtilities.isDeployNoPromptEnabled()) {
   1.102 -                    String msg = "You are now connecting to a secondary database.";
   1.103 -                    String title = "Connecting to a Secondary Database!";
   1.104 -                    if (JOptionPane.showOptionDialog(null,
   1.105 -                            msg,
   1.106 -                            title,
   1.107 -                            JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,
   1.108 -                            null, null, null) == JOptionPane.NO_OPTION) {
   1.109 -                        return;
   1.110 -                    }
   1.111 -                    connection = newConnection;
   1.112 -                    try {
   1.113 -                        Connection jdbcConnection = connection.getJDBCConnection();
   1.114 -                        if (jdbcConnection == null || !jdbcConnection.isValid(1000)) {
   1.115 -                            return;
   1.116 -                        }
   1.117 -                    } catch (SQLException ex) {
   1.118 -                        LOG.log(Level.INFO, connection.toString(), ex);
   1.119 -                    }
   1.120 -                }
   1.121 -            } else {
   1.122 -                connection = newConnection;
   1.123 +        }
   1.124 +        if (!connectionProvider.isDefaultDatabase(newConnection) && !OptionsUtilities.isDeployNoPromptEnabled()) {
   1.125 +            String msg = "You are now connecting to a secondary database.";
   1.126 +            String title = "Connecting to a Secondary Database!";
   1.127 +            final int dialogAnswer = JOptionPane.showOptionDialog(null, msg, title, JOptionPane.YES_NO_OPTION,
   1.128 +                    JOptionPane.QUESTION_MESSAGE, null, null, null);
   1.129 +            if (dialogAnswer != JOptionPane.YES_OPTION) {
   1.130 +                return false;
   1.131              }
   1.132          }
   1.133 +        connection = newConnection;
   1.134 +        return true;
   1.135      }
   1.136  
   1.137      public void saveAndExecute() {
   1.138 @@ -346,7 +319,7 @@
   1.139                      List<PlsqlExecutableObject> newblocks = new ArrayList<PlsqlExecutableObject>();
   1.140  
   1.141                      int caretPos = 0;
   1.142 -                    if ((panes != null) && (panes.length > 0)) {
   1.143 +                    if (panes.length > 0) {
   1.144                          caretPos = panes[0].getCaretPosition();
   1.145                      }
   1.146                      for (PlsqlExecutableObject block : blocks) {
   1.147 @@ -382,6 +355,10 @@
   1.148          }
   1.149      }
   1.150  
   1.151 +    private boolean connectionHasChanged(DatabaseConnection newConnection) {
   1.152 +        return connection != null && !connection.getName().equals(newConnection.getName());
   1.153 +    }
   1.154 +
   1.155      private class ExecutionHandler implements Runnable, Cancellable {
   1.156  
   1.157          private DatabaseConnectionManager connectionProvider;
   1.158 @@ -455,9 +432,9 @@
   1.159  
   1.160              JMenuItem item = (JMenuItem) e.getSource();
   1.161              DatabaseConnection newConnection = (DatabaseConnection) item.getClientProperty(DATABASE_CONNECTION_KEY);
   1.162 -            setConnection(newConnection);
   1.163 -            saveAndExecute();
   1.164 -
   1.165 +            if (setConnection(newConnection)) {
   1.166 +                saveAndExecute();
   1.167 +            }
   1.168          }
   1.169      };
   1.170  
     2.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlFileExecutor.java	Tue Mar 26 15:22:40 2013 +0100
     2.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlFileExecutor.java	Wed Mar 27 17:59:57 2013 +0100
     2.3 @@ -113,8 +113,10 @@
     2.4      private final InputOutput preparedIO;
     2.5      private final DatabaseConnectionManager connectionProvider;
     2.6      private Savepoint firstSavepoint = null;
     2.7 +    private final String connectionDisplayName;
     2.8  
     2.9      public PlsqlFileExecutor(DatabaseConnectionManager connectionProvider, DatabaseConnection connection) {
    2.10 +        this.connectionDisplayName = "Using DB: " + connection.getDisplayName() + " [" + connection.getName() + "]";
    2.11          this.connection = connection;
    2.12          this.preparedIO = null;
    2.13          this.connectionProvider = connectionProvider;
    2.14 @@ -123,10 +125,11 @@
    2.15  
    2.16      public PlsqlFileExecutor(DatabaseConnectionManager connectionProvider, Connection debugConnection, InputOutput io) {
    2.17          this.connection = null;
    2.18 +        this.connectionDisplayName = null;
    2.19          this.debugConnection = debugConnection;
    2.20          this.preparedIO = io;
    2.21          this.connectionProvider = connectionProvider;
    2.22 -        this.cache = DatabaseContentManager.getInstance(connection);
    2.23 +//        this.cache = DatabaseContentManager.getInstance(connection);
    2.24      }
    2.25  
    2.26      public void cancel() {
    2.27 @@ -359,11 +362,11 @@
    2.28                  io.getOut().println();
    2.29              } else {
    2.30                  io.getOut().reset();
    2.31 -                io.getErr().reset();
    2.32                  io.getOut().flush();
    2.33                  io.getErr().flush();
    2.34              }
    2.35              io.select();
    2.36 +            io.getOut().println(connectionDisplayName);
    2.37              io.getOut().println(startMsg);
    2.38              io.getOut().println("-------------------------------------------------------------");
    2.39          } catch (IOException ex) {
    2.40 @@ -391,7 +394,7 @@
    2.41  
    2.42      }
    2.43  
    2.44 -    public InputOutput executePLSQL(List executableObjs, Document doc, boolean hidden, boolean autoCommit) {
    2.45 +    public InputOutput executePLSQL(List<PlsqlExecutableObject> executableObjs, Document doc, boolean hidden, boolean autoCommit) {
    2.46          final PlsqlFileValidatorService validator = Lookup.getDefault().lookup(PlsqlFileValidatorService.class);
    2.47          Project project = null;
    2.48          Object object = doc.getProperty(Document.StreamDescriptionProperty);
    2.49 @@ -432,7 +435,7 @@
    2.50          //quick & dirty fix to avoid having output tabs for the SQL Execution window (unless there's an exception)
    2.51          //first check to see if this is a simple select statement and if so treat it separately.
    2.52          if (executableObjs.size() == 1) {
    2.53 -            PlsqlExecutableObject executionObject = (PlsqlExecutableObject) executableObjs.get(0);
    2.54 +            PlsqlExecutableObject executionObject = executableObjs.get(0);
    2.55              if (executionObject.getType() == PlsqlExecutableObjectType.STATEMENT || executionObject.getType() == PlsqlExecutableObjectType.UNKNOWN) {
    2.56                  String plsqlText = executionObject.getPlsqlString();
    2.57                  try {
    2.58 @@ -459,7 +462,7 @@
    2.59  
    2.60                  } catch (SQLException sqlEx) {
    2.61                      try {
    2.62 -                        io = initializeIO(fileName, getIOTabName(executableObjs, fileName, dataObj.getNodeDelegate().getDisplayName()), dataObj);
    2.63 +                        io = initializeIO(fileName, getIOTabName(executableObjs.get(0), fileName, dataObj.getNodeDelegate().getDisplayName()), dataObj);
    2.64                          int errLine = getLineNumberFromMsg(sqlEx.getMessage());
    2.65                          int outLine = executionObject.getStartLineNo() + errLine - 1;
    2.66                          String msg = getmodifiedErorrMsg(sqlEx.getMessage(), outLine);
    2.67 @@ -483,7 +486,7 @@
    2.68          try {
    2.69  
    2.70  
    2.71 -            io = initializeIO(fileName, getIOTabName(executableObjs, fileName, dataObj.getNodeDelegate().getDisplayName()), dataObj);
    2.72 +            io = initializeIO(fileName, getIOTabName(executableObjs.get(0), fileName, dataObj.getNodeDelegate().getDisplayName()), dataObj);
    2.73              con = debugConnection != null ? debugConnection : connection.getJDBCConnection();
    2.74              con.setAutoCommit(false);
    2.75              enableDbmsOut(con);
    2.76 @@ -493,14 +496,14 @@
    2.77              stm = con.createStatement();
    2.78              stm.setEscapeProcessing(false);
    2.79              boolean firstSelectStatement = true;
    2.80 -            for (int i = 0; i < executableObjs.size(); i++) {
    2.81 +
    2.82 +            for (PlsqlExecutableObject exeObj : executableObjs) {
    2.83                  if (cancel) {
    2.84                      io.getErr().println("!!!Execution cancelled. Performing rollback");
    2.85                      // con.rollback();
    2.86                      con.rollback(firstSavepoint);
    2.87                      return io;
    2.88                  }
    2.89 -                PlsqlExecutableObject exeObj = (PlsqlExecutableObject) executableObjs.get(i);
    2.90                  int lineNumber = exeObj.getStartLineNo();
    2.91                  String plsqlText = exeObj.getPlsqlString();
    2.92  
    2.93 @@ -810,7 +813,7 @@
    2.94                          break;
    2.95                      }
    2.96                  }
    2.97 -                List errLst;
    2.98 +                List<PlsqlErrorObject> errLst;
    2.99                  boolean exception = false;
   2.100                  String excMessage = "";
   2.101                  if (exeObj.getType() == PlsqlExecutableObjectType.PROCEDURE) {
   2.102 @@ -837,7 +840,7 @@
   2.103                      } else {
   2.104                          io.getErr().println((new StringBuilder()).append("!!!Procedure ").append(exeObjName).append(" Created With Compilation Errors").toString());
   2.105                          for (int a = 0; a < errLst.size(); a++) {
   2.106 -                            PlsqlErrorObject errObj = (PlsqlErrorObject) errLst.get(a);
   2.107 +                            PlsqlErrorObject errObj = errLst.get(a);
   2.108                              int stNo = exeObj.getStartLineNo();
   2.109                              int errNo = errObj.getLineNumber();
   2.110                              if (errNo <= 0) {
   2.111 @@ -880,7 +883,7 @@
   2.112                      } else {
   2.113                          io.getErr().println((new StringBuilder()).append("!!!Function ").append(exeObjName).append(" Created With Compilation Errors").toString());
   2.114                          for (int a = 0; a < errLst.size(); a++) {
   2.115 -                            PlsqlErrorObject errObj = (PlsqlErrorObject) errLst.get(a);
   2.116 +                            PlsqlErrorObject errObj = errLst.get(a);
   2.117                              int stNo = exeObj.getStartLineNo();
   2.118                              int errNo = errObj.getLineNumber();
   2.119                              if (errNo <= 0) {
   2.120 @@ -922,7 +925,7 @@
   2.121                      } else {
   2.122                          io.getErr().println((new StringBuilder()).append("!!!Package ").append(exeObjName).append(" Created With Compilation Errors").toString());
   2.123                          for (int a = 0; a < errLst.size(); a++) {
   2.124 -                            PlsqlErrorObject errObj = (PlsqlErrorObject) errLst.get(a);
   2.125 +                            PlsqlErrorObject errObj = errLst.get(a);
   2.126                              int stNo = exeObj.getStartLineNo();
   2.127                              int errNo = errObj.getLineNumber();
   2.128                              if (errNo <= 0) {
   2.129 @@ -966,7 +969,7 @@
   2.130                  } else {
   2.131                      io.getErr().println((new StringBuilder()).append("!!!Package Body ").append(exeObjName).append(" Created With Compilation Errors").toString());
   2.132                      for (int a = 0; a < errLst.size(); a++) {
   2.133 -                        PlsqlErrorObject errObj = (PlsqlErrorObject) errLst.get(a);
   2.134 +                        PlsqlErrorObject errObj = errLst.get(a);
   2.135                          int stNo = exeObj.getStartLineNo();
   2.136                          int errNo = errObj.getLineNumber();
   2.137                          if (errNo <= 0) {
   2.138 @@ -1012,6 +1015,7 @@
   2.139                  if (preparedIO == null) {
   2.140                      io.getOut().println("-------------------------------------------------------------");
   2.141                      io.getOut().println(endMsg + " (Total times: " + totalTime + "s)");
   2.142 +                    io.getOut().println(connectionDisplayName);
   2.143                      io.getOut().println(new Timestamp(endTime).toString());
   2.144                  }
   2.145              }
   2.146 @@ -1047,8 +1051,8 @@
   2.147          return msg;
   2.148      }
   2.149  
   2.150 -    private List getPackageerrors(String packageName, String packageType) {
   2.151 -        List<PlsqlErrorObject> lst = new ArrayList<PlsqlErrorObject>();
   2.152 +    private List<PlsqlErrorObject> getPackageerrors(String packageName, String packageType) {
   2.153 +        List<PlsqlErrorObject> errorObjects = new ArrayList<PlsqlErrorObject>();
   2.154          Connection con = debugConnection != null ? debugConnection : connection.getJDBCConnection();
   2.155          if (con != null) {
   2.156              Statement stm = null;
   2.157 @@ -1064,7 +1068,7 @@
   2.158                      errObj.setLineNumber(lineNo);
   2.159                      errObj.setPosition(pos);
   2.160                      errObj.setErrorMsg(msg);
   2.161 -                    lst.add(errObj);
   2.162 +                    errorObjects.add(errObj);
   2.163                  }
   2.164              } catch (SQLException e) {
   2.165              } finally {
   2.166 @@ -1079,7 +1083,7 @@
   2.167          } else {
   2.168              throw new RuntimeException("Not Connected to Database to Get USER_ERRORS");
   2.169          }
   2.170 -        return lst;
   2.171 +        return errorObjects;
   2.172      }
   2.173  
   2.174      /**
   2.175 @@ -1112,8 +1116,7 @@
   2.176       * @return
   2.177       */
   2.178      private List<Character> getAliases(HashMap<String, String> definesMap, Document doc, int start, int end, List<Character> define, InputOutput io) {
   2.179 -        TokenHierarchy tokenHierarchy = TokenHierarchy.get(doc);
   2.180 -        @SuppressWarnings("unchecked")
   2.181 +        TokenHierarchy<Document> tokenHierarchy = TokenHierarchy.get(doc);
   2.182          TokenSequence<PlsqlTokenId> ts = tokenHierarchy.tokenSequence(PlsqlTokenId.language());
   2.183          ts.move(start);
   2.184          boolean moveNext = ts.moveNext();
   2.185 @@ -1384,9 +1387,7 @@
   2.186                      //Load the editor cookier and allow parsing
   2.187                      Document document = PlsqlFileUtil.getDocument(obj);
   2.188                      PlsqlExecutableBlocksMaker blockMaker = new PlsqlExecutableBlocksMaker(document);
   2.189 -                    final List exeBlocks = blockMaker.makeExceutableObjects();
   2.190 -                    executePLSQL(exeBlocks, document, true, true);
   2.191 -
   2.192 +                    executePLSQL(blockMaker.makeExceutableObjects(), document, true, true);
   2.193                  }
   2.194              } else {
   2.195                  io.getOut().println("!!!Error opening " + fileName);
   2.196 @@ -1441,29 +1442,24 @@
   2.197           * @param databaseConenction
   2.198           * @return
   2.199           */
   2.200 -        private SQLExecutionResults execute(String sqlScript, int startOffset, int endOffset,
   2.201 -                DatabaseConnection conn) {
   2.202 +        private SQLExecutionResults execute(String sqlScript, int startOffset, int endOffset, DatabaseConnection conn) {
   2.203              boolean cancelled = false;
   2.204              List<StatementInfo> statements = getStatements(sqlScript, startOffset, endOffset);
   2.205              List<SQLExecutionResult> results = new ArrayList<SQLExecutionResult>();
   2.206              String url = conn.getDatabaseURL();
   2.207 -
   2.208 -            for (Iterator i = statements.iterator(); i.hasNext();) {
   2.209 +            for (StatementInfo info : statements) {
   2.210                  cancelled = Thread.currentThread().isInterrupted();
   2.211                  if (cancelled) {
   2.212                      break;
   2.213                  }
   2.214  
   2.215 -                StatementInfo info = (StatementInfo) i.next();
   2.216                  String sql = info.getSQL();
   2.217  
   2.218 -                SQLExecutionResult result = null;
   2.219                  DataView view = DataView.create(conn, sql, DEFAULT_PAGE_SIZE);
   2.220  
   2.221                  // Save SQL statements executed for the SQLHistoryManager
   2.222                  SQLHistoryManager.getInstance().saveSQL(new SQLHistoryEntry(url, sql, new Date()));
   2.223 -                result = new SQLExecutionResult(info, view);
   2.224 -                results.add(result);
   2.225 +                results.add(new SQLExecutionResult(info, view));
   2.226              }
   2.227  
   2.228              // Persist SQL executed
   2.229 @@ -1514,9 +1510,7 @@
   2.230          private void displayErrors(SQLExecutionResults results) {
   2.231              if (results != null) {
   2.232                  for (SQLExecutionResult result : results.getResults()) {
   2.233 -                    Collection<Throwable> collect = result.getExceptions();
   2.234 -                    for (Iterator it = collect.iterator(); it.hasNext();) {
   2.235 -                        Throwable excep = (Throwable) it.next();
   2.236 +                    for (Throwable excep : result.getExceptions()) {
   2.237                          NotifyDescriptor descriptor = new NotifyDescriptor.Message(excep.getLocalizedMessage(), NotifyDescriptor.ERROR_MESSAGE);
   2.238                          DialogDisplayer.getDefault().notifyLater(descriptor);
   2.239                      }
   2.240 @@ -1534,10 +1528,9 @@
   2.241       * Get the suitable IO tab name, according to the content
   2.242       * of the file.
   2.243       */
   2.244 -    private String getIOTabName(List executableObjs, String fileName, String displayName) {
   2.245 -        PlsqlExecutableObject executionObject = (PlsqlExecutableObject) executableObjs.get(0);
   2.246 +    private String getIOTabName(PlsqlExecutableObject executionObject, String fileName, String displayName) {
   2.247          if (fileName.equals(displayName)) {
   2.248 -            if (executableObjs.size() > 0 && fileName.endsWith(".tdb")) {
   2.249 +            if (executionObject != null && fileName.endsWith(".tdb")) {
   2.250                  String str = executionObject.getPlsqlString().replaceAll("\n", " ");
   2.251                  fileName = str.length() > 30 ? str.substring(0, 30) + "..." : str;
   2.252              }
   2.253 @@ -1638,6 +1631,7 @@
   2.254                                      Object pageContext = method.invoke(delegate);
   2.255                                      method = pageContext.getClass().getDeclaredMethod("getCurrentRows");
   2.256                                      method.setAccessible(true);
   2.257 +                                    @SuppressWarnings("unchecked")
   2.258                                      List<Object[]> currentRows = (List<Object[]>) method.invoke(pageContext);
   2.259                                      //Get selected row numbers
   2.260                                      method = tableUI.getClass().getMethod("getSelectedRows");