1 | public abstract class AbstractSQLPanelAction extends SquirrelAction implements ISQLPanelAction {↵ | | 1 | public abstract class AbstractSessionAction extends SquirrelAction implements ISessionAction {↵
|
2 | /** Current sql panel */↵ | | 2 | /** Current session. */↵
|
3 | protected ISQLPanelAPI _panel;↵ | | 3 | protected ISession _session;↵
|
|
|
4 | public AbstractSQLPanelAction(IApplication app, Resources rsrc) {↵ | | 4 | public AbstractSessionAction(IApplication app, Resources rsrc) {↵
|
5 | super(app, rsrc);↵ | | 5 | super(app, rsrc);↵
|
6 | }↵ | | 6 | }↵
|
|
|
7 | public void actionPerformed(ActionEvent evt) {↵ | | 7 | public void actionPerformed(ActionEvent evt) {↵
|
8 | if (_panel != null) {↵ | | 8 | if (_session != null) {↵
|
9 | try {↵ | | 9 | try {↵
|
10 | getCommand().execute();↵ | | 10 | getCommand().execute();↵
|
11 | } catch (Exception e) {↵ | | 11 | } catch (Exception e) {↵
|
12 | _panel.getSession().showMessage(e);↵ | | 12 | _session.showMessage(e);↵
|
13 | }↵ | | 13 | }↵
|
14 | }↵ | | 14 | }↵
|
15 | }↵ | | 15 | }↵
|
|
|
16 | protected abstract ICommand getCommand();↵ | | 16 | protected abstract ICommand getCommand();↵
|
|
|
17 | /**↵ | | 17 | /**↵
|
18 | * Set the current sql panel.↵ | | 18 | * Set the current session.↵
|
19 | *↵ | | 19 | *↵
|
20 | * @param panel The current sql panel.↵ | | 20 | * @param session The current session.↵
|
21 | */↵ | | 21 | */↵
|
22 | public void setSQLPanel(ISQLPanelAPI panel) {↵ | | 22 | public void setS↵
|
23 | _panel = panel↵ | | 23 | ession(ISession session) {↵
|
24 | ;↵ | | 24 | _session = session;↵
|
25 | setEnabled(_panel != null) | | 25 | setEnabled(_session != null)
|