1 | class RemoveNewLinesAction extends SquirrelAction ↵ | | 1 | class RemoveQuotesAction 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(RemoveQuotesAction.class);↵ | | 6 | .getStringManager(RemoveQuotesAction.class);↵
|
|
7 | ↵ | | |
|
8 | /** Logger for this class. */↵ | | 7 | /** Logger for this class. */↵
|
9 | private static final ILogger s_log = ↵ | | 8 | private static final ILogger s_log =↵
|
10 | LoggerController↵ | | 9 | LoggerController↵
|
11 | .createLogger(RemoveNewLinesAction.class);↵ | | 10 | .createLogger(RemoveQuotesAction.class);↵
|
|
12 | /** Current session. */↵ | | 11 | /** Current session. */↵
|
13 | private ISession _session;↵ | | 12 | private ISession _session;↵
|
|
14 | private EditExtrasPlugin _plugin;↵ | | 13 | private EditExtrasPlugin _plugin;↵
|
|
15 | RemoveNewLinesAction(IApplication app, EditExtrasPlugin plugin) {↵ | | 14 | RemoveQuotesAction(IApplication app, EditExtrasPlugin plugin)↵
|
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 | _session = null;↵ | | 27 | _session = null;↵
|
29 | }↵ | | 28 | }↵
|
30 | setEnabled(null != _session);↵ | | 29 | setEnabled(null != _session);↵
|
31 | }↵ | | 30 | }↵
|
|
32 | ↵ | | |
|
33 | public void actionPerformed(ActionEvent evt) {↵ | | 31 | public void actionPerformed(ActionEvent evt)↵
|
34 | ↵ | | |
|
| | | 32 | {↵
|
35 | if (_session != null) {↵ | | 33 | if (_session != null)↵
|
36 | try {↵ | | |
|
37 | ↵ | | |
|
| | | 34 | {↵
|
| | | 35 | try↵
|
| | | 36 | {↵
|
38 | RemoveNewLinesCommand command = ↵ | | 37 | //new RemoveQuotesCommand(_session.getSQLPanelAPI(_plugin)).execute();↵
|
39 | new RemoveNewLinesCommand(↵ | | 38 | new RemoveQuotesCommand(↵
|
40 | FrameWorkAcessor.getSQLPanelAPI(_session, _plugin));↵ | | 39 | FrameWorkAcessor.getSQLPanelAPI(_session, _plugin))↵
|
41 | command.execute();↵ | | |
|
42 | } ↵ | | 40 | .execute();↵
|
| | | 41 | }↵
|
43 | catch (Throwable ex) {↵ | | 42 | catch (Throwable ex)↵
|
44 | ↵ | | |
|
| | | 43 | {↵
|
45 | // i18n[editextras.errorRemoveNewLines=Error processing Remove↵ | | 44 | // i18n[editextras.errorRemoveQuotes=Error processing Remove↵
|
46 | // NewLines SQL command: {0}]↵ | | 45 | Quotes SQL command: {0}]↵
|
47 | final String msg = s_stringMgr.getString(↵ | | 46 | final String msg = s_stringMgr.getString(↵
|
48 | "editextras.errorRemoveNewLines", ex);↵ | | 47 | "editextras.errorRemoveQuotes", ex);↵
|
|
49 | _session.showErrorMessage(msg);↵ | | 48 | _session.showErrorMessage(msg);↵
|
50 | s_log.error(msg, ex);↵ | | 49 | s_log.error(msg, ex);↵
|
51 | | | 50 |
|