[jbosstools-commits] JBoss Tools SVN: r30995 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon May 2 08:50:27 EDT 2011


Author: adietish
Date: 2011-05-02 08:50:27 -0400 (Mon, 02 May 2011)
New Revision: 30995

Modified:
   trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7ServerWizardFragment.java
Log:
[JBIDE-8609] added check for standalone script file

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7ServerWizardFragment.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7ServerWizardFragment.java	2011-05-02 12:25:39 UTC (rev 30994)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7ServerWizardFragment.java	2011-05-02 12:50:27 UTC (rev 30995)
@@ -12,7 +12,7 @@
 import org.jboss.ide.eclipse.as.ui.Messages;
 
 public class JBoss7ServerWizardFragment extends JBossRuntimeWizardFragment {
-	
+
 	@Override
 	public boolean hasComposite() {
 		return true;
@@ -29,18 +29,19 @@
 		createNameComposite(main);
 		createHomeComposite(main);
 	}
-	
+
 	protected void fillWidgets() {
-		IRuntime rt = (IRuntime)getTaskModel().getObject(TaskModel.TASK_RUNTIME);
+		IRuntime rt = (IRuntime) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
 		if (rt != null) {
 			try {
 				fillNameWidgets(rt);
 				fillHomeDir(rt);
-			} catch(Exception e) {
+			} catch (Exception e) {
 				e.printStackTrace();
 			}
 		}
 	}
+
 	@Override
 	protected void updatePage() {
 		// Do Nothing
@@ -54,37 +55,47 @@
 
 		if (getRuntime(name) != null)
 			return Messages.rwf_NameInUse;
-		
+
 		if (!isHomeValid())
 			return Messages.rwf_homeMissingFiles;
 
 		if (name == null || name.equals("")) //$NON-NLS-1$
 			return Messages.rwf_nameTextBlank;
-		
+
 		return null;
 	}
 
 	@Override
 	protected boolean isHomeValid() {
-		if( homeDir == null  || homeDir.length() == 0 || !(new File(homeDir).exists())) 
+		if (homeDir == null || homeDir.length() == 0 || !(new File(homeDir).exists()))
 			return false;
-		return true;
+		return standaloneScriptExists();
 	}
-	
+
+	private boolean standaloneScriptExists() {
+		String standaloneScriptPath = new StringBuilder(homeDir)
+				.append(File.separator)
+				.append("bin") //$NON-NLS-1$
+				.append(File.separator)
+				.append("standalone.sh") //$NON-NLS-1$
+				.toString();
+		return new File(standaloneScriptPath).exists();
+	}
+
 	@Override
 	protected String getVersionString(File loc) {
 		// TODO clean this up for later
 		return "7.0"; //$NON-NLS-1$
 	}
-	
+
 	@Override
 	public void performFinish(IProgressMonitor monitor) throws CoreException {
-		IRuntime rt = (IRuntime)getTaskModel().getObject(TaskModel.TASK_RUNTIME);
-		((IRuntimeWorkingCopy)rt).setLocation(new Path(homeDir));
+		IRuntime rt = (IRuntime) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
+		((IRuntimeWorkingCopy) rt).setLocation(new Path(homeDir));
 	}
-	
+
 	@Override
-	public void exit() { 
+	public void exit() {
 		IRuntime r = (IRuntime) getTaskModel()
 				.getObject(TaskModel.TASK_RUNTIME);
 		IRuntimeWorkingCopy runtimeWC = r.isWorkingCopy() ? ((IRuntimeWorkingCopy) r)



More information about the jbosstools-commits mailing list