|
@@ -41,8 +41,6 @@ import com.dmdirc.ui.IconManager;
|
41
|
41
|
import java.awt.Window;
|
42
|
42
|
import java.awt.event.ActionEvent;
|
43
|
43
|
import java.awt.event.ActionListener;
|
44
|
|
-import java.util.Collection;
|
45
|
|
-import java.util.List;
|
46
|
44
|
import java.util.concurrent.ExecutionException;
|
47
|
45
|
|
48
|
46
|
import javax.inject.Inject;
|
|
@@ -53,6 +51,7 @@ import javax.swing.JButton;
|
53
|
51
|
import javax.swing.JList;
|
54
|
52
|
import javax.swing.JScrollPane;
|
55
|
53
|
import javax.swing.ListSelectionModel;
|
|
54
|
+import javax.swing.ScrollPaneConstants;
|
56
|
55
|
import javax.swing.WindowConstants;
|
57
|
56
|
import javax.swing.event.ListSelectionEvent;
|
58
|
57
|
import javax.swing.event.ListSelectionListener;
|
|
@@ -151,7 +150,7 @@ public final class SwingPreferencesDialog extends StandardDialog implements
|
151
|
150
|
private void setPrefsManager(final PreferencesDialogModel manager) {
|
152
|
151
|
this.manager = manager;
|
153
|
152
|
|
154
|
|
- ((DefaultListModel) tabList.getModel()).clear();
|
|
153
|
+ ((DefaultListModel<PreferencesCategory>) tabList.getModel()).clear();
|
155
|
154
|
mainPanel.setCategory(null);
|
156
|
155
|
|
157
|
156
|
final int count = countCategories(manager.getCategories());
|
|
@@ -172,7 +171,7 @@ public final class SwingPreferencesDialog extends StandardDialog implements
|
172
|
171
|
ListScroller.register(tabList);
|
173
|
172
|
final JScrollPane tabListScrollPane = new JScrollPane(tabList);
|
174
|
173
|
tabListScrollPane.setHorizontalScrollBarPolicy(
|
175
|
|
- JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
|
|
174
|
+ ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
176
|
175
|
|
177
|
176
|
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
178
|
177
|
setTitle("Preferences");
|
|
@@ -185,9 +184,7 @@ public final class SwingPreferencesDialog extends StandardDialog implements
|
185
|
184
|
getOkButton().addActionListener(this);
|
186
|
185
|
getCancelButton().addActionListener(this);
|
187
|
186
|
|
188
|
|
- final MigLayout layout
|
189
|
|
- = new MigLayout("pack, hmin min(80sp, 700), " + "hmax min(700, 80sp)");
|
190
|
|
- setLayout(layout);
|
|
187
|
+ setLayout(new MigLayout("pack, hmin min(80sp, 700), " + "hmax min(700, 80sp)"));
|
191
|
188
|
add(tabListScrollPane, "w 150!, growy, pushy");
|
192
|
189
|
add(mainPanel, "wrap, w 480!, pushy, growy, pushy");
|
193
|
190
|
add(getLeftButton(), "span, split, right");
|
|
@@ -197,7 +194,7 @@ public final class SwingPreferencesDialog extends StandardDialog implements
|
197
|
194
|
/**
|
198
|
195
|
* Adds the categories from the preferences manager, clearing existing categories first.
|
199
|
196
|
*/
|
200
|
|
- private void addCategories(final List<PreferencesCategory> categories) {
|
|
197
|
+ private void addCategories(final Iterable<PreferencesCategory> categories) {
|
201
|
198
|
UIUtilities.invokeLater(() -> {
|
202
|
199
|
tabList.removeListSelectionListener(this);
|
203
|
200
|
for (PreferencesCategory category : categories) {
|
|
@@ -222,8 +219,7 @@ public final class SwingPreferencesDialog extends StandardDialog implements
|
222
|
219
|
*
|
223
|
220
|
* @since 0.6.3m1rc3
|
224
|
221
|
*/
|
225
|
|
- protected int countCategories(
|
226
|
|
- final Collection<PreferencesCategory> categories) {
|
|
222
|
+ private int countCategories(final Iterable<PreferencesCategory> categories) {
|
227
|
223
|
int count = 0;
|
228
|
224
|
|
229
|
225
|
for (PreferencesCategory cat : categories) {
|
|
@@ -297,7 +293,7 @@ public final class SwingPreferencesDialog extends StandardDialog implements
|
297
|
293
|
|
298
|
294
|
@Override
|
299
|
295
|
public void dispose() {
|
300
|
|
- synchronized (SwingPreferencesDialog.this) {
|
|
296
|
+ synchronized (this) {
|
301
|
297
|
if (!worker.isDone()) {
|
302
|
298
|
worker.cancel(true);
|
303
|
299
|
}
|