show HTML files as local resources (no 'http://' url prefix)
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / view / tableview / TableView.java
index dc41455..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.
  */
@@ -48,7 +48,6 @@ public class TableView extends ViewPart implements ISelectionListener {
                ta.setEncoding(TableAdapter.DEFAULT);
         }
     }
-    private static TableView instance = null;
        private TabFolder tabs = null;
        private Composite parent;
        private Vector extensionVector;
@@ -99,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) {
@@ -179,7 +182,8 @@ public class TableView extends ViewPart implements ISelectionListener {
                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());
@@ -261,7 +265,6 @@ public class TableView extends ViewPart implements ISelectionListener {
        }
 
        public void createPartControl(Composite parent) {
-               instance = this;
                this.parent = parent;
                initActions();
                tabs = new TabFolder(parent, SWT.NONE);
@@ -278,6 +281,5 @@ public class TableView extends ViewPart implements ISelectionListener {
        }
 
        public void selectionChanged(IWorkbenchPart part, ISelection selection) {
-
        }
 }
\ No newline at end of file