1 | public class FindAction extends SquirrelAction implements ISQLPanelAction↵ | | 1 | public class ReplaceAction extends SquirrelAction implements ISQLPanelAction↵
|
2 | {↵ | | 2 | {↵
|
3 | private static final StringManager s_stringMgr =↵ | | 3 | private static final StringManager s_stringMgr =↵
|
4 | StringManagerFactory.getStringManager(FindAction.class);↵ | | 4 | StringManagerFactory.getStringManager(ReplaceAction.class);↵
|
|
|
5 | private ISession _session;↵ | | 5 | private ISession _session;↵
|
6 | private ISQLEntryPanel _sqlEntryPanel;↵ | | 6 | private ISQLEntryPanel _isqlEntryPanel;↵
|
|
7 | public FindAction(IApplication app, SyntaxPluginResources rsrc, ISQLEntryPanel sqlEntryPanel)↵ | | 7 | public ReplaceAction(IApplication app, SyntaxPluginResources rsrc)↵
|
| | | 8 | throws IllegalArgumentException↵
|
8 | {↵ | | 9 | {↵
|
9 | this(app, rsrc);↵ | | 10 | super(app, rsrc);↵
|
10 | _sqlEntryPanel = sqlEntryPanel;↵ | | |
|
11 | }↵ | | 11 | }↵
|
|
12 | public FindAction(IApplication app, SyntaxPluginResources rsrc)↵ | | 12 | public ReplaceAction(IApplication app, SyntaxPluginResources rsrc↵
|
13 | {↵ | | |
|
14 | super(app, rsrc);↵ | | |
|
15 | }↵ | | |
|
16 | ↵ | | |
|
| | | 13 | , ISQLEntryPanel isqlEntryPanel)↵
|
| | | 14 | {↵
|
| | | 15 | this(app, rsrc);↵
|
| | | 16 | _isqlEntryPanel = isqlEntryPanel;↵
|
| | | 17 | }↵
|
|
17 | public void actionPerformed(ActionEvent evt)↵ | | 18 | public void actionPerformed(ActionEvent evt)↵
|
18 | {↵ | | 19 | {↵
|
19 | if(null != _sqlEntryPanel)↵ | | 20 | if(null != _isqlEntryPanel)↵
|
20 | {↵ | | 21 | {↵
|
21 | doActionPerformed(_sqlEntryPanel, evt);↵ | | 22 | doActionPerformed(_isqlEntryPanel, evt);↵
|
22 | }↵ | | 23 | }↵
|
23 | else if(null != _session)↵ | | 24 | if(null != _session)↵
|
24 | {↵ | | 25 | {↵
|
25 | ISQLEntryPanel sqlEntryPanel = _session.getSQLPanelAPIOfActiveSessionWindow().getSQLEntryPanel();↵ | | 26 | ISQLEntryPanel sqlEntryPanel = _session.getSQLPanelAPIOfActiveSessionWindow().getSQLEntryPanel();↵
|
26 | doActionPerformed(sqlEntryPanel, evt);↵ | | 27 | doActionPerformed(sqlEntryPanel, evt);↵
|
27 | }↵ | | 28 | }↵
|
|
28 | }↵ | | 29 | }↵
|
|
29 | private void doActionPerformed(ISQLEntryPanel sqlEntryPanel, ActionEvent evt)↵ | | 30 | private void doActionPerformed(ISQLEntryPanel sqlEntryPanel, ActionEvent evt)↵
|
30 | {↵ | | 31 | {↵
|
31 | if(false == sqlEntryPanel instanceof NetbeansSQLEntryPanel)↵ | | 32 | if(false == sqlEntryPanel instanceof NetbeansSQLEntryPanel)↵
|
32 | {↵ | | 33 | {↵
|
33 | String msg =↵ | | 34 | String msg =↵
|
34 | //i18n[syntax.findNetbeansOnly=Find is only available when the Netbeans editor is used.\nSee menu File --> New Session Properties --> Tab Syntax]↵ | | 35 | //i18n[syntax.replaceNetbeansOnly=Replace is only available when the Netbeans editor is used.\nSee menu File --> New Session Properties --> Tab Syntax]↵
|
35 | s_stringMgr.getString("syntax.findNetbeansOnly");↵ | | 36 | s_stringMgr.getString("syntax.replaceNetbeansOnly");↵
|
36 | JOptionPane.showMessageDialog(_session.getApplication().getMainFrame(), msg);↵ | | 37 | JOptionPane.showMessageDialog(_session.getApplication().getMainFrame(), msg);↵
|
37 | return;↵ | | 38 | return;↵
|
38 | }↵ | | 39 | }↵
|
|
39 | NetbeansSQLEntryPanel nsep = (NetbeansSQLEntryPanel) sqlEntryPanel;↵ | | 40 | NetbeansSQLEntryPanel nsep = (NetbeansSQLEntryPanel) sqlEntryPanel;↵
|
40 | nsep.showFindDialog(evt);↵ | | 41 | nsep.showReplaceDialog(evt);↵
|
41 | }↵ | | 42 | }↵
|
|
42 | public void setSQLPanel(ISQLPanelAPI panel)↵ | | 43 | public void setSQLPanel(ISQLPanelAPI panel)↵
|
43 | {↵ | | 44 | {↵
|
44 | if(null != panel)↵ | | 45 | if(null != panel)↵
|
45 | {↵ | | 46 | {↵
|
46 | _session = panel.getSession();↵ | | 47 | _session = panel.getSession();↵
|
47 | }↵ | | 48 | }↵
|
48 | else↵ | | 49 | else↵
|
49 | {↵ | | 50 | {↵
|
50 | _session = null;↵ | | 51 | _session = null;↵
|
51 | }↵ | | 52 | }↵
|
52 | setEnabled(null != _session) | | 53 | setEnabled(null != _session)
|