|
@@ -26,11 +26,17 @@ import com.dmdirc.addons.ui_swing.UIUtilities;
|
26
|
26
|
import com.dmdirc.config.prefs.PluginPreferencesCategory;
|
27
|
27
|
import com.dmdirc.config.prefs.PreferencesCategory;
|
28
|
28
|
import com.dmdirc.config.prefs.PreferencesDialogModel;
|
|
29
|
+import com.dmdirc.config.prefs.PreferencesInterface;
|
29
|
30
|
import com.dmdirc.plugins.PluginInfo;
|
30
|
31
|
import com.dmdirc.plugins.implementations.BaseCommandPlugin;
|
31
|
32
|
|
32
|
33
|
import java.util.concurrent.Callable;
|
33
|
34
|
|
|
35
|
+import javax.swing.JLabel;
|
|
36
|
+import javax.swing.JPanel;
|
|
37
|
+
|
|
38
|
+import net.miginfocom.swing.MigLayout;
|
|
39
|
+
|
34
|
40
|
import dagger.ObjectGraph;
|
35
|
41
|
|
36
|
42
|
/**
|
|
@@ -77,15 +83,28 @@ public class NowPlayingPlugin extends BaseCommandPlugin {
|
77
|
83
|
|
78
|
84
|
@Override
|
79
|
85
|
public void showConfig(final PreferencesDialogModel manager) {
|
80
|
|
- final ConfigPanel configPanel = UIUtilities.invokeAndWait(
|
81
|
|
- new Callable<ConfigPanel>() {
|
82
|
|
- @Override
|
83
|
|
- public ConfigPanel call() {
|
84
|
|
- return new ConfigPanel(nowplayingmanager, manager.getConfigManager(),
|
85
|
|
- manager.getIdentity(), domain,
|
86
|
|
- nowplayingmanager.getSettings());
|
87
|
|
- }
|
88
|
|
- });
|
|
86
|
+ final PreferencesInterface configPanel;
|
|
87
|
+ if (nowplayingmanager == null) {
|
|
88
|
+ configPanel = UIUtilities.invokeAndWait(
|
|
89
|
+ new Callable<LoadPluginPanel>() {
|
|
90
|
+
|
|
91
|
+ @Override
|
|
92
|
+ public LoadPluginPanel call() {
|
|
93
|
+ return new LoadPluginPanel();
|
|
94
|
+ }
|
|
95
|
+ });
|
|
96
|
+ } else {
|
|
97
|
+ configPanel = UIUtilities.invokeAndWait(
|
|
98
|
+ new Callable<ConfigPanel>() {
|
|
99
|
+
|
|
100
|
+ @Override
|
|
101
|
+ public ConfigPanel call() {
|
|
102
|
+ return new ConfigPanel(nowplayingmanager, manager.getConfigManager(),
|
|
103
|
+ manager.getIdentity(), domain,
|
|
104
|
+ nowplayingmanager.getSettings());
|
|
105
|
+ }
|
|
106
|
+ });
|
|
107
|
+ }
|
89
|
108
|
|
90
|
109
|
final PreferencesCategory category = new PluginPreferencesCategory(
|
91
|
110
|
pluginInfo, "Now Playing",
|
|
@@ -93,4 +112,19 @@ public class NowPlayingPlugin extends BaseCommandPlugin {
|
93
|
112
|
manager.getCategory("Plugins").addSubCategory(category);
|
94
|
113
|
}
|
95
|
114
|
|
|
115
|
+ private class LoadPluginPanel extends JPanel implements PreferencesInterface {
|
|
116
|
+
|
|
117
|
+ private static final long serialVersionUID = 1L;
|
|
118
|
+
|
|
119
|
+ private LoadPluginPanel() {
|
|
120
|
+ super(new MigLayout("fill"));
|
|
121
|
+ add(new JLabel("Please load the plugin to change these settings."));
|
|
122
|
+ }
|
|
123
|
+
|
|
124
|
+ @Override
|
|
125
|
+ public void save() {
|
|
126
|
+ }
|
|
127
|
+
|
|
128
|
+ }
|
|
129
|
+
|
96
|
130
|
}
|