Quantum version 2.4.1
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / view / tableview / ChangeEncodingAction.java
1 package com.quantum.view.tableview;
2
3 import java.sql.SQLException;
4
5 import com.quantum.Messages;
6 import com.quantum.sql.SQLResultSetResults;
7
8 import org.eclipse.jface.viewers.ISelectionProvider;
9 import org.eclipse.ui.IViewPart;
10
11
12 /**
13  * @author BC
14  */
15 public class ChangeEncodingAction extends ResultSetAction {
16
17         private final String encoding;
18
19         /**
20          * @param view
21          * @param selectionProvider
22          */
23         public ChangeEncodingAction(IViewPart view, ISelectionProvider selectionProvider, String encoding, String key) {
24                 super(view, selectionProvider);
25                 this.encoding = encoding;
26                 setText(Messages.getString(getClass(), key));
27                 setToolTipText(Messages.getString(getClass(), key));
28         }
29
30         /* (non-Javadoc)
31          * @see com.quantum.view.tableview.ResultSetAction#executeResultSetAction(com.quantum.sql.SQLResultSetResults)
32          */
33         protected void executeResultSetAction(SQLResultSetResults results)
34                         throws SQLException {
35                 results.setEncoding(this.encoding);
36                 results.refresh(getConnection(results));
37         }
38
39 }