newest quantum CVS sources
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / view / tableview / TableView.java
index 8e23888..c9b151a 100644 (file)
@@ -2,6 +2,16 @@ package com.quantum.view.tableview;
 
 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;
@@ -23,16 +33,6 @@ import org.eclipse.ui.IWorkbenchPart;
 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.
  */
@@ -98,19 +98,23 @@ public class TableView extends ViewPart implements ISelectionListener {
         * 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) {
@@ -277,6 +281,5 @@ public class TableView extends ViewPart implements ISelectionListener {
        }
 
        public void selectionChanged(IWorkbenchPart part, ISelection selection) {
-
        }
 }
\ No newline at end of file