Modified: separate code for 'define'. was shown unnecessary closing parenthesis.
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / view / tableview / CloseAllResultSetsAction.java
1 package com.quantum.view.tableview;
2
3
4 import com.quantum.ImageStore;
5 import com.quantum.Messages;
6 import com.quantum.sql.SQLResultSetCollection;
7 import com.quantum.util.versioning.VersioningHelper;
8
9 import org.eclipse.jface.viewers.ISelectionProvider;
10 import org.eclipse.jface.viewers.IStructuredSelection;
11 import org.eclipse.ui.IViewPart;
12 import org.eclipse.ui.actions.SelectionListenerAction;
13
14 /**
15  * @author root
16  *
17  */
18 public class CloseAllResultSetsAction extends SelectionListenerAction {
19         private final ISelectionProvider selectionProvider;
20         /**
21          * @param text
22          */
23         public CloseAllResultSetsAction(IViewPart view, ISelectionProvider selectionProvider) {
24                 super("Close All");
25                 this.selectionProvider = selectionProvider;
26                 this.selectionProvider.addSelectionChangedListener(this);
27                 setEnabled(!this.selectionProvider.getSelection().isEmpty());
28                 
29                 setImageDescriptor(ImageStore.getImageDescriptor(ImageStore.CLOSE_ALL));
30                 if (VersioningHelper.isEclipse30()) {
31                         setDisabledImageDescriptor(ImageStore.getImageDescriptor(ImageStore.CLOSE_ALL_DISABLED));
32                 }
33                 setText(Messages.getString(getClass(), "text"));
34                 setToolTipText(Messages.getString(getClass(), "text"));
35         }
36         
37         public void run() {
38                 SQLResultSetCollection.getInstance().removeAllSQLResultSet();
39         }
40
41         public boolean updateSelection(IStructuredSelection selection) {
42         return !selection.isEmpty();
43         }
44 }