From 6639dd3d599535fa0e82591251171048ef21323b Mon Sep 17 00:00:00 2001
From: Robert Scott <code@humanleg.org.uk>
Date: Sat, 12 May 2018 11:20:26 +0100
Subject: [PATCH v2 22/28] plugin preferences: small additions to ease testing
---
.../josm/gui/preferences/PreferenceTabbedPane.java | 8 +++++---
.../josm/gui/preferences/plugin/PluginPreference.java | 18 ++++++++++++++----
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java b/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java
index a1a340a89..2b9272610 100644
|
a
|
b
|
import javax.swing.JOptionPane;
|
| 25 | 25 | import javax.swing.JPanel; |
| 26 | 26 | import javax.swing.JScrollPane; |
| 27 | 27 | import javax.swing.JTabbedPane; |
| 28 | | import javax.swing.SwingUtilities; |
| 29 | 28 | import javax.swing.event.ChangeEvent; |
| 30 | 29 | import javax.swing.event.ChangeListener; |
| 31 | 30 | |
| … |
… |
import org.openstreetmap.josm.gui.preferences.shortcut.ShortcutPreference;
|
| 59 | 58 | import org.openstreetmap.josm.gui.preferences.validator.ValidatorPreference; |
| 60 | 59 | import org.openstreetmap.josm.gui.preferences.validator.ValidatorTagCheckerRulesPreference; |
| 61 | 60 | import org.openstreetmap.josm.gui.preferences.validator.ValidatorTestsPreference; |
| | 61 | import org.openstreetmap.josm.gui.util.GuiHelper; |
| 62 | 62 | import org.openstreetmap.josm.plugins.PluginDownloadTask; |
| 63 | 63 | import org.openstreetmap.josm.plugins.PluginHandler; |
| 64 | 64 | import org.openstreetmap.josm.plugins.PluginInformation; |
| … |
… |
public final class PreferenceTabbedPane extends JTabbedPane implements MouseWhee
|
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | | Main.parent.repaint(); |
| | 177 | if (Main.parent != null) { |
| | 178 | Main.parent.repaint(); |
| | 179 | } |
| 178 | 180 | } |
| 179 | 181 | } |
| 180 | 182 | |
| … |
… |
public final class PreferenceTabbedPane extends JTabbedPane implements MouseWhee
|
| 420 | 422 | // if we have to launch a plugin download task we do it asynchronously, followed |
| 421 | 423 | // by the remaining "save preferences" activites run on the Swing EDT. |
| 422 | 424 | MainApplication.worker.submit(task); |
| 423 | | MainApplication.worker.submit(() -> SwingUtilities.invokeLater(continuation)); |
| | 425 | MainApplication.worker.submit(() -> GuiHelper.runInEDT(continuation)); |
| 424 | 426 | } else { |
| 425 | 427 | // no need for asynchronous activities. Simply run the remaining "save preference" |
| 426 | 428 | // activities on this thread (we are already on the Swing EDT |
diff --git a/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java b/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java
index 9d4b3ed20..d884878a6 100644
|
a
|
b
|
public final class PluginPreference extends DefaultTabPreferenceSetting {
|
| 211 | 211 | private JPanel buildActionPanel() { |
| 212 | 212 | JPanel pnl = new JPanel(new GridLayout(1, 4)); |
| 213 | 213 | |
| 214 | | pnl.add(new JButton(new DownloadAvailablePluginsAction())); |
| 215 | | pnl.add(new JButton(new UpdateSelectedPluginsAction())); |
| 216 | | ExpertToggleAction.addVisibilitySwitcher(pnl.add(new JButton(new SelectByListAction()))); |
| 217 | | ExpertToggleAction.addVisibilitySwitcher(pnl.add(new JButton(new ConfigureSitesAction()))); |
| | 214 | // assign some component names to these as we go to aid testing |
| | 215 | final JButton downloadListButton = new JButton(new DownloadAvailablePluginsAction()); |
| | 216 | downloadListButton.setName("downloadListButton"); |
| | 217 | final JButton updatePluginsButton = new JButton(new UpdateSelectedPluginsAction()); |
| | 218 | updatePluginsButton.setName("updatePluginsButton"); |
| | 219 | final JButton loadFromListButton = new JButton(new SelectByListAction()); |
| | 220 | loadFromListButton.setName("loadFromListButton"); |
| | 221 | final JButton configureSitesButton = new JButton(new ConfigureSitesAction()); |
| | 222 | configureSitesButton.setName("configureSitesButton"); |
| | 223 | |
| | 224 | pnl.add(downloadListButton); |
| | 225 | pnl.add(updatePluginsButton); |
| | 226 | ExpertToggleAction.addVisibilitySwitcher(pnl.add(loadFromListButton)); |
| | 227 | ExpertToggleAction.addVisibilitySwitcher(pnl.add(configureSitesButton)); |
| 218 | 228 | return pnl; |
| 219 | 229 | } |
| 220 | 230 | |