1 |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
4 |
* Copyright (C) 2005 Grigor Kirilov Iliev |
5 |
* |
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.MediaTracker; |
26 |
|
27 |
import java.awt.event.ActionEvent; |
28 |
|
29 |
import java.beans.PropertyChangeEvent; |
30 |
import java.beans.PropertyChangeListener; |
31 |
|
32 |
import java.net.URL; |
33 |
|
34 |
import java.util.logging.Level; |
35 |
|
36 |
import javax.swing.AbstractAction; |
37 |
import javax.swing.Action; |
38 |
import javax.swing.ImageIcon; |
39 |
|
40 |
import org.jsampler.CC; |
41 |
import org.jsampler.HF; |
42 |
import org.jsampler.JSampler; |
43 |
|
44 |
import org.jsampler.view.JSChannel; |
45 |
import org.jsampler.view.JSChannelsPane; |
46 |
import org.jsampler.view.JSMainFrame; |
47 |
|
48 |
import net.sf.juife.event.TaskEvent; |
49 |
import net.sf.juife.event.TaskListener; |
50 |
|
51 |
import static org.jsampler.view.classic.ClassicI18n.i18n; |
52 |
|
53 |
|
54 |
/** |
55 |
* This class provides an <code>Action</code> instances performing all needed tasks. |
56 |
* @author Grigor Iliev |
57 |
*/ |
58 |
public class A4n { |
59 |
private static boolean |
60 |
verifyConnection() { |
61 |
if(!CC.getClient().isConnected()) { |
62 |
HF.showErrorMessage(i18n.getError("notConnected")); |
63 |
return false; |
64 |
} |
65 |
|
66 |
return true; |
67 |
} |
68 |
|
69 |
public final static Action connect = new Connect(); |
70 |
|
71 |
private static class Connect extends AbstractAction { |
72 |
Connect() { |
73 |
super(i18n.getMenuLabel("actions.connect")); |
74 |
|
75 |
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttConnect")); |
76 |
} |
77 |
|
78 |
public void |
79 |
actionPerformed(ActionEvent e) { CC.reconnect(); } |
80 |
} |
81 |
|
82 |
public final static Action samplerInfo = new SamplerInfo(); |
83 |
|
84 |
private static class SamplerInfo extends AbstractAction { |
85 |
SamplerInfo() { |
86 |
super(i18n.getMenuLabel("actions.samplerInfo")); |
87 |
|
88 |
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttSamplerInfo")); |
89 |
|
90 |
try { |
91 |
URL url = ClassLoader.getSystemClassLoader().getResource ( |
92 |
"org/jsampler/view/classic/res/icons/toolbar/About24.gif" |
93 |
); |
94 |
|
95 |
ImageIcon icon = new ImageIcon(url); |
96 |
if(icon.getImageLoadStatus() == MediaTracker.COMPLETE) |
97 |
putValue(Action.SMALL_ICON, icon); |
98 |
} catch(Exception x) { |
99 |
CC.getLogger().log(Level.INFO, HF.getErrorMessage(x), x); |
100 |
} |
101 |
} |
102 |
|
103 |
public void |
104 |
actionPerformed(ActionEvent e) { |
105 |
new SamplerInfoDlg(CC.getMainFrame()).setVisible(true); |
106 |
} |
107 |
} |
108 |
|
109 |
public final static Action refresh = new Refresh(); |
110 |
|
111 |
private static class Refresh extends AbstractAction { |
112 |
Refresh() { |
113 |
super(i18n.getMenuLabel("actions.refresh")); |
114 |
|
115 |
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttRefresh")); |
116 |
|
117 |
try { |
118 |
URL url = ClassLoader.getSystemClassLoader().getResource ( |
119 |
"org/jsampler/view/classic/res/icons/toolbar/Refresh24.gif" |
120 |
); |
121 |
|
122 |
ImageIcon icon = new ImageIcon(url); |
123 |
if(icon.getImageLoadStatus() == MediaTracker.COMPLETE) |
124 |
putValue(Action.SMALL_ICON, icon); |
125 |
} catch(Exception x) { |
126 |
CC.getLogger().log(Level.INFO, HF.getErrorMessage(x), x); |
127 |
} |
128 |
} |
129 |
|
130 |
public void |
131 |
actionPerformed(ActionEvent e) { CC.initSamplerModel(); } |
132 |
} |
133 |
|
134 |
public final static Action resetSampler = new Reset(); |
135 |
|
136 |
private static class Reset extends AbstractAction { |
137 |
Reset() { |
138 |
super(i18n.getMenuLabel("actions.resetSampler")); |
139 |
|
140 |
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttResetSampler")); |
141 |
} |
142 |
|
143 |
public void |
144 |
actionPerformed(ActionEvent e) { |
145 |
CC.getTaskQueue().add(new org.jsampler.task.ResetSampler()); |
146 |
} |
147 |
} |
148 |
|
149 |
public final static Action addMidiDevice = new AddMidiDevice(); |
150 |
|
151 |
private static class AddMidiDevice extends AbstractAction { |
152 |
AddMidiDevice() { |
153 |
super(""); |
154 |
|
155 |
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttAddMidiDevice")); |
156 |
putValue(Action.SMALL_ICON, Res.iconNew16); |
157 |
} |
158 |
|
159 |
public void |
160 |
actionPerformed(ActionEvent e) { |
161 |
if(!verifyConnection()) return; |
162 |
new NewMidiDeviceDlg(CC.getMainFrame()).setVisible(true); |
163 |
} |
164 |
} |
165 |
|
166 |
public final static Action addAudioDevice = new AddAudioDevice(); |
167 |
|
168 |
private static class AddAudioDevice extends AbstractAction { |
169 |
AddAudioDevice() { |
170 |
super(""); |
171 |
|
172 |
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttAddAudioDevice")); |
173 |
putValue(Action.SMALL_ICON, Res.iconNew16); |
174 |
} |
175 |
|
176 |
public void |
177 |
actionPerformed(ActionEvent e) { |
178 |
if(!verifyConnection()) return; |
179 |
new NewAudioDeviceDlg(CC.getMainFrame()).setVisible(true); |
180 |
} |
181 |
} |
182 |
|
183 |
// EDIT |
184 |
public final static Action preferences = new Preferences(); |
185 |
|
186 |
private static class Preferences extends AbstractAction { |
187 |
Preferences() { |
188 |
super(i18n.getMenuLabel("edit.preferences")); |
189 |
|
190 |
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttPrefs")); |
191 |
putValue(Action.SMALL_ICON, Res.iconPreferences24); |
192 |
} |
193 |
|
194 |
public void |
195 |
actionPerformed(ActionEvent e) { new PrefsDlg(CC.getMainFrame()).setVisible(true); } |
196 |
} |
197 |
|
198 |
// VIEW |
199 |
|
200 |
|
201 |
|
202 |
// CHANNELS |
203 |
public final static Action newChannel = new NewChannel(); |
204 |
public final static Action newChannelWizard = new NewChannelWizard(); |
205 |
public final static Action duplicateChannels = new DuplicateChannels(); |
206 |
|
207 |
public final static Action moveChannelsOnTop = new MoveChannelsOnTop(); |
208 |
public final static Action moveChannelsUp = new MoveChannelsUp(); |
209 |
public final static Action moveChannelsDown = new MoveChannelsDown(); |
210 |
public final static Action moveChannelsAtBottom = new MoveChannelsAtBottom(); |
211 |
|
212 |
public final static Action selectAllChannels = new SelectAllChannels(); |
213 |
public final static Action deselectChannels = new DeselectChannels(); |
214 |
|
215 |
public final static Action removeChannels = new RemoveChannels(); |
216 |
|
217 |
|
218 |
private static class NewChannel extends AbstractAction { |
219 |
NewChannel() { |
220 |
super(i18n.getMenuLabel("channels.new")); |
221 |
|
222 |
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttNewChannel")); |
223 |
putValue(Action.SMALL_ICON, Res.iconNew24); |
224 |
} |
225 |
|
226 |
public void |
227 |
actionPerformed(ActionEvent e) { |
228 |
if(!verifyConnection()) return; |
229 |
CC.getSamplerModel().createChannel(); |
230 |
} |
231 |
} |
232 |
|
233 |
private static class NewChannelWizard extends AbstractAction { |
234 |
NewChannelWizard() { |
235 |
super(i18n.getMenuLabel("channels.wizard")); |
236 |
|
237 |
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttNewChannelWizard")); |
238 |
} |
239 |
|
240 |
public void |
241 |
actionPerformed(ActionEvent e) { |
242 |
new org.jsampler.view.classic.NewChannelWizard().showWizard(); |
243 |
} |
244 |
} |
245 |
|
246 |
private static class DuplicateChannels extends AbstractAction { |
247 |
DuplicateChannels() { |
248 |
super(i18n.getMenuLabel("channels.duplicate")); |
249 |
|
250 |
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttDuplicateChannels")); |
251 |
putValue(Action.SMALL_ICON, Res.iconCopy24); |
252 |
|
253 |
setEnabled(false); |
254 |
} |
255 |
|
256 |
public void |
257 |
actionPerformed(ActionEvent e) { |
258 |
JSChannel[] channels = |
259 |
CC.getMainFrame().getSelectedChannelsPane().getSelectedChannels(); |
260 |
|
261 |
if(channels.length > 2) { |
262 |
if(!HF.showYesNoDialog ( |
263 |
CC.getMainFrame(), |
264 |
i18n.getMessage("A4n.duplicateChannels?") |
265 |
)) return; |
266 |
} |
267 |
|
268 |
CC.getTaskQueue().add ( |
269 |
new org.jsampler.task.DuplicateChannels(channels) |
270 |
); |
271 |
} |
272 |
} |
273 |
|
274 |
private static class MoveChannelsOnTop extends AbstractAction { |
275 |
MoveChannelsOnTop() { |
276 |
super(i18n.getMenuLabel("channels.MoveOnTop")); |
277 |
|
278 |
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttMoveChannelsOnTop")); |
279 |
setEnabled(false); |
280 |
} |
281 |
|
282 |
public void |
283 |
actionPerformed(ActionEvent e) { |
284 |
ChannelsPane p = (ChannelsPane)CC.getMainFrame().getSelectedChannelsPane(); |
285 |
p.moveSelectedChannelsOnTop(); |
286 |
} |
287 |
} |
288 |
|
289 |
private static class MoveChannelsUp extends AbstractAction { |
290 |
MoveChannelsUp() { |
291 |
super(i18n.getMenuLabel("channels.MoveUp")); |
292 |
|
293 |
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttMoveChannelsUp")); |
294 |
|
295 |
try { |
296 |
URL url = ClassLoader.getSystemClassLoader().getResource ( |
297 |
"org/jsampler/view/classic/res/icons/toolbar/Up24.gif" |
298 |
); |
299 |
|
300 |
ImageIcon icon = new ImageIcon(url); |
301 |
if(icon.getImageLoadStatus() == MediaTracker.COMPLETE) |
302 |
putValue(Action.SMALL_ICON, icon); |
303 |
} catch(Exception x) { |
304 |
CC.getLogger().log(Level.INFO, HF.getErrorMessage(x), x); |
305 |
} |
306 |
|
307 |
setEnabled(false); |
308 |
} |
309 |
|
310 |
public void |
311 |
actionPerformed(ActionEvent e) { |
312 |
ChannelsPane p = (ChannelsPane)CC.getMainFrame().getSelectedChannelsPane(); |
313 |
p.moveSelectedChannelsUp(); |
314 |
} |
315 |
} |
316 |
|
317 |
private static class MoveChannelsDown extends AbstractAction { |
318 |
MoveChannelsDown() { |
319 |
super(i18n.getMenuLabel("channels.MoveDown")); |
320 |
|
321 |
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttMoveChannelsDown")); |
322 |
|
323 |
try { |
324 |
URL url = ClassLoader.getSystemClassLoader().getResource ( |
325 |
"org/jsampler/view/classic/res/icons/toolbar/Down24.gif" |
326 |
); |
327 |
|
328 |
ImageIcon icon = new ImageIcon(url); |
329 |
if(icon.getImageLoadStatus() == MediaTracker.COMPLETE) |
330 |
putValue(Action.SMALL_ICON, icon); |
331 |
} catch(Exception x) { |
332 |
CC.getLogger().log(Level.INFO, HF.getErrorMessage(x), x); |
333 |
} |
334 |
|
335 |
setEnabled(false); |
336 |
} |
337 |
|
338 |
public void |
339 |
actionPerformed(ActionEvent e) { |
340 |
ChannelsPane p = (ChannelsPane)CC.getMainFrame().getSelectedChannelsPane(); |
341 |
p.moveSelectedChannelsDown(); |
342 |
} |
343 |
} |
344 |
|
345 |
private static class MoveChannelsAtBottom extends AbstractAction { |
346 |
MoveChannelsAtBottom() { |
347 |
super(i18n.getMenuLabel("channels.MoveAtBottom")); |
348 |
|
349 |
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttMoveChannelsAtBottom")); |
350 |
setEnabled(false); |
351 |
} |
352 |
|
353 |
public void |
354 |
actionPerformed(ActionEvent e) { |
355 |
ChannelsPane p = (ChannelsPane)CC.getMainFrame().getSelectedChannelsPane(); |
356 |
p.moveSelectedChannelsAtBottom(); |
357 |
} |
358 |
} |
359 |
|
360 |
public static class |
361 |
MoveChannelsTo extends AbstractAction implements PropertyChangeListener { |
362 |
private final JSChannelsPane pane; |
363 |
|
364 |
MoveChannelsTo(JSChannelsPane pane) { |
365 |
super(pane.getTitle()); |
366 |
|
367 |
this.pane = pane; |
368 |
|
369 |
String desc = i18n.getMenuLabel("ttMoveChannelsTo", pane.getTitle()); |
370 |
putValue(SHORT_DESCRIPTION, desc); |
371 |
pane.addPropertyChangeListener(JSChannelsPane.TITLE, this); |
372 |
} |
373 |
|
374 |
public void |
375 |
actionPerformed(ActionEvent e) { |
376 |
JSChannelsPane acp = CC.getMainFrame().getSelectedChannelsPane(); |
377 |
JSChannel[] chns = acp.getSelectedChannels(); |
378 |
|
379 |
for(JSChannel c : chns) acp.removeChannel(c); |
380 |
|
381 |
pane.addChannels(chns); |
382 |
|
383 |
CC.getMainFrame().setSelectedChannelsPane(pane); |
384 |
|
385 |
} |
386 |
|
387 |
public void |
388 |
propertyChange(PropertyChangeEvent e) { |
389 |
putValue(NAME, pane.getTitle()); |
390 |
|
391 |
String desc = i18n.getMenuLabel("ttMoveChannelsTo", pane.getTitle()); |
392 |
putValue(SHORT_DESCRIPTION, desc); |
393 |
} |
394 |
|
395 |
public JSChannelsPane |
396 |
getChannelsPane() { return pane; } |
397 |
} |
398 |
|
399 |
private static class SelectAllChannels extends AbstractAction { |
400 |
SelectAllChannels() { |
401 |
super(i18n.getMenuLabel("channels.selectAll")); |
402 |
|
403 |
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttSelectAllChannels")); |
404 |
} |
405 |
|
406 |
public void |
407 |
actionPerformed(ActionEvent e) { |
408 |
ChannelsPane p = (ChannelsPane)CC.getMainFrame().getSelectedChannelsPane(); |
409 |
p.selectAllChannels(); |
410 |
} |
411 |
} |
412 |
|
413 |
private static class DeselectChannels extends AbstractAction { |
414 |
DeselectChannels() { |
415 |
super(i18n.getMenuLabel("channels.selectNone")); |
416 |
|
417 |
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttDeselectChannels")); |
418 |
} |
419 |
|
420 |
public void |
421 |
actionPerformed(ActionEvent e) { |
422 |
ChannelsPane p = (ChannelsPane)CC.getMainFrame().getSelectedChannelsPane(); |
423 |
p.deselectChannels(); |
424 |
} |
425 |
} |
426 |
|
427 |
private static class RemoveChannels extends AbstractAction { |
428 |
RemoveChannels() { |
429 |
super(i18n.getMenuLabel("channels.RemoveChannel")); |
430 |
|
431 |
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttRemoveChannels")); |
432 |
|
433 |
try { |
434 |
URL url = ClassLoader.getSystemClassLoader().getResource ( |
435 |
"org/jsampler/view/classic/res/icons/toolbar/Delete24.gif" |
436 |
); |
437 |
|
438 |
ImageIcon icon = new ImageIcon(url); |
439 |
if(icon.getImageLoadStatus() == MediaTracker.COMPLETE) |
440 |
putValue(Action.SMALL_ICON, icon); |
441 |
} catch(Exception x) { |
442 |
CC.getLogger().log(Level.INFO, HF.getErrorMessage(x), x); |
443 |
} |
444 |
|
445 |
setEnabled(false); |
446 |
} |
447 |
|
448 |
public void |
449 |
actionPerformed(ActionEvent e) { |
450 |
JSChannelsPane p = CC.getMainFrame().getSelectedChannelsPane(); |
451 |
if(p.getSelectedChannelCount() > 1) |
452 |
if(!HF.showYesNoDialog ( |
453 |
CC.getMainFrame(), i18n.getMessage("A4n.removeChannels?") |
454 |
)) return; |
455 |
|
456 |
JSChannel[] chnS = p.getSelectedChannels(); |
457 |
|
458 |
for(JSChannel c : chnS) removeChannel(c); |
459 |
} |
460 |
|
461 |
private void |
462 |
removeChannel(final JSChannel c) { |
463 |
final JSChannelsPane p = CC.getMainFrame().getSelectedChannelsPane(); |
464 |
int id = c.getChannelInfo().getChannelID(); |
465 |
|
466 |
CC.getTaskQueue().add(new org.jsampler.task.RemoveChannel(id)); |
467 |
} |
468 |
} |
469 |
|
470 |
// TABS |
471 |
public final static Action newChannelsTab = new NewChannelsTab(); |
472 |
|
473 |
public final static Action editTabTitle = new EditTabTitle(); |
474 |
|
475 |
public final static Action moveTab2Beginning = new MoveTab2Beginning(); |
476 |
public final static Action moveTab2Left = new MoveTab2Left(); |
477 |
public final static Action moveTab2Right = new MoveTab2Right(); |
478 |
public final static Action moveTab2End = new MoveTab2End(); |
479 |
|
480 |
public final static Action closeChannelsTab = new CloseChannelsTab(); |
481 |
|
482 |
|
483 |
private static class NewChannelsTab extends AbstractAction { |
484 |
NewChannelsTab() { |
485 |
super(i18n.getMenuLabel("tabs.new")); |
486 |
|
487 |
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttNewTab")); |
488 |
|
489 |
/*try { |
490 |
URL u = new URL(PATH + "general/Preferences24.gif"); |
491 |
ImageIcon ii = new ImageIcon(u); |
492 |
if(ii.getImageLoadStatus() == MediaTracker.COMPLETE) |
493 |
putValue(Action.SMALL_ICON, ii); |
494 |
} catch(Exception x) { |
495 |
CC.getLogger().log(Level.INFO, HF.getErrorMessage(x), x); |
496 |
}*/ |
497 |
} |
498 |
|
499 |
public void |
500 |
actionPerformed(ActionEvent e) { |
501 |
new NewChannelsTabDlg(CC.getMainFrame()).setVisible(true); |
502 |
} |
503 |
} |
504 |
|
505 |
private static class EditTabTitle extends AbstractAction { |
506 |
EditTabTitle() { |
507 |
super(i18n.getMenuLabel("tabs.changeTitle")); |
508 |
|
509 |
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttEditTabTitle")); |
510 |
setEnabled(false); |
511 |
} |
512 |
|
513 |
public void |
514 |
actionPerformed(ActionEvent e) { |
515 |
new ChangeTabTitleDlg(CC.getMainFrame()).setVisible(true); |
516 |
} |
517 |
} |
518 |
|
519 |
private static class MoveTab2Beginning extends AbstractAction { |
520 |
MoveTab2Beginning() { |
521 |
super(i18n.getMenuLabel("tabs.move2Beginning")); |
522 |
|
523 |
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttMoveTab2Beginning")); |
524 |
setEnabled(false); |
525 |
} |
526 |
|
527 |
public void |
528 |
actionPerformed(ActionEvent e) { |
529 |
((MainFrame)CC.getMainFrame()).moveTab2Beginning(); |
530 |
} |
531 |
} |
532 |
|
533 |
private static class MoveTab2Left extends AbstractAction { |
534 |
MoveTab2Left() { |
535 |
super(i18n.getMenuLabel("tabs.move2Left")); |
536 |
|
537 |
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttMoveTab2Left")); |
538 |
setEnabled(false); |
539 |
} |
540 |
|
541 |
public void |
542 |
actionPerformed(ActionEvent e) { ((MainFrame)CC.getMainFrame()).moveTab2Left(); } |
543 |
} |
544 |
|
545 |
private static class MoveTab2Right extends AbstractAction { |
546 |
MoveTab2Right() { |
547 |
super(i18n.getMenuLabel("tabs.move2Right")); |
548 |
|
549 |
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttMoveTab2Right")); |
550 |
setEnabled(false); |
551 |
} |
552 |
|
553 |
public void |
554 |
actionPerformed(ActionEvent e) { ((MainFrame)CC.getMainFrame()).moveTab2Right(); } |
555 |
} |
556 |
|
557 |
private static class MoveTab2End extends AbstractAction { |
558 |
MoveTab2End() { |
559 |
super(i18n.getMenuLabel("tabs.move2End")); |
560 |
|
561 |
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttMoveTab2End")); |
562 |
setEnabled(false); |
563 |
} |
564 |
|
565 |
public void |
566 |
actionPerformed(ActionEvent e) { ((MainFrame)CC.getMainFrame()).moveTab2End(); } |
567 |
} |
568 |
|
569 |
private static class CloseChannelsTab extends AbstractAction { |
570 |
CloseChannelsTab() { |
571 |
super(i18n.getMenuLabel("tabs.close")); |
572 |
|
573 |
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttCloseTab")); |
574 |
|
575 |
setEnabled(false); |
576 |
} |
577 |
|
578 |
public void |
579 |
actionPerformed(ActionEvent e) { |
580 |
JSMainFrame frm = CC.getMainFrame(); |
581 |
JSChannelsPane chnPane = frm.getSelectedChannelsPane(); |
582 |
if(chnPane.getChannelCount() > 0) { |
583 |
CloseTabDlg dlg = new CloseTabDlg(frm); |
584 |
dlg.setVisible(true); |
585 |
if(dlg.isCancelled()) return; |
586 |
|
587 |
JSChannel[] chns = chnPane.getChannels(); |
588 |
|
589 |
if(dlg.remove()) { |
590 |
|
591 |
|
592 |
} else { |
593 |
JSChannelsPane p = dlg.getSelectedChannelsPane(); |
594 |
for(JSChannel c : chns) { |
595 |
chnPane.removeChannel(c); |
596 |
} |
597 |
p.addChannels(chns); |
598 |
frm.setSelectedChannelsPane(p); |
599 |
} |
600 |
} |
601 |
|
602 |
frm.removeChannelsPane(chnPane); |
603 |
} |
604 |
} |
605 |
|
606 |
// HELP |
607 |
public final static HelpAbout helpAbout = new HelpAbout(); |
608 |
|
609 |
private static class HelpAbout extends AbstractAction { |
610 |
HelpAbout() { |
611 |
super(i18n.getMenuLabel("help.about", "JS Classic")); |
612 |
} |
613 |
|
614 |
public void |
615 |
actionPerformed(ActionEvent e) { |
616 |
new HelpAboutDlg(CC.getMainFrame()).setVisible(true); |
617 |
} |
618 |
} |
619 |
} |