Author: rob.stryker(a)jboss.com
Date: 2009-03-13 05:06:51 -0400 (Fri, 13 Mar 2009)
New Revision: 14204
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java
Log:
Liberalize the wizard to give warnings instead of errors if you use the wrong version.
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2009-03-13
09:06:16 UTC (rev 14203)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2009-03-13
09:06:51 UTC (rev 14204)
@@ -40,9 +40,11 @@
public static String rwf_Explanation;
public static String rwf_BaseName;
public static String rwf_NameInUse;
- public static String rwf_invalidDirectory;
+ public static String rwf_homeMissingFiles;
+ public static String rwf_homeIncorrectVersion;
public static String rwf_nameTextBlank;
public static String rwf_homeDirBlank;
+ public static String rwf_NoVMSelected;
public static String swf_Title;
public static String swf_RuntimeInformation;
public static String swf_AuthorizationDescription;
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2009-03-13
09:06:16 UTC (rev 14203)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2009-03-13
09:06:51 UTC (rev 14204)
@@ -10,9 +10,11 @@
rwf_Explanation=A JBoss Server runtime references a JBoss installation directory.\nIt can
be used to set up classpaths for projects which depend on this runtime,\nas well as by a
"server" which will be able to start and stop instances of JBoss.
rwf_BaseName=JBoss _VERSION_ Runtime
rwf_NameInUse=Runtime name already in use
-rwf_invalidDirectory=The home directory does not exist, is missing key files, or is of
the incorrect version.
+rwf_homeMissingFiles=The home directory does not exist or is missing the run.jar.
+rwf_homeIncorrectVersion=The server's home directory is of the incorrect version.
rwf_nameTextBlank=The name field must not be blank
rwf_homeDirBlank=The directory field must not be blank
+rwf_NoVMSelected=No VM selected
JBAS_version=JBoss Application Server {0}
JBEAP_version=JBoss Enterprise Application Platform {0}
swf_Title=Create a new JBoss Server
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java 2009-03-13
09:06:16 UTC (rev 14203)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java 2009-03-13
09:06:51 UTC (rev 14204)
@@ -445,9 +445,13 @@
private void updateErrorMessage() {
String error = getErrorString();
- if (error == null)
- handle.setMessage(null, IMessageProvider.NONE);
- else
+ if (error == null) {
+ String warn = getWarningString();
+ if( warn != null )
+ handle.setMessage(warn, IMessageProvider.WARNING);
+ else
+ handle.setMessage(null, IMessageProvider.NONE);
+ } else
handle.setMessage(error, IMessageProvider.ERROR);
}
@@ -462,7 +466,7 @@
}
if (!isHomeValid())
- return Messages.rwf_invalidDirectory;
+ return Messages.rwf_homeMissingFiles;
if (name == null || name.equals(""))
return Messages.rwf_nameTextBlank;
@@ -471,19 +475,31 @@
return Messages.rwf_homeDirBlank;
if (jreComboIndex < 0)
- return "No VM selected";
+ return Messages.rwf_NoVMSelected;
return null;
}
+
+ private String getWarningString() {
+ if( !isHomeVersionValid())
+ return Messages.rwf_homeIncorrectVersion;
+ return null;
+ }
protected boolean isHomeValid() {
if( homeDir == null || !(new File(homeDir).exists())) return false;
+ IRuntime rt = (IRuntime) getTaskModel().getObject(
+ TaskModel.TASK_RUNTIME);
+ String v = rt.getRuntimeType().getVersion();
+ return new
Path(homeDir).append("bin").append("run.jar").toFile().exists();
+ }
+
+ protected boolean isHomeVersionValid() {
String version = new ServerBeanLoader().getFullServerVersion(new File(homeDir,
JBossServerType.AS.getSystemJarPath()));
IRuntime rt = (IRuntime) getTaskModel().getObject(
TaskModel.TASK_RUNTIME);
String v = rt.getRuntimeType().getVersion();
- return new
Path(homeDir).append("bin").append("run.jar").toFile().exists()
- && version.startsWith(v);
+ return version.startsWith(v);
}
private void browseHomeDirClicked() {
Show replies by date