1 |
iliev |
787 |
/* |
2 |
|
|
* JSampler - a java front-end for LinuxSampler |
3 |
|
|
* |
4 |
iliev |
1818 |
* Copyright (C) 2005-2008 Grigor Iliev <grigor@grigoriliev.com> |
5 |
iliev |
787 |
* |
6 |
|
|
* This file is part of JSampler. |
7 |
|
|
* |
8 |
|
|
* JSampler is free software; you can redistribute it and/or modify |
9 |
|
|
* it under the terms of the GNU General Public License version 2 |
10 |
|
|
* as published by the Free Software Foundation. |
11 |
|
|
* |
12 |
|
|
* JSampler is distributed in the hope that it will be useful, |
13 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
|
|
* GNU General Public License for more details. |
16 |
|
|
* |
17 |
|
|
* You should have received a copy of the GNU General Public License |
18 |
|
|
* along with JSampler; if not, write to the Free Software |
19 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
20 |
|
|
* MA 02111-1307 USA |
21 |
|
|
*/ |
22 |
|
|
|
23 |
|
|
package org.jsampler.view.classic; |
24 |
|
|
|
25 |
|
|
import java.awt.event.ActionEvent; |
26 |
|
|
|
27 |
|
|
import java.beans.PropertyChangeEvent; |
28 |
|
|
import java.beans.PropertyChangeListener; |
29 |
|
|
|
30 |
|
|
import javax.swing.AbstractAction; |
31 |
|
|
import javax.swing.Action; |
32 |
|
|
|
33 |
|
|
import org.jsampler.CC; |
34 |
|
|
import org.jsampler.HF; |
35 |
|
|
|
36 |
|
|
import org.jsampler.view.JSChannel; |
37 |
|
|
import org.jsampler.view.JSChannelsPane; |
38 |
|
|
import org.jsampler.view.JSMainFrame; |
39 |
iliev |
1285 |
import org.jsampler.view.std.JSAddMidiInstrumentMapDlg; |
40 |
iliev |
787 |
|
41 |
iliev |
1285 |
import org.jsampler.view.std.JSNewMidiDeviceDlg; |
42 |
|
|
import org.jsampler.view.std.JSNewAudioDeviceDlg; |
43 |
|
|
import org.jsampler.view.std.JSNewMidiInstrumentWizard; |
44 |
|
|
import org.jsampler.view.std.StdA4n; |
45 |
|
|
|
46 |
iliev |
787 |
import static org.jsampler.view.classic.ClassicI18n.i18n; |
47 |
|
|
|
48 |
|
|
|
49 |
|
|
/** |
50 |
|
|
* This class provides an <code>Action</code> instances performing all needed tasks. |
51 |
|
|
* @author Grigor Iliev |
52 |
|
|
*/ |
53 |
iliev |
1285 |
public class A4n extends StdA4n { |
54 |
|
|
protected static A4n a4n = new A4n(); |
55 |
|
|
|
56 |
|
|
/** Forbids the instantiation of <code>A4n</code> */ |
57 |
|
|
private A4n() { |
58 |
|
|
refresh.putValue(Action.SMALL_ICON, Res.iconReload32); |
59 |
|
|
resetSampler.putValue(Action.SMALL_ICON, Res.iconReset32); |
60 |
|
|
exportSamplerConfig.putValue(Action.SMALL_ICON, Res.iconExportSession32); |
61 |
|
|
exportMidiInstrumentMaps.putValue(Action.SMALL_ICON, Res.iconExport16); |
62 |
iliev |
1818 |
|
63 |
|
|
moveChannelsUp.putValue(Action.SMALL_ICON, Res.iconUp24); |
64 |
|
|
moveChannelsDown.putValue(Action.SMALL_ICON, Res.iconDown24); |
65 |
|
|
|
66 |
|
|
duplicateChannels.putValue(Action.SMALL_ICON, Res.iconCopy24); |
67 |
|
|
removeChannels.putValue(Action.SMALL_ICON, Res.iconDelete24); |
68 |
iliev |
1285 |
} |
69 |
|
|
|
70 |
|
|
protected ClassicPrefs |
71 |
|
|
preferences() { |
72 |
|
|
return ClassicPrefs.preferences(); |
73 |
|
|
} |
74 |
|
|
|
75 |
iliev |
842 |
private static boolean |
76 |
|
|
verifyConnection() { |
77 |
|
|
if(!CC.getClient().isConnected()) { |
78 |
|
|
HF.showErrorMessage(i18n.getError("notConnected")); |
79 |
|
|
return false; |
80 |
|
|
} |
81 |
|
|
|
82 |
|
|
return true; |
83 |
|
|
} |
84 |
|
|
|
85 |
iliev |
787 |
public final static Action samplerInfo = new SamplerInfo(); |
86 |
|
|
|
87 |
|
|
private static class SamplerInfo extends AbstractAction { |
88 |
|
|
SamplerInfo() { |
89 |
|
|
super(i18n.getMenuLabel("actions.samplerInfo")); |
90 |
|
|
|
91 |
|
|
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttSamplerInfo")); |
92 |
iliev |
1143 |
putValue(Action.SMALL_ICON, Res.iconInfo32); |
93 |
iliev |
787 |
} |
94 |
|
|
|
95 |
|
|
public void |
96 |
|
|
actionPerformed(ActionEvent e) { |
97 |
|
|
new SamplerInfoDlg(CC.getMainFrame()).setVisible(true); |
98 |
|
|
} |
99 |
|
|
} |
100 |
|
|
|
101 |
iliev |
1143 |
public final static Action addMidiInstrumentMap = new AddMidiInstrumentMap(); |
102 |
|
|
|
103 |
|
|
private static class AddMidiInstrumentMap extends AbstractAction { |
104 |
|
|
AddMidiInstrumentMap() { |
105 |
|
|
super(i18n.getMenuLabel("actions.midiInstruments.addMap")); |
106 |
|
|
|
107 |
|
|
String s = i18n.getMenuLabel("actions.midiInstruments.addMap.tt"); |
108 |
|
|
putValue(SHORT_DESCRIPTION, s); |
109 |
|
|
putValue(Action.SMALL_ICON, Res.iconNew16); |
110 |
|
|
} |
111 |
|
|
|
112 |
|
|
public void |
113 |
iliev |
787 |
actionPerformed(ActionEvent e) { |
114 |
iliev |
1285 |
JSAddMidiInstrumentMapDlg dlg = new JSAddMidiInstrumentMapDlg(); |
115 |
iliev |
1143 |
dlg.setVisible(true); |
116 |
|
|
if(dlg.isCancelled()) return; |
117 |
|
|
|
118 |
|
|
CC.getSamplerModel().addBackendMidiInstrumentMap(dlg.getMapName()); |
119 |
|
|
LeftPane.getLeftPane().showMidiInstrumentMapsPage(); |
120 |
iliev |
787 |
} |
121 |
|
|
} |
122 |
|
|
|
123 |
iliev |
1143 |
public final static Action removeMidiInstrumentMap = new RemoveMidiInstrumentMap(); |
124 |
|
|
|
125 |
|
|
private static class RemoveMidiInstrumentMap extends AbstractAction { |
126 |
|
|
RemoveMidiInstrumentMap() { |
127 |
|
|
super(i18n.getMenuLabel("actions.midiInstruments.removeMap")); |
128 |
|
|
|
129 |
|
|
String s = i18n.getMenuLabel("actions.midiInstruments.removeMap.tt"); |
130 |
|
|
putValue(SHORT_DESCRIPTION, s); |
131 |
|
|
putValue(Action.SMALL_ICON, Res.iconDelete16); |
132 |
|
|
} |
133 |
|
|
|
134 |
|
|
public void |
135 |
|
|
actionPerformed(ActionEvent e) { |
136 |
|
|
RemoveMidiInstrumentMapDlg dlg = new RemoveMidiInstrumentMapDlg(); |
137 |
|
|
dlg.setVisible(true); |
138 |
|
|
if(dlg.isCancelled()) return; |
139 |
|
|
int id = dlg.getSelectedMap().getMapId(); |
140 |
|
|
CC.getSamplerModel().removeBackendMidiInstrumentMap(id); |
141 |
|
|
} |
142 |
|
|
} |
143 |
|
|
|
144 |
|
|
public final static Action addMidiInstrumentWizard = new AddMidiInstrumentWizard(); |
145 |
|
|
|
146 |
|
|
private static class AddMidiInstrumentWizard extends AbstractAction { |
147 |
|
|
AddMidiInstrumentWizard() { |
148 |
|
|
super(i18n.getMenuLabel("actions.midiInstruments.newMidiInstrumentWizard")); |
149 |
|
|
|
150 |
|
|
String s = "actions.midiInstruments.newMidiInstrumentWizard.tt"; |
151 |
|
|
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel(s)); |
152 |
|
|
putValue(Action.SMALL_ICON, Res.iconNew16); |
153 |
|
|
} |
154 |
|
|
|
155 |
|
|
public void |
156 |
|
|
actionPerformed(ActionEvent e) { |
157 |
iliev |
1285 |
ClassicPrefs prefs = ClassicPrefs.preferences(); |
158 |
|
|
JSNewMidiInstrumentWizard wizard = |
159 |
iliev |
1329 |
new JSNewMidiInstrumentWizard(Res.iconFolderOpen16); |
160 |
iliev |
1285 |
|
161 |
iliev |
2148 |
wizard.setMinimumSize(wizard.getPreferredSize()); |
162 |
|
|
javax.swing.JDialog wizardDlg = wizard.getWizardDialog(); |
163 |
|
|
wizardDlg.setMinimumSize(wizardDlg.getPreferredSize()); |
164 |
iliev |
1143 |
|
165 |
iliev |
1285 |
if(prefs.getBoolProperty("NewMidiInstrumentWizard.skip1")) { |
166 |
iliev |
1143 |
if(wizard.getModel().getCurrentPage() == null) { |
167 |
|
|
wizard.getModel().next(); |
168 |
|
|
} |
169 |
|
|
wizard.getModel().next(); |
170 |
|
|
} |
171 |
|
|
|
172 |
|
|
wizard.showWizard(); |
173 |
|
|
|
174 |
|
|
} |
175 |
|
|
} |
176 |
|
|
|
177 |
|
|
public final static Action loadScript = new LoadLscpScript(); |
178 |
|
|
|
179 |
|
|
private static class LoadLscpScript extends AbstractAction { |
180 |
|
|
LoadLscpScript() { |
181 |
|
|
super(i18n.getMenuLabel("actions.runScript")); |
182 |
|
|
|
183 |
|
|
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttRunScript")); |
184 |
|
|
putValue(Action.SMALL_ICON, Res.iconLoadScript32); |
185 |
|
|
} |
186 |
|
|
|
187 |
|
|
public void |
188 |
|
|
actionPerformed(ActionEvent e) { |
189 |
|
|
((MainFrame)CC.getMainFrame()).runScript(); |
190 |
|
|
} |
191 |
|
|
} |
192 |
|
|
|
193 |
iliev |
787 |
public final static Action addMidiDevice = new AddMidiDevice(); |
194 |
|
|
|
195 |
|
|
private static class AddMidiDevice extends AbstractAction { |
196 |
|
|
AddMidiDevice() { |
197 |
|
|
super(""); |
198 |
|
|
|
199 |
|
|
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttAddMidiDevice")); |
200 |
iliev |
911 |
putValue(Action.SMALL_ICON, Res.iconNew16); |
201 |
iliev |
787 |
} |
202 |
|
|
|
203 |
|
|
public void |
204 |
|
|
actionPerformed(ActionEvent e) { |
205 |
iliev |
842 |
if(!verifyConnection()) return; |
206 |
iliev |
1285 |
new JSNewMidiDeviceDlg(CC.getMainFrame()).setVisible(true); |
207 |
iliev |
787 |
} |
208 |
|
|
} |
209 |
|
|
|
210 |
|
|
public final static Action addAudioDevice = new AddAudioDevice(); |
211 |
|
|
|
212 |
|
|
private static class AddAudioDevice extends AbstractAction { |
213 |
|
|
AddAudioDevice() { |
214 |
|
|
super(""); |
215 |
|
|
|
216 |
|
|
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttAddAudioDevice")); |
217 |
iliev |
911 |
putValue(Action.SMALL_ICON, Res.iconNew16); |
218 |
iliev |
787 |
} |
219 |
|
|
|
220 |
|
|
public void |
221 |
|
|
actionPerformed(ActionEvent e) { |
222 |
iliev |
842 |
if(!verifyConnection()) return; |
223 |
iliev |
1285 |
new JSNewAudioDeviceDlg(CC.getMainFrame()).setVisible(true); |
224 |
iliev |
787 |
} |
225 |
|
|
} |
226 |
|
|
|
227 |
|
|
// EDIT |
228 |
|
|
public final static Action preferences = new Preferences(); |
229 |
|
|
|
230 |
|
|
private static class Preferences extends AbstractAction { |
231 |
|
|
Preferences() { |
232 |
|
|
super(i18n.getMenuLabel("edit.preferences")); |
233 |
|
|
|
234 |
|
|
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttPrefs")); |
235 |
iliev |
1143 |
putValue(Action.SMALL_ICON, Res.iconPreferences32); |
236 |
iliev |
787 |
} |
237 |
|
|
|
238 |
|
|
public void |
239 |
|
|
actionPerformed(ActionEvent e) { new PrefsDlg(CC.getMainFrame()).setVisible(true); } |
240 |
|
|
} |
241 |
iliev |
911 |
|
242 |
|
|
// VIEW |
243 |
|
|
|
244 |
|
|
|
245 |
iliev |
787 |
|
246 |
|
|
// CHANNELS |
247 |
|
|
public final static Action newChannel = new NewChannel(); |
248 |
|
|
public final static Action newChannelWizard = new NewChannelWizard(); |
249 |
|
|
|
250 |
|
|
|
251 |
|
|
private static class NewChannel extends AbstractAction { |
252 |
|
|
NewChannel() { |
253 |
|
|
super(i18n.getMenuLabel("channels.new")); |
254 |
|
|
|
255 |
|
|
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttNewChannel")); |
256 |
iliev |
911 |
putValue(Action.SMALL_ICON, Res.iconNew24); |
257 |
iliev |
787 |
} |
258 |
|
|
|
259 |
|
|
public void |
260 |
iliev |
842 |
actionPerformed(ActionEvent e) { |
261 |
|
|
if(!verifyConnection()) return; |
262 |
iliev |
1143 |
CC.getSamplerModel().addBackendChannel(); |
263 |
iliev |
842 |
} |
264 |
iliev |
787 |
} |
265 |
|
|
|
266 |
|
|
private static class NewChannelWizard extends AbstractAction { |
267 |
|
|
NewChannelWizard() { |
268 |
|
|
super(i18n.getMenuLabel("channels.wizard")); |
269 |
|
|
|
270 |
|
|
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttNewChannelWizard")); |
271 |
|
|
} |
272 |
|
|
|
273 |
|
|
public void |
274 |
|
|
actionPerformed(ActionEvent e) { |
275 |
iliev |
842 |
new org.jsampler.view.classic.NewChannelWizard().showWizard(); |
276 |
iliev |
787 |
} |
277 |
|
|
} |
278 |
|
|
|
279 |
|
|
public static class |
280 |
|
|
MoveChannelsTo extends AbstractAction implements PropertyChangeListener { |
281 |
|
|
private final JSChannelsPane pane; |
282 |
|
|
|
283 |
|
|
MoveChannelsTo(JSChannelsPane pane) { |
284 |
|
|
super(pane.getTitle()); |
285 |
|
|
|
286 |
|
|
this.pane = pane; |
287 |
|
|
|
288 |
|
|
String desc = i18n.getMenuLabel("ttMoveChannelsTo", pane.getTitle()); |
289 |
|
|
putValue(SHORT_DESCRIPTION, desc); |
290 |
|
|
pane.addPropertyChangeListener(JSChannelsPane.TITLE, this); |
291 |
|
|
} |
292 |
|
|
|
293 |
|
|
public void |
294 |
|
|
actionPerformed(ActionEvent e) { |
295 |
|
|
JSChannelsPane acp = CC.getMainFrame().getSelectedChannelsPane(); |
296 |
|
|
JSChannel[] chns = acp.getSelectedChannels(); |
297 |
|
|
|
298 |
|
|
for(JSChannel c : chns) acp.removeChannel(c); |
299 |
|
|
|
300 |
|
|
pane.addChannels(chns); |
301 |
|
|
|
302 |
|
|
CC.getMainFrame().setSelectedChannelsPane(pane); |
303 |
|
|
|
304 |
|
|
} |
305 |
|
|
|
306 |
|
|
public void |
307 |
|
|
propertyChange(PropertyChangeEvent e) { |
308 |
|
|
putValue(NAME, pane.getTitle()); |
309 |
|
|
|
310 |
|
|
String desc = i18n.getMenuLabel("ttMoveChannelsTo", pane.getTitle()); |
311 |
|
|
putValue(SHORT_DESCRIPTION, desc); |
312 |
|
|
} |
313 |
|
|
|
314 |
|
|
public JSChannelsPane |
315 |
|
|
getChannelsPane() { return pane; } |
316 |
|
|
} |
317 |
|
|
|
318 |
|
|
// TABS |
319 |
|
|
public final static Action newChannelsTab = new NewChannelsTab(); |
320 |
|
|
|
321 |
|
|
public final static Action editTabTitle = new EditTabTitle(); |
322 |
|
|
|
323 |
|
|
public final static Action moveTab2Beginning = new MoveTab2Beginning(); |
324 |
|
|
public final static Action moveTab2Left = new MoveTab2Left(); |
325 |
|
|
public final static Action moveTab2Right = new MoveTab2Right(); |
326 |
|
|
public final static Action moveTab2End = new MoveTab2End(); |
327 |
|
|
|
328 |
|
|
public final static Action closeChannelsTab = new CloseChannelsTab(); |
329 |
|
|
|
330 |
|
|
|
331 |
|
|
private static class NewChannelsTab extends AbstractAction { |
332 |
|
|
NewChannelsTab() { |
333 |
|
|
super(i18n.getMenuLabel("tabs.new")); |
334 |
|
|
|
335 |
|
|
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttNewTab")); |
336 |
iliev |
1143 |
putValue(Action.SMALL_ICON, Res.iconTabNew22); |
337 |
iliev |
787 |
} |
338 |
|
|
|
339 |
|
|
public void |
340 |
|
|
actionPerformed(ActionEvent e) { |
341 |
|
|
new NewChannelsTabDlg(CC.getMainFrame()).setVisible(true); |
342 |
|
|
} |
343 |
|
|
} |
344 |
|
|
|
345 |
|
|
private static class EditTabTitle extends AbstractAction { |
346 |
|
|
EditTabTitle() { |
347 |
|
|
super(i18n.getMenuLabel("tabs.changeTitle")); |
348 |
|
|
|
349 |
|
|
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttEditTabTitle")); |
350 |
|
|
setEnabled(false); |
351 |
|
|
} |
352 |
|
|
|
353 |
|
|
public void |
354 |
|
|
actionPerformed(ActionEvent e) { |
355 |
|
|
new ChangeTabTitleDlg(CC.getMainFrame()).setVisible(true); |
356 |
|
|
} |
357 |
|
|
} |
358 |
|
|
|
359 |
|
|
private static class MoveTab2Beginning extends AbstractAction { |
360 |
|
|
MoveTab2Beginning() { |
361 |
|
|
super(i18n.getMenuLabel("tabs.move2Beginning")); |
362 |
|
|
|
363 |
|
|
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttMoveTab2Beginning")); |
364 |
|
|
setEnabled(false); |
365 |
|
|
} |
366 |
|
|
|
367 |
|
|
public void |
368 |
|
|
actionPerformed(ActionEvent e) { |
369 |
|
|
((MainFrame)CC.getMainFrame()).moveTab2Beginning(); |
370 |
|
|
} |
371 |
|
|
} |
372 |
|
|
|
373 |
|
|
private static class MoveTab2Left extends AbstractAction { |
374 |
|
|
MoveTab2Left() { |
375 |
|
|
super(i18n.getMenuLabel("tabs.move2Left")); |
376 |
|
|
|
377 |
|
|
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttMoveTab2Left")); |
378 |
iliev |
1143 |
putValue(Action.SMALL_ICON, Res.iconTabMoveLeft22); |
379 |
iliev |
787 |
setEnabled(false); |
380 |
|
|
} |
381 |
|
|
|
382 |
|
|
public void |
383 |
|
|
actionPerformed(ActionEvent e) { ((MainFrame)CC.getMainFrame()).moveTab2Left(); } |
384 |
|
|
} |
385 |
|
|
|
386 |
|
|
private static class MoveTab2Right extends AbstractAction { |
387 |
|
|
MoveTab2Right() { |
388 |
|
|
super(i18n.getMenuLabel("tabs.move2Right")); |
389 |
|
|
|
390 |
|
|
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttMoveTab2Right")); |
391 |
iliev |
1143 |
putValue(Action.SMALL_ICON, Res.iconTabMoveRight22); |
392 |
iliev |
787 |
setEnabled(false); |
393 |
|
|
} |
394 |
|
|
|
395 |
|
|
public void |
396 |
|
|
actionPerformed(ActionEvent e) { ((MainFrame)CC.getMainFrame()).moveTab2Right(); } |
397 |
|
|
} |
398 |
|
|
|
399 |
|
|
private static class MoveTab2End extends AbstractAction { |
400 |
|
|
MoveTab2End() { |
401 |
|
|
super(i18n.getMenuLabel("tabs.move2End")); |
402 |
|
|
|
403 |
|
|
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttMoveTab2End")); |
404 |
|
|
setEnabled(false); |
405 |
|
|
} |
406 |
|
|
|
407 |
|
|
public void |
408 |
|
|
actionPerformed(ActionEvent e) { ((MainFrame)CC.getMainFrame()).moveTab2End(); } |
409 |
|
|
} |
410 |
|
|
|
411 |
|
|
private static class CloseChannelsTab extends AbstractAction { |
412 |
|
|
CloseChannelsTab() { |
413 |
|
|
super(i18n.getMenuLabel("tabs.close")); |
414 |
|
|
|
415 |
|
|
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttCloseTab")); |
416 |
iliev |
1143 |
putValue(Action.SMALL_ICON, Res.iconTabRemove22); |
417 |
iliev |
787 |
setEnabled(false); |
418 |
|
|
} |
419 |
|
|
|
420 |
|
|
public void |
421 |
|
|
actionPerformed(ActionEvent e) { |
422 |
|
|
JSMainFrame frm = CC.getMainFrame(); |
423 |
|
|
JSChannelsPane chnPane = frm.getSelectedChannelsPane(); |
424 |
|
|
if(chnPane.getChannelCount() > 0) { |
425 |
|
|
CloseTabDlg dlg = new CloseTabDlg(frm); |
426 |
|
|
dlg.setVisible(true); |
427 |
|
|
if(dlg.isCancelled()) return; |
428 |
|
|
|
429 |
|
|
JSChannel[] chns = chnPane.getChannels(); |
430 |
|
|
|
431 |
|
|
if(dlg.remove()) { |
432 |
|
|
|
433 |
|
|
|
434 |
|
|
} else { |
435 |
|
|
JSChannelsPane p = dlg.getSelectedChannelsPane(); |
436 |
|
|
for(JSChannel c : chns) { |
437 |
|
|
chnPane.removeChannel(c); |
438 |
|
|
} |
439 |
|
|
p.addChannels(chns); |
440 |
|
|
frm.setSelectedChannelsPane(p); |
441 |
|
|
} |
442 |
|
|
} |
443 |
|
|
|
444 |
|
|
frm.removeChannelsPane(chnPane); |
445 |
|
|
} |
446 |
|
|
} |
447 |
iliev |
1204 |
|
448 |
|
|
// WINDOW |
449 |
|
|
public final static WindowInstrumentsDb windowInstrumentsDb = new WindowInstrumentsDb(); |
450 |
|
|
|
451 |
|
|
private static class WindowInstrumentsDb extends AbstractAction { |
452 |
|
|
InstrumentsDbFrame instrumentsDbFrame = null; |
453 |
|
|
|
454 |
|
|
WindowInstrumentsDb() { |
455 |
|
|
super(i18n.getMenuLabel("window.instrumentsDb")); |
456 |
|
|
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("window.instrumentsDb.tt")); |
457 |
|
|
putValue(Action.SMALL_ICON, Res.iconDb32); |
458 |
|
|
} |
459 |
|
|
|
460 |
|
|
public void |
461 |
|
|
actionPerformed(ActionEvent e) { |
462 |
iliev |
1688 |
if(!CC.verifyConnection()) return; |
463 |
|
|
|
464 |
iliev |
1204 |
if(CC.getInstrumentsDbTreeModel() == null) { |
465 |
|
|
String s = i18n.getMessage("A4n.noInstrumentsDbSupport!"); |
466 |
|
|
HF.showErrorMessage(s, CC.getMainFrame()); |
467 |
|
|
return; |
468 |
|
|
} |
469 |
|
|
|
470 |
|
|
if(instrumentsDbFrame != null && instrumentsDbFrame.isVisible()) { |
471 |
iliev |
1285 |
instrumentsDbFrame.setVisible(false); |
472 |
|
|
instrumentsDbFrame.setVisible(true); |
473 |
iliev |
1204 |
return; |
474 |
|
|
} |
475 |
|
|
|
476 |
|
|
instrumentsDbFrame = new InstrumentsDbFrame(); |
477 |
|
|
instrumentsDbFrame.setVisible(true); |
478 |
|
|
} |
479 |
|
|
} |
480 |
|
|
|
481 |
iliev |
787 |
// HELP |
482 |
|
|
public final static HelpAbout helpAbout = new HelpAbout(); |
483 |
|
|
|
484 |
|
|
private static class HelpAbout extends AbstractAction { |
485 |
|
|
HelpAbout() { |
486 |
|
|
super(i18n.getMenuLabel("help.about", "JS Classic")); |
487 |
|
|
} |
488 |
|
|
|
489 |
|
|
public void |
490 |
|
|
actionPerformed(ActionEvent e) { |
491 |
|
|
new HelpAboutDlg(CC.getMainFrame()).setVisible(true); |
492 |
|
|
} |
493 |
|
|
} |
494 |
|
|
} |