import java.util.Vector;
+import com.quantum.Messages;
+import com.quantum.QuantumPlugin;
+import com.quantum.extensions.ProcessServiceMembers;
+import com.quantum.model.Bookmark;
+import com.quantum.model.Entity;
+import com.quantum.model.NotConnectedException;
+import com.quantum.sql.SQLResults;
+import com.quantum.ui.dialog.ExceptionDisplayDialog;
+import com.quantum.view.LogProxy;
+
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.ui.WorkbenchException;
import org.eclipse.ui.part.ViewPart;
-import com.quantum.Messages;
-import com.quantum.QuantumPlugin;
-import com.quantum.extensions.ProcessServiceMembers;
-import com.quantum.model.Bookmark;
-import com.quantum.model.Entity;
-import com.quantum.model.NotConnectedException;
-import com.quantum.sql.SQLResults;
-import com.quantum.ui.dialog.ExceptionDisplayDialog;
-import com.quantum.view.LogProxy;
-
/**
* The Table View. Displays tables and Queries.
*/
ta.setEncoding(TableAdapter.DEFAULT);
}
}
- private static TableView instance = null;
private TabFolder tabs = null;
private Composite parent;
private Vector extensionVector;
* Reload table or query data into the selected tab
*/
public void refreshCurrent() {
- TabItem item = tabs.getItem(tabs.getSelectionIndex());
- TableAdapter adapter = (TableAdapter) item.getData();
- Bookmark bookmark = adapter.getBookmark();
- String table = adapter.getTable();
- if (table == null) {
- loadTable(bookmark, item, null, null, true, true);
- } else {
- loadTable(bookmark, item, null, null, true, true);
+System.out.println("Refresh?");
+ if (tabs.getSelectionIndex() >= 0) {
+System.out.println("Refresh!");
+ TabItem item = tabs.getItem(tabs.getSelectionIndex());
+ TableAdapter adapter = (TableAdapter) item.getData();
+ Bookmark bookmark = adapter.getBookmark();
+ String table = adapter.getTable();
+ if (table == null) {
+ loadTable(bookmark, item, null, null, true, true);
+ } else {
+ loadTable(bookmark, item, null, null, true, true);
+ }
+ String title = Messages.getString("tableview.QuantumTableViewName"); //$NON-NLS-1$
+ if (bookmark != null)
+ title = bookmark.getName() + Messages.getString("tableview.ViewNameInitialDecoration") + title + Messages.getString("tableview.ViewNameFinalDecoration"); //$NON-NLS-1$ //$NON-NLS-2$
+ setTitle(title);
}
- String title = Messages.getString("tableview.QuantumTableViewName"); //$NON-NLS-1$
- if (bookmark != null)
- title = bookmark.getName() + Messages.getString("tableview.ViewNameInitialDecoration") + title + Messages.getString("tableview.ViewNameFinalDecoration"); //$NON-NLS-1$ //$NON-NLS-2$
- setTitle(title);
}
public void loadQuery(Bookmark bookmark, SQLResults results) {
if (tableName != null) {
tabItem.setText(bookmark.getName() + ":" + tableName);
} else {
- tabItem.setText(bookmark.getName() + ":" + adapter.getQuery());
+ tabItem.setText(bookmark.getName() + ": SQL");
+ tabItem.setToolTipText(bookmark.getName() + ":\n" + adapter.getQuery());
}
toolBar.getPrevious().setEnabled(adapter.hasPreviousPage());
}
public void createPartControl(Composite parent) {
- instance = this;
this.parent = parent;
initActions();
tabs = new TabFolder(parent, SWT.NONE);
}
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
-
}
}
\ No newline at end of file