Quantum version 2.4.1
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / view / tableview / SelectAllAction.java
1 /*
2  * Created on 28-jul-2003
3  *
4  */
5 package com.quantum.view.tableview;
6
7 import com.quantum.Messages;
8
9 import org.eclipse.jface.action.Action;
10 import org.eclipse.swt.widgets.Table;
11
12
13 public final class SelectAllAction extends Action {
14         
15         private final TableView view;
16         
17         public SelectAllAction(TableView view) {
18                 super();
19                 this.view = view;
20                 setText(Messages.getString(getClass(), "text"));
21         }
22         public void run() {
23                 Table table = getTable();
24                 if (table != null) {
25                         table.selectAll();
26                 }
27         }
28         
29         private Table getTable() {
30                 ResultSetViewer viewer = this.view.getSelectedResultSetViewer();
31                 return viewer == null ? null : viewer.getTable();
32         }
33 }