From 06ec8c88556b02782c7b91a233de91eaf4a1439d Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Tue, 09 Jun 2009 12:28:05 +0000
Subject: [PATCH] Fix for issue 3550 (Consider making the control panel able to manage remote servers)
---
opends/src/guitools/org/opends/guitools/controlpanel/ui/WindowsServicePanel.java | 43 +++++++++++++++++++++++++++++++++++--------
1 files changed, 35 insertions(+), 8 deletions(-)
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/WindowsServicePanel.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/WindowsServicePanel.java
index 9bd1032..57c655e 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ui/WindowsServicePanel.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/WindowsServicePanel.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2008 Sun Microsystems, Inc.
+ * Copyright 2008-2009 Sun Microsystems, Inc.
*/
package org.opends.guitools.controlpanel.ui;
@@ -44,6 +44,7 @@
import javax.swing.JButton;
import javax.swing.JEditorPane;
import javax.swing.JLabel;
+import javax.swing.SwingUtilities;
import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
@@ -64,6 +65,8 @@
private JButton bEnable;
private JButton bDisable;
+ private boolean previousLocal = true;
+
private boolean isWindowsServiceEnabled;
/**
@@ -193,13 +196,37 @@
{
boolean previousValue = isWindowsServiceEnabled;
isWindowsServiceEnabled = ev.getNewDescriptor().isWindowsServiceEnabled();
- if (isWindowsServiceEnabled != previousValue)
+
+ final boolean isLocal = ev.getNewDescriptor().isLocal();
+ if ((isLocal != previousLocal) ||
+ (isWindowsServiceEnabled != previousValue))
{
- lState.setText(isWindowsServiceEnabled ?
- INFO_ENABLED_LABEL.get().toString() :
- INFO_DISABLED_LABEL.get().toString());
- bEnable.setVisible(!isWindowsServiceEnabled);
- bDisable.setVisible(isWindowsServiceEnabled);
+ previousLocal = isLocal;
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ /**
+ * {@inheritDoc}
+ */
+ public void run()
+ {
+ lState.setText(isWindowsServiceEnabled ?
+ INFO_ENABLED_LABEL.get().toString() :
+ INFO_DISABLED_LABEL.get().toString());
+ bEnable.setVisible(!isWindowsServiceEnabled);
+ bDisable.setVisible(isWindowsServiceEnabled);
+
+ if (!isLocal)
+ {
+ displayErrorMessage(INFO_CTRL_PANEL_SERVER_REMOTE_SUMMARY.get(),
+ INFO_CTRL_PANEL_SERVER_MUST_BE_LOCAL_WINDOWS_SERVICE_SUMMARY.get());
+ packParentDialog();
+ }
+ else
+ {
+ displayMainPanel();
+ }
+ }
+ });
}
}
@@ -314,7 +341,7 @@
Collection<Message> incompatibilityReasons)
{
boolean canLaunch = true;
- if (state == State.RUNNING)
+ if (state == State.RUNNING && runningOnSameServer(taskToBeLaunched))
{
if ((taskToBeLaunched.getType() == Type.ENABLE_WINDOWS_SERVICE) ||
(taskToBeLaunched.getType() == Type.DISABLE_WINDOWS_SERVICE))
--
Gitblit v1.10.0