preparing new release
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / view / tableview / FullModeAction.java
1 package com.quantum.view.tableview;
2
3 import java.sql.SQLException;
4
5 import com.quantum.ImageStore;
6 import com.quantum.Messages;
7 import com.quantum.sql.SQLResultSetResults;
8 import com.quantum.sql.Scrollable;
9
10 import org.eclipse.jface.viewers.ISelectionProvider;
11 import org.eclipse.jface.viewers.IStructuredSelection;
12 import org.eclipse.ui.IViewPart;
13
14
15 /**
16  * @author BC
17  */
18 public class FullModeAction extends ResultSetAction {
19
20         /**
21          * @param view
22          * @param selectionProvider
23          */
24         public FullModeAction(IViewPart view, ISelectionProvider selectionProvider) {
25                 super(view, selectionProvider);
26                 setText(Messages.getString(getClass(), "text"));
27                 setImageDescriptor(ImageStore.getImageDescriptor(ImageStore.FULLDATA));
28                 setToolTipText(Messages.getString(getClass(), "text"));
29         }
30
31         protected void executeResultSetAction(SQLResultSetResults results) throws SQLException {
32                 ((Scrollable) results).setFullMode(!((Scrollable) results).isFullMode());
33                 results.refresh(getConnection(results));
34         }
35         
36         
37         protected boolean updateSelection(IStructuredSelection selection) {
38                 return super.updateSelection(selection) 
39                                 && (selection.getFirstElement() instanceof Scrollable);
40         }
41 }