geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r370577 - /geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/internal/GeronimoServerRuntimeWizardFragment.java
Date Thu, 19 Jan 2006 19:26:32 GMT
Author: sppatel
Date: Thu Jan 19 11:26:31 2006
New Revision: 370577

URL: http://svn.apache.org/viewcvs?rev=370577&view=rev
Log:
cleanup

Modified:
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/internal/GeronimoServerRuntimeWizardFragment.java

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/internal/GeronimoServerRuntimeWizardFragment.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/internal/GeronimoServerRuntimeWizardFragment.java?rev=370577&r1=370576&r2=370577&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/internal/GeronimoServerRuntimeWizardFragment.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/internal/GeronimoServerRuntimeWizardFragment.java
Thu Jan 19 11:26:31 2006
@@ -15,7 +15,6 @@
  */
 package org.apache.geronimo.ui.internal;
 
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -25,7 +24,6 @@
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jst.server.core.internal.GenericRuntime;
 import org.eclipse.jst.server.generic.core.internal.GenericServerRuntime;
 import org.eclipse.jst.server.generic.servertype.definition.Property;
 import org.eclipse.jst.server.generic.servertype.definition.ServerRuntime;
@@ -42,7 +40,6 @@
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.DirectoryDialog;
 import org.eclipse.swt.widgets.Group;
@@ -217,43 +214,20 @@
 	}
 
 	protected void validate() {
+		validateDecorators();
+		
 		IRuntime runtime = getRuntimeDelegate().getRuntime();
 
 		if (runtime == null) {
 			getWizard().setMessage("", IMessageProvider.ERROR);
 			return;
 		}
-		// ----
-		ServerRuntime definition = null;
-		if (getRuntimeDelegate() != null) {
-			Map initialProperties = getRuntimeDelegate()
-					.getServerInstanceProperties();
-			definition = getServerTypeDefinition(getServerDefinitionId(),
-					initialProperties);
-		}
-		List properties = null;
-		if (definition == null) {
-			properties = new ArrayList(0);
-		} else {
-			properties = definition.getProperty();
-		}
-		Map propertyMap = new HashMap();
-		for (int i = 0; i < properties.size(); i++) {
-			Property property = (Property) properties.get(i);
-			if (Property.CONTEXT_RUNTIME.equals(property.getContext())) {
-				if (Property.TYPE_DIRECTORY.equals(property.getType())) {
-					propertyMap.put(property.getId(), installDir.getText());
-				}
-			}
-		}
-
-		// ----
 
 		IRuntimeWorkingCopy runtimeWC = getRuntimeDelegate()
 				.getRuntimeWorkingCopy();
 		getRuntimeDelegate().setServerDefinitionId(
 				runtime.getRuntimeType().getId());
-		getRuntimeDelegate().setServerInstanceProperties(propertyMap);
+		getRuntimeDelegate().setServerInstanceProperties(getValues());
 
 		IStatus status = runtimeWC.validate(null);
 		if (status == null || status.isOK()) {
@@ -263,9 +237,35 @@
 			getWizard().setMessage(status.getMessage(), IMessageProvider.ERROR);
 			group.setEnabled(true);
 		}
+	}
+	
+	private void validateDecorators() {
+		for (int i = 0; i < fDecorators.length; i++) {
+			if (fDecorators[i].validate())
+				return;
+		}
+	}
 
-		// TODO validate installDir
-		// TODO group enablement/disablement
+	private Map getValues() {
+		Map propertyMap = new HashMap();
+		if (getRuntimeDelegate() != null) {
+			ServerRuntime definition = getServerTypeDefinition(
+					getServerDefinitionId(), getRuntimeDelegate()
+							.getServerInstanceProperties());
+			if (definition != null) {
+				List properties = definition.getProperty();
+				for (int i = 0; i < properties.size(); i++) {
+					Property property = (Property) properties.get(i);
+					if (Property.CONTEXT_RUNTIME.equals(property.getContext())) {
+						if (Property.TYPE_DIRECTORY.equals(property.getType())) {
+							propertyMap.put(property.getId(), installDir
+									.getText());
+						}
+					}
+				}
+			}
+		}
+		return propertyMap;
 	}
 
 	private String getServerDefinitionId() {
@@ -279,15 +279,6 @@
 		return null;
 	}
 
-	private void validateDecorators() {
-		for (int i = 0; i < fDecorators.length; i++) {
-			if (fDecorators[i].validate())
-				return;
-		}
-		// getRuntimeDelegate().setServerDefinitionId(getRuntimeDelegate().getRuntime().getRuntimeType().getId());
-		// getRuntimeDelegate().setServerInstanceProperties(getValues());
-	}
-
 	/*
 	 * (non-Javadoc)
 	 * 
@@ -296,7 +287,7 @@
 	public void enter() {
 		if (getRuntimeDelegate() != null)
 			getRuntimeDelegate().getRuntimeWorkingCopy().setName(createName());
-		validateDecorators();
+		validate();
 	}
 
 	/*



Mime
View raw message