|
@@ -23,11 +23,13 @@
|
23
|
23
|
package com.dmdirc.addons.ui_swing.dialogs.serversetting;
|
24
|
24
|
|
25
|
25
|
import com.dmdirc.Server;
|
|
26
|
+import com.dmdirc.ServerState;
|
26
|
27
|
import com.dmdirc.config.Identity;
|
27
|
28
|
import com.dmdirc.addons.ui_swing.UIUtilities;
|
28
|
29
|
import com.dmdirc.addons.ui_swing.dialogs.StandardDialog;
|
29
|
30
|
import com.dmdirc.addons.ui_swing.components.expandingsettings.SettingsPanel;
|
30
|
31
|
import com.dmdirc.addons.ui_swing.components.expandingsettings.SettingsPanel.OptionType;
|
|
32
|
+import com.dmdirc.addons.ui_swing.dialogs.StandardQuestionDialog;
|
31
|
33
|
|
32
|
34
|
import java.awt.Window;
|
33
|
35
|
import java.awt.event.ActionEvent;
|
|
@@ -246,6 +248,34 @@ public final class ServerSettingsDialog extends StandardDialog implements Action
|
246
|
248
|
|
247
|
249
|
/** Saves the settings from this dialog. */
|
248
|
250
|
public void saveSettings() {
|
|
251
|
+ if (server.getState() != ServerState.CONNECTED) {
|
|
252
|
+ new StandardQuestionDialog(parentWindow, ModalityType.MODELESS,
|
|
253
|
+ "Server has been disconnected.", "Any changes you have " +
|
|
254
|
+ "made will be lost, are you sure you want to close this " +
|
|
255
|
+ "dialog?") {
|
|
256
|
+
|
|
257
|
+ private static final long serialVersionUID = 1;
|
|
258
|
+
|
|
259
|
+ /** {@inheritDoc} */
|
|
260
|
+ @Override
|
|
261
|
+ public boolean save() {
|
|
262
|
+ ServerSettingsDialog.this.dispose();
|
|
263
|
+ return true;
|
|
264
|
+ }
|
|
265
|
+
|
|
266
|
+ /** {@inheritDoc} */
|
|
267
|
+ @Override
|
|
268
|
+ public void cancelled() {
|
|
269
|
+ //Ignore
|
|
270
|
+ }
|
|
271
|
+ }.display(parentWindow);
|
|
272
|
+ } else {
|
|
273
|
+ closeAndSave();
|
|
274
|
+ }
|
|
275
|
+ }
|
|
276
|
+
|
|
277
|
+ /** Closes this dialog and saves the settings. */
|
|
278
|
+ private void closeAndSave() {
|
249
|
279
|
modesPanel.save();
|
250
|
280
|
settingsPanel.save();
|
251
|
281
|
performPanel.savePerforms();
|
|
@@ -254,6 +284,8 @@ public final class ServerSettingsDialog extends StandardDialog implements Action
|
254
|
284
|
final Identity identity = server.getNetworkIdentity();
|
255
|
285
|
identity.setOption("dialogstate", "serversettingsdialog",
|
256
|
286
|
String.valueOf(tabbedPane.getSelectedIndex()));
|
|
287
|
+
|
|
288
|
+ dispose();
|
257
|
289
|
}
|
258
|
290
|
|
259
|
291
|
/**
|
|
@@ -265,7 +297,6 @@ public final class ServerSettingsDialog extends StandardDialog implements Action
|
265
|
297
|
public void actionPerformed(final ActionEvent e) {
|
266
|
298
|
if (e.getSource() == getOkButton()) {
|
267
|
299
|
saveSettings();
|
268
|
|
- dispose();
|
269
|
300
|
} else if (e.getSource() == getCancelButton()) {
|
270
|
301
|
dispose();
|
271
|
302
|
}
|