db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fuzzylo...@apache.org
Subject svn commit: r189829 - in /incubator/derby/code/trunk/plugins/eclipse/org.apache.derby.ui/src/org/apache/derby/ui: common/Messages.java properties/DerbyPropertiesPage.java
Date Thu, 09 Jun 2005 21:58:37 GMT
Author: fuzzylogic
Date: Thu Jun  9 14:58:36 2005
New Revision: 189829

URL: http://svn.apache.org/viewcvs?rev=189829&view=rev
Log:
Derby-314: improve Eclipse plugin network server process handling.

The fix changes the behaviour to the following:

1) Only one network server can be started per project.

2) Once a network server is started for a project it must be stopped before any
   of it's settings (port, host and derby.system.home) can be changed.

3) If a user tries to change these settings when the network server is running
   they will be notified that they cannot change them, and the text fields
   become uneditable. 

Committed for Susan Cline <home4slc@pacbell.net>

Modified:
    incubator/derby/code/trunk/plugins/eclipse/org.apache.derby.ui/src/org/apache/derby/ui/common/Messages.java
    incubator/derby/code/trunk/plugins/eclipse/org.apache.derby.ui/src/org/apache/derby/ui/properties/DerbyPropertiesPage.java

Modified: incubator/derby/code/trunk/plugins/eclipse/org.apache.derby.ui/src/org/apache/derby/ui/common/Messages.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/plugins/eclipse/org.apache.derby.ui/src/org/apache/derby/ui/common/Messages.java?rev=189829&r1=189828&r2=189829&view=diff
==============================================================================
--- incubator/derby/code/trunk/plugins/eclipse/org.apache.derby.ui/src/org/apache/derby/ui/common/Messages.java
(original)
+++ incubator/derby/code/trunk/plugins/eclipse/org.apache.derby.ui/src/org/apache/derby/ui/common/Messages.java
Thu Jun  9 14:58:36 2005
@@ -43,4 +43,5 @@
 	public static String ADD_N_TRY="Please add the Derby nature and try again.";
 	
 	public static String NO_ACTION="Unable to execute the action";
+	public static String SERVER_RUNNING="The Network Server is already running.\nStop the server
prior to changing the settings.";
 }

Modified: incubator/derby/code/trunk/plugins/eclipse/org.apache.derby.ui/src/org/apache/derby/ui/properties/DerbyPropertiesPage.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/plugins/eclipse/org.apache.derby.ui/src/org/apache/derby/ui/properties/DerbyPropertiesPage.java?rev=189829&r1=189828&r2=189829&view=diff
==============================================================================
--- incubator/derby/code/trunk/plugins/eclipse/org.apache.derby.ui/src/org/apache/derby/ui/properties/DerbyPropertiesPage.java
(original)
+++ incubator/derby/code/trunk/plugins/eclipse/org.apache.derby.ui/src/org/apache/derby/ui/properties/DerbyPropertiesPage.java
Thu Jun  9 14:58:36 2005
@@ -20,11 +20,15 @@
 
 package org.apache.derby.ui.properties;
 
+import org.apache.derby.ui.common.CommonNames;
+import org.apache.derby.ui.common.Messages;
+import org.apache.derby.ui.util.DerbyServerUtils;
 import org.apache.derby.ui.util.Logger;
 import org.apache.derby.ui.util.SelectionUtil;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.layout.GridData;
@@ -32,6 +36,7 @@
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.dialogs.PropertyPage;
 
@@ -45,6 +50,7 @@
 	protected Text hostText;
 	protected Text portText;
 	protected Text systemHomeText;
+	private boolean isServerRunning;
 	
 
 	protected void addControls(Composite parent) {
@@ -115,6 +121,26 @@
 		portText.setText(Integer.toString(dsProps.getPort()));
 		hostText.setText(dsProps.getHost());
 		systemHomeText.setText(dsProps.getSystemHome());
+		isServerRunning = checkServer();
+		// if the server is running do not allow
+		// editing of the settings
+		if (isServerRunning) {
+		    portText.setEditable(false);
+		    hostText.setEditable(false);
+		    systemHomeText.setEditable(false);
+		}
+	}
+	
+	protected boolean checkServer() {
+	    IProject proj = (IProject)getElement();
+	    boolean serverRunning = false;
+	    try {
+	        serverRunning = DerbyServerUtils.getDefault().getRunning(proj);
+	    }
+	    catch (CoreException ce) {
+	        Logger.log(SelectionUtil.getStatusMessages(ce),IStatus.ERROR);
+	    }
+	    return serverRunning;
 	}
 
 	protected void getParams() {
@@ -127,6 +153,16 @@
 		}
 		dsProps.setHost(hostText.getText());
 		dsProps.setSystemHome(systemHomeText.getText());
+		
+		// if the server is running inform the user
+		// to stop the server before changing the settings
+		if (isServerRunning) {
+		    Shell shell = new Shell();
+			MessageDialog.openInformation(
+			shell,
+			CommonNames.PLUGIN_NAME,
+			Messages.SERVER_RUNNING );
+		}
 	}
 
 	protected GridData getSeperatorLabelGridData() {



Mime
View raw message