1 | class InQuotesAction extends SquirrelAction↵ | | 1 | class RemoveNewLinesAction extends SquirrelAction↵
|
2 | implements ISQLPanelAction↵ | | 2 | implements ISQLPanelAction↵
|
3 | {↵ | | 3 | {↵
|
4 | private static final StringManager s_stringMgr =↵ | | 4 | private static final StringManager s_stringMgr =↵
|
5 | StringManagerFactory↵ | | 5 | StringManagerFactory↵
|
6 | .getStringManager(InQuotesAction.class);↵ | | 6 | .getStringManager(RemoveQuotesAction.class);↵
|
|
|
7 | /** Logger for this class. */↵ | | 7 | /** Logger for this class. */↵
|
8 | private static final ILogger s_log =↵ | | 8 | private static final ILogger s_log =↵
|
9 | LoggerController↵ | | 9 | LoggerController↵
|
10 | .createLogger(InQuotesAction.class);↵ | | 10 | .createLogger(RemoveNewLinesAction.class);↵
|
|
11 | /** Current session. */↵ | | 11 | /** Current session. */↵
|
12 | private ISession _session;↵ | | 12 | private ISession _session;↵
|
|
13 | private EditExtrasPlugin _plugin;↵ | | 13 | private EditExtrasPlugin _plugin;↵
|
|
14 | InQuotesAction(IApplication app, EditExtrasPlugin plugin)↵ | | 14 | RemoveNewLinesAction(IApplication app, EditExtrasPlugin plugin)↵
|
15 | {↵ | | |
|
16 | ↵ | | 15 | {↵
|
17 | super(app, plugin.getResources());↵ | | 16 | super(app, plugin.getResources());↵
|
18 | _plugin = plugin;↵ | | 17 | _plugin = plugin;↵
|
19 | }↵ | | 18 | }↵
|
|
|
20 | public void setSQLPanel(ISQLPanelAPI panel)↵ | | 19 | public void setSQLPanel(ISQLPanelAPI panel)↵
|
21 | {↵ | | 20 | {↵
|
22 | if(null != panel)↵ | | 21 | if (null != panel) {↵
|
23 | {↵ | | 22 | ↵
|
24 | _session = panel.getSession();↵ | | 23 | _session = panel.getSession();↵
|
25 | }↵ | | 24 | ↵
|
26 | else↵ | | 25 | } else↵
|
27 | ↵ | | 26 | {↵
|
28 | {↵ | | 27 | ↵
|
29 | _session = null;↵ | | 28 | _session = null;↵
|
30 | }↵ | | 29 | }↵
|
31 | setEnabled(null != _session);↵ | | 30 | setEnabled(null != _session);↵
|
32 | }↵ | | 31 | }↵
|
|
|
|
33 | public void actionPerformed(ActionEvent evt)↵ | | 32 | public void actionPerformed(ActionEvent evt)↵
|
34 | {↵ | | |
|
35 | ↵ | | 33 | {↵
|
36 | if (_session != null)↵ | | 34 | if (_session != null)↵
|
37 | {↵ | | |
|
38 | try↵ | | |
|
39 | {↵ | | |
|
40 | //new InQuotesCommand(_session.getSQLPanelAPI(_plugin)).execute();↵ | | |
|
41 | new InQuotesCommand(FrameWorkAcessor.getSQLPanelAPI(_session, _plugin)).execute();↵ | | |
|
42 | }↵ | | |
|
43 | ↵ | | 35 | {↵
|
| | | 36 | try {↵
|
| | | 37 | RemoveNewLinesCommand command = new RemoveNewLinesCommand(↵
|
| | | 38 | FrameWorkAcessor.getSQLPanelAPI(_session, _plugin));↵
|
| | | 39 | command.execute();↵
|
44 | catch (Throwable ex)↵ | | 40 | } catch (Throwable ex)↵
|
45 | {↵ | | |
|
46 | ↵ | | 41 | {↵
|
47 | // i18n[editextras.errorQuoteSql=Error processing Quote↵ | | 42 | // i18n[editextras.errorRemoveNewLines=Error processing Remove↵
|
48 | SQL command: {0}]↵ | | 43 | // NewLines SQL command: {0}]↵
|
49 | final String msg = s_stringMgr.getString("editextras.errorQuoteSql", ex);↵ | | 44 | final String msg = s_stringMgr.getString(↵
|
50 | ↵ | | |
|
| | | 45 | "editextras.errorRemoveNewLines", ex);↵
|
|
51 | _session.showErrorMessage(msg);↵ | | 46 | _session.showErrorMessage(msg);↵
|
52 | s_log.error(msg, ex);↵ | | 47 | s_log.error(msg, ex);↵
|
53 | | | 48 |
|