1 package com.quantum.view.tableview;
4 import com.quantum.ImageStore;
5 import com.quantum.Messages;
6 import com.quantum.sql.SQLResultSetCollection;
7 import com.quantum.util.versioning.VersioningHelper;
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;
18 public class CloseAllResultSetsAction extends SelectionListenerAction {
19 private final ISelectionProvider selectionProvider;
23 public CloseAllResultSetsAction(IViewPart view, ISelectionProvider selectionProvider) {
25 this.selectionProvider = selectionProvider;
26 this.selectionProvider.addSelectionChangedListener(this);
27 setEnabled(!this.selectionProvider.getSelection().isEmpty());
29 setImageDescriptor(ImageStore.getImageDescriptor(ImageStore.CLOSE_ALL));
30 if (VersioningHelper.isEclipse30()) {
31 setDisabledImageDescriptor(ImageStore.getImageDescriptor(ImageStore.CLOSE_ALL_DISABLED));
33 setText(Messages.getString(getClass(), "text"));
34 setToolTipText(Messages.getString(getClass(), "text"));
38 SQLResultSetCollection.getInstance().removeAllSQLResultSet();
41 public boolean updateSelection(IStructuredSelection selection) {
42 return !selection.isEmpty();