blob: d8bfb19e22bcea358c0ea68add96b7712e2d1cff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/*
D-Bus Java Viewer
Copyright (c) 2006 Peter Cox
This program is free software; you can redistribute it and/or modify it
under the terms of either the GNU Lesser General Public License Version 2 or the
Academic Free Licence Version 2.1.
Full licence texts are included in the COPYING file with this program.
*/
package org.freedesktop.dbus.viewer;
import java.util.Iterator;
import java.util.NoSuchElementException;
import javax.swing.JTabbedPane;
@SuppressWarnings("serial")
class SaveAllAction extends TabbedSaveAction
{
private class TabIterator implements Iterator<TextFile>
{
private int i = 0;
/** {@inheritDoc} */
public boolean hasNext()
{
return i < tabbedPane.getTabCount();
}
/** {@inheritDoc} */
public TextFile next()
{
if (hasNext())
{
int currentIndex = i;
i++;
return getTextFile(currentIndex);
}
throw new NoSuchElementException();
}
/** {@inheritDoc} */
public void remove()
{
throw new UnsupportedOperationException();
}
}
protected SaveAllAction(JTabbedPane tabbedPane)
{
super(tabbedPane, "Save All...");
}
/** {@inheritDoc} */
public Iterator<TextFile> iterator()
{
return new TabIterator();
}
}
|