You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by sp...@apache.org on 2005/11/15 15:19:15 UTC

svn commit: r344368 - in /geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui: commands/SetHTTPPortCommand.java commands/SetRMIPortCommand.java sections/ServerPortsEditorSection.java

Author: sppatel
Date: Tue Nov 15 06:19:10 2005
New Revision: 344368

URL: http://svn.apache.org/viewcvs?rev=344368&view=rev
Log:
finish port editor

Added:
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/commands/SetHTTPPortCommand.java
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/commands/SetRMIPortCommand.java
Modified:
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/ServerPortsEditorSection.java

Added: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/commands/SetHTTPPortCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/commands/SetHTTPPortCommand.java?rev=344368&view=auto
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/commands/SetHTTPPortCommand.java (added)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/commands/SetHTTPPortCommand.java Tue Nov 15 06:19:10 2005
@@ -0,0 +1,70 @@
+/**
+ * Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.ui.commands;
+
+import org.apache.geronimo.core.internal.GeronimoServer;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.ui.internal.command.ServerCommand;
+
+/**
+ * @author sppatel
+ * 
+ */
+public class SetHTTPPortCommand extends ServerCommand {
+
+	protected String name;
+
+	protected String oldName;
+
+	GeronimoServer gs;
+
+	/**
+	 * @param server
+	 * @param name
+	 */
+	public SetHTTPPortCommand(IServerWorkingCopy server, String name) {
+		super(server, name);
+		this.name = name;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.server.ui.internal.command.ServerCommand#execute()
+	 */
+	public void execute() {
+		gs = (GeronimoServer) server.getAdapter(GeronimoServer.class);
+		if (gs == null) {
+			gs = (GeronimoServer) server.loadAdapter(GeronimoServer.class,
+					new NullProgressMonitor());
+		}
+		oldName = gs.getHTTPPort();
+		gs.setHTTPPort(name);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.server.ui.internal.command.ServerCommand#undo()
+	 */
+	public void undo() {
+		if (gs != null) {
+            gs.setHTTPPort(oldName);
+        }
+	}
+
+}

Added: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/commands/SetRMIPortCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/commands/SetRMIPortCommand.java?rev=344368&view=auto
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/commands/SetRMIPortCommand.java (added)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/commands/SetRMIPortCommand.java Tue Nov 15 06:19:10 2005
@@ -0,0 +1,70 @@
+/**
+ * Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.ui.commands;
+
+import org.apache.geronimo.core.internal.GeronimoServer;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.ui.internal.command.ServerCommand;
+
+/**
+ * @author sppatel
+ * 
+ */
+public class SetRMIPortCommand extends ServerCommand {
+
+	protected String name;
+
+	protected String oldName;
+
+	GeronimoServer gs;
+
+	/**
+	 * @param server
+	 * @param name
+	 */
+	public SetRMIPortCommand(IServerWorkingCopy server, String name) {
+		super(server, name);
+		this.name = name;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.server.ui.internal.command.ServerCommand#execute()
+	 */
+	public void execute() {
+		gs = (GeronimoServer) server.getAdapter(GeronimoServer.class);
+		if (gs == null) {
+			gs = (GeronimoServer) server.loadAdapter(GeronimoServer.class,
+					new NullProgressMonitor());
+		}
+		oldName = gs.getRMINamingPort();
+		gs.setRMINamingPort(name);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.server.ui.internal.command.ServerCommand#undo()
+	 */
+	public void undo() {
+		if (gs != null) {
+            gs.setRMINamingPort(oldName);
+        }
+	}
+
+}

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/ServerPortsEditorSection.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/ServerPortsEditorSection.java?rev=344368&r1=344367&r2=344368&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/ServerPortsEditorSection.java (original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/ServerPortsEditorSection.java Tue Nov 15 06:19:10 2005
@@ -16,8 +16,8 @@
 package org.apache.geronimo.ui.sections;
 
 import org.apache.geronimo.core.internal.GeronimoServer;
-import org.apache.geronimo.ui.commands.SetPasswordCommand;
-import org.apache.geronimo.ui.commands.SetUsernameCommand;
+import org.apache.geronimo.ui.commands.SetHTTPPortCommand;
+import org.apache.geronimo.ui.commands.SetRMIPortCommand;
 import org.apache.geronimo.ui.internal.Messages;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.swt.SWT;
@@ -77,25 +77,25 @@
 		composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
 		section.setClient(composite);
 
-		// ------- Label and text field for the username -------
+		// ------- Label and text field for the http port -------
 		createLabel(composite, Messages.httpPort, toolkit);
 
 		httpPort = toolkit.createText(composite, getHTTPPort(), SWT.BORDER);
 		httpPort.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
 		httpPort.addModifyListener(new ModifyListener() {
 			public void modifyText(ModifyEvent e) {
-				//execute(new SetUsernameCommand(server, username.getText()));
+				execute(new SetHTTPPortCommand(server, httpPort.getText()));
 			}
 		});
 
-		// ------- Label and text field for the password -------
+		// ------- Label and text field for the rmi port -------
 		createLabel(composite, Messages.rmiPort, toolkit);
 
 		rmiPort = toolkit.createText(composite, getRMIPort(), SWT.BORDER);
 		rmiPort.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
 		rmiPort.addModifyListener(new ModifyListener() {
 			public void modifyText(ModifyEvent e) {
-				//xecute(new SetPasswordCommand(server, password.getText()));
+				execute(new SetRMIPortCommand(server, rmiPort.getText()));
 			}
 		});
 	}
@@ -124,11 +124,17 @@
 	}
 
 	private String getHTTPPort() {
-		return null;
+		if (gs != null) {
+			return gs.getHTTPPort();
+		}
+		return "";
 	}
 
 	private String getRMIPort() {
-		return null;
+		if (gs != null) {
+			return gs.getRMINamingPort();
+		}
+		return "";
 	}
 
 }