title: How can I set the selection on a swt table using setSelection and setting reveal to false?
body: <p>I'm trying to select some items in my table, but I DON'T want them to be revealed.
  The problem is that calling the method (seen below) automatically results in <code>showSelected()</code> being called inside of <code>Table.class</code> and that is not what I want.</p>
  
  <pre><code>tableViewer.getTable().setSelection(lastSelectedIndices);
  </code></pre>
  
  <p>I've tried setting the selection using tableViewer, but for some reason it doesn't work
  ex: <code>tableViewer.setSelection(new StructuredSelection (lastSelectedIndices), false);</code>
  this line of code does not cause anything to be selected. </p>
  
  <p>Is there anyway I can go about selecting the table rows and NOT cause them to be revealed? 
  In my system, I need to call <code>setSelection</code> every time after the grid refreshes so that the user doesn't lose his selected item. The problem occurs when the user scrolls down the grid --> if a refresh occurs at that point, the grid jumps back up to where the selected items are. It looks really weird when the user scrolls down a table and suddenly the scroll bar jumps up to the top.</p>
  
  <p>Any help is greatly appreciated! </p>
  
  <p>--code for setting up the table --</p>
  
  <pre><code>     // add table viewer
      tableViewer = new TableViewer(this, SWT.MULTI | SWT.FULL_SELECTION | SWT.VIRTUAL);
      tableViewer.setUseHashlookup(true);
      tableViewer.addFilter(new GridPanelViewerFilter());
      tableViewer.setComparator(new GridPanelViewerComparator());
      tableViewer.setComparer(new GridPanelElementComparer());
  
      table = tableViewer.getTable();
      GridData tableGd = new GridData(SWT.FILL, SWT.FILL, true, true);
      table.setLayoutData(tableGd);
      table.setHeaderVisible(true);
      table.setLinesVisible(true);
      // set table font
      setTableFont();
  
      // listen to paint events for anti aliasing 
      table.addPaintListener( ...etcetc
  </code></pre>
  
  <p>---code for refreshing the table --</p>
  
  <pre><code>        protected void refreshGrid() {
      if(!updateGrid) return;
      Display.getDefault().asyncExec(new Runnable() {
  
          @Override
          public void run() {
              try {
                  // check if disposed
                  if (isDisposed()) {
                      log.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, getClass().getName() + ": " + "Grid already disposed"));
                      return;
                  }
                  // refresh table
                  table.setRedraw(false);
                  try {                   
                      // get last selected indices from mouse down event
                      tableViewer.refresh(true, false);
                      if(lastSelectedIndices != null){
                          tableViewer.getTable().deselectAll();
                          tableViewer.getTable().select(lastSelectedIndices);
                      }
  
                  } catch (Exception e) {
                      log.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
                              getClass().getName() + ": " + "Error at refresh table", e));
                  }
                  table.setRedraw(true);
                  // process post grid refresh
                  postGridRefresh();
  
              } catch (Exception e) {
                  log.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, getClass().getName() + ": " + "Error during refresh grid", e));
              }
          }
      });
  }
  </code></pre>