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