diff --git a/eclipse-extensions/org.springframework.ide.eclipse.boot/plugin.xml b/eclipse-extensions/org.springframework.ide.eclipse.boot/plugin.xml
index cbc4b5e3d..0996cf6f2 100644
--- a/eclipse-extensions/org.springframework.ide.eclipse.boot/plugin.xml
+++ b/eclipse-extensions/org.springframework.ide.eclipse.boot/plugin.xml
@@ -11,7 +11,7 @@
class="org.springframework.ide.eclipse.boot.core.BootPropertyTester"
id="org.springsource.ide.eclipse.boot.BootPropertyTester"
namespace="org.springsource.ide.eclipse.boot"
- properties="isBootProject,isBootResource,hasBootDevTools"
+ properties="isBootProject,isBootResource,hasBootDevTools,isBoot2Project,isBoot2Resource"
type="org.eclipse.core.resources.IResource">
@@ -19,7 +19,7 @@
class="org.springframework.ide.eclipse.boot.core.BootJavaElementPropertyTester"
id="org.springframework.ide.eclipse.boot.core.BootJavaElementPropertyTester"
namespace="org.springsource.ide.eclipse.boot.javaelement"
- properties="isInBootProject,isInBootProjectWithDevTools"
+ properties="isInBootProject,isInBootProjectWithDevTools,isInBoot2Project"
type="org.eclipse.jdt.core.IJavaElement">
diff --git a/eclipse-extensions/org.springframework.ide.eclipse.boot/src/org/springframework/ide/eclipse/boot/core/BootJavaElementPropertyTester.java b/eclipse-extensions/org.springframework.ide.eclipse.boot/src/org/springframework/ide/eclipse/boot/core/BootJavaElementPropertyTester.java
index 4f525da81..6a0cbcc80 100644
--- a/eclipse-extensions/org.springframework.ide.eclipse.boot/src/org/springframework/ide/eclipse/boot/core/BootJavaElementPropertyTester.java
+++ b/eclipse-extensions/org.springframework.ide.eclipse.boot/src/org/springframework/ide/eclipse/boot/core/BootJavaElementPropertyTester.java
@@ -31,6 +31,19 @@ public class BootJavaElementPropertyTester extends PropertyTester {
if (je instanceof IJavaElement && "isInBootProjectWithDevTools".equals(property)) {
return hasBootDevTools((IJavaElement) je);
}
+ if (je instanceof IJavaElement && "isInBoot2Project".equals(property)) {
+ return isInBoot2Project((IJavaElement) je);
+ }
+ return false;
+ }
+
+ private boolean isInBoot2Project(IJavaElement je) {
+ if (je!=null) {
+ IJavaProject jp = je.getJavaProject();
+ if (jp!=null) {
+ return BootPropertyTester.isBoot2Project(jp.getProject());
+ }
+ }
return false;
}
diff --git a/eclipse-extensions/org.springframework.ide.eclipse.boot/src/org/springframework/ide/eclipse/boot/core/BootPropertyTester.java b/eclipse-extensions/org.springframework.ide.eclipse.boot/src/org/springframework/ide/eclipse/boot/core/BootPropertyTester.java
index 260da08ee..371597e15 100644
--- a/eclipse-extensions/org.springframework.ide.eclipse.boot/src/org/springframework/ide/eclipse/boot/core/BootPropertyTester.java
+++ b/eclipse-extensions/org.springframework.ide.eclipse.boot/src/org/springframework/ide/eclipse/boot/core/BootPropertyTester.java
@@ -70,6 +70,12 @@ public class BootPropertyTester extends PropertyTester {
if (rsrc instanceof IResource && "hasBootDevTools".equals(property)) {
return hasBootDevTools(((IResource) rsrc).getProject());
}
+ if (rsrc instanceof IProject && "isBoot2Project".equals(property)) {
+ return expectedValue.equals(isBoot2Project((IProject)rsrc));
+ }
+ if (rsrc instanceof IResource && "isBoot2Resource".equals(property)) {
+ return expectedValue.equals(isBoot2Resource((IResource) rsrc));
+ }
return false;
}
@@ -128,6 +134,30 @@ public class BootPropertyTester extends PropertyTester {
return false;
}
+ public static boolean isBoot2Project(IProject project) {
+ if (project==null || ! project.isAccessible()) {
+ return false;
+ }
+ try {
+ if (project.hasNature(JavaCore.NATURE_ID)) {
+ if (!isExcludedProject(project)) {
+ IJavaProject jp = JavaCore.create(project);
+ IClasspathEntry[] classpath = jp.getResolvedClasspath(true);
+ //Look for a 'spring-boot' jar or project entry
+
+ for (IClasspathEntry e : classpath) {
+ if ((isBootJar(e) || isBootProject(e)) && isVersion(e, "2.")) {
+ return true;
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ CorePlugin.log(e);
+ }
+ return false;
+ }
+
public static boolean hasBootDevTools(IProject project) {
try {
ISpringBootProject bootProject = SpringBootCore.getDefault().project(project);
@@ -231,6 +261,14 @@ public class BootPropertyTester extends PropertyTester {
return result;
}
+ private Object isBoot2Resource(IResource rsrc) {
+ if (rsrc==null || ! rsrc.isAccessible()) {
+ return false;
+ }
+ boolean result = isBoot2Project(rsrc.getProject());
+ return result;
+ }
+
public static boolean isBootProject(IClasspathEntry e) {
if (e.getEntryKind()==IClasspathEntry.CPE_PROJECT) {
IPath path = e.getPath();
@@ -240,6 +278,16 @@ public class BootPropertyTester extends PropertyTester {
return false;
}
+ public static boolean isVersion(IClasspathEntry e, String v) {
+ if (e.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
+ IPath path = e.getPath();
+ String name = path.lastSegment();
+ String version = getVersionFromJarName(name);
+ return version.startsWith(v);
+ }
+ return false;
+ }
+
public static boolean isBootJar(IClasspathEntry e) {
if (e.getEntryKind()==IClasspathEntry.CPE_LIBRARY) {
IPath path = e.getPath();
diff --git a/eclipse-language-servers/org.springframework.tooling.boot.ls/plugin.xml b/eclipse-language-servers/org.springframework.tooling.boot.ls/plugin.xml
index 504c33d20..44d3069bc 100644
--- a/eclipse-language-servers/org.springframework.tooling.boot.ls/plugin.xml
+++ b/eclipse-language-servers/org.springframework.tooling.boot.ls/plugin.xml
@@ -173,6 +173,10 @@
+
+
@@ -187,6 +191,12 @@
categoryId="org.springframework.ide.eclipse.commands"
name="Toggle Comment">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+