Author: yradtsevich
Date: 2011-05-10 11:25:35 -0400 (Tue, 10 May 2011)
New Revision: 31182
Modified:
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
Log:
https://issues.jboss.org/browse/JBIDE-8807: Visual Part not available when we run JBDS or
JBT on java 5
- changed error message if run on a JRE with version less than 6
Modified:
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
===================================================================
---
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2011-05-10
15:21:42 UTC (rev 31181)
+++
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2011-05-10
15:25:35 UTC (rev 31182)
@@ -11,6 +11,8 @@
package org.jboss.tools.jst.jsp.jspeditor;
import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
@@ -94,6 +96,8 @@
IReusableEditor, ITextEditorExtension, ITextEditorExtension2,
ITextEditorExtension3, INavigationLocationProvider, IMultiPageEditor {
+ private static final int MINIMUM_JRE_VERSION_FOR_VPE = 6;
+
public static final String EDITOR_ID =
"org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor"; //$NON-NLS-1$
private static final String VPE_VISUAL_EDITOR_IMPL_ID =
"org.jboss.tools.vpe.org.jboss.tools.vpe.editor.VpeEditorPartFactory";
//$NON-NLS-1$
@@ -165,12 +169,18 @@
"Visual Editor Extension Point not configured correctly");
//$NON-NLS-1$
}
} else {
- JspEditorPlugin.getPluginLog().logError(
- "Visual Editor Implementation not available"); //$NON-NLS-1$
+ if (isRequiredJreVersionForVpe()) {
+ JspEditorPlugin.getPluginLog().logError(
+ "Visual Editor Implementation not available."); //$NON-NLS-1$
+ } else {
+ JspEditorPlugin.getPluginLog().logError(
+ "Visual Editor Implementation not available." + //$NON-NLS-1$
+ " It requires JRE 1." + MINIMUM_JRE_VERSION_FOR_VPE + " or
later."); //$NON-NLS-1$ //$NON-NLS-2$
+ }
}
} catch (CoreException e) {
JspEditorPlugin.getPluginLog().logError(
- "Visual Editor Implementation not available" + e); //$NON-NLS-1$
+ "Visual Editor Implementation not available." + e); //$NON-NLS-1$
}
}
@@ -196,6 +206,21 @@
}
}
+ private static boolean isRequiredJreVersionForVpe() {
+ String javaVersion = System.getProperty("java.version"); //$NON-NLS-1$
+ Pattern pattern = Pattern.compile("1\\.(\\d{1,6})\\..*"); //$NON-NLS-1$
+ if (javaVersion != null) {
+ Matcher matcher = pattern.matcher(javaVersion);
+ if (matcher.matches()) {
+ int majorVersion = Integer.valueOf(matcher.group(1));
+ if (majorVersion < MINIMUM_JRE_VERSION_FOR_VPE) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
public void superPageChange(int newPageIndex) {
Control control = getControl(visualSourceIndex);
if (control != null) {