X-Git-Url: http://git.phpeclipse.com diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/tableview/CloseAllResultSetsAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/tableview/CloseAllResultSetsAction.java new file mode 100644 index 0000000..af300bf --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/tableview/CloseAllResultSetsAction.java @@ -0,0 +1,44 @@ +package com.quantum.view.tableview; + + +import com.quantum.ImageStore; +import com.quantum.Messages; +import com.quantum.sql.SQLResultSetCollection; +import com.quantum.util.versioning.VersioningHelper; + +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.actions.SelectionListenerAction; + +/** + * @author root + * + */ +public class CloseAllResultSetsAction extends SelectionListenerAction { + private final ISelectionProvider selectionProvider; + /** + * @param text + */ + public CloseAllResultSetsAction(IViewPart view, ISelectionProvider selectionProvider) { + super("Close All"); + this.selectionProvider = selectionProvider; + this.selectionProvider.addSelectionChangedListener(this); + setEnabled(!this.selectionProvider.getSelection().isEmpty()); + + setImageDescriptor(ImageStore.getImageDescriptor(ImageStore.CLOSE_ALL)); + if (VersioningHelper.isEclipse30()) { + setDisabledImageDescriptor(ImageStore.getImageDescriptor(ImageStore.CLOSE_ALL_DISABLED)); + } + setText(Messages.getString(getClass(), "text")); + setToolTipText(Messages.getString(getClass(), "text")); + } + + public void run() { + SQLResultSetCollection.getInstance().removeAllSQLResultSet(); + } + + public boolean updateSelection(IStructuredSelection selection) { + return !selection.isEmpty(); + } +}