small refactoring to make API of live hover watchdog a bit cleaner

This commit is contained in:
Martin Lippert
2018-08-22 10:02:04 +02:00
parent a186bc35a8
commit 88e8e65b45
2 changed files with 14 additions and 8 deletions

View File

@@ -158,7 +158,7 @@ public class BootJavaLanguageServerComponents implements LanguageServerComponent
// } else {
try {
liveHoverWatchdog.watchDocument(doc.getUri());
liveHoverWatchdog.update(doc.getUri(), null);
liveHoverWatchdog.update(doc.getUri());
} catch (Throwable t) {
log.error("", t);
}

View File

@@ -143,15 +143,21 @@ public class SpringLiveHoverWatchdog {
refreshEnablement();
}
public void update(String docURI, SpringBootApp[] runningBootApps) {
public void update(String docURI) {
try {
IJavaProject project = identifyProject(docURI);
SpringBootApp[] runningBootApps = RunningAppMatcher.getAllMatchingApps(runningAppProvider.getAllRunningSpringApps(), project).toArray(new SpringBootApp[0]);
update(docURI, runningBootApps);
}
catch (Exception e) {
logger.error("", e);
}
}
protected void update(String docURI, SpringBootApp[] runningBootApps) {
if (highlightsEnabled) {
try {
if (runningBootApps == null) {
IJavaProject project = identifyProject(docURI);
runningBootApps = RunningAppMatcher.getAllMatchingApps(runningAppProvider.getAllRunningSpringApps(), project).toArray(new SpringBootApp[0]);
}
boolean hasCurrentRunningBootApps = runningBootApps != null && runningBootApps.length > 0;
if (hasCurrentRunningBootApps) {
TextDocument doc = this.server.getTextDocumentService().get(docURI);