Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoopur Gupta2013-07-30 08:33:22 +0000
committerNoopur Gupta2013-07-30 08:33:22 +0000
commit8b4554a3f35411f7a47be5249688a7b8612c5c66 (patch)
treed5a7e13d08de8c1d8b360f4a2dbc0c19a43abcf3
parent74903cbca471e4ba0e503ada3a029c76046b5fcf (diff)
downloadeclipse.jdt.ui-8b4554a3f35411f7a47be5249688a7b8612c5c66.tar.gz
eclipse.jdt.ui-8b4554a3f35411f7a47be5249688a7b8612c5c66.tar.xz
eclipse.jdt.ui-8b4554a3f35411f7a47be5249688a7b8612c5c66.zip
Adding JavaModelUtil.is18OrHigher(..) methods
-rw-r--r--org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/JavaModelUtil.java25
1 files changed, 21 insertions, 4 deletions
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/JavaModelUtil.java b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/JavaModelUtil.java
index 8b850ee089..b46ead9d0f 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/JavaModelUtil.java
+++ b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/JavaModelUtil.java
@@ -771,6 +771,10 @@ public final class JavaModelUtil {
return !isVersionLessThan(compliance, JavaCore.VERSION_1_7);
}
+ public static boolean is18OrHigher(String compliance) {
+ return !isVersionLessThan(compliance, JavaCore.VERSION_1_8);
+ }
+
/**
* Checks if the given project or workspace has source compliance 1.5 or greater.
*
@@ -778,8 +782,7 @@ public final class JavaModelUtil {
* @return <code>true</code> if the given project or workspace has source compliance 1.5 or greater.
*/
public static boolean is50OrHigher(IJavaProject project) {
- String source= project != null ? project.getOption(JavaCore.COMPILER_SOURCE, true) : JavaCore.getOption(JavaCore.COMPILER_SOURCE);
- return is50OrHigher(source);
+ return is50OrHigher(getSourceCompliance(project));
}
/**
@@ -789,8 +792,22 @@ public final class JavaModelUtil {
* @return <code>true</code> if the given project or workspace has source compliance 1.7 or greater.
*/
public static boolean is17OrHigher(IJavaProject project) {
- String source= project != null ? project.getOption(JavaCore.COMPILER_SOURCE, true) : JavaCore.getOption(JavaCore.COMPILER_SOURCE);
- return is17OrHigher(source);
+ return is17OrHigher(getSourceCompliance(project));
+ }
+
+ /**
+ * Checks if the given project or workspace has source compliance 1.8 or greater.
+ *
+ * @param project the project to test or <code>null</code> to test the workspace settings
+ * @return <code>true</code> if the given project or workspace has source compliance 1.8 or
+ * greater.
+ */
+ public static boolean is18OrHigher(IJavaProject project) {
+ return is18OrHigher(getSourceCompliance(project));
+ }
+
+ private static String getSourceCompliance(IJavaProject project) {
+ return project != null ? project.getOption(JavaCore.COMPILER_SOURCE, true) : JavaCore.getOption(JavaCore.COMPILER_SOURCE);
}
/**

Back to the top