Use eclipse bundle logger rather than default

This commit is contained in:
aboyko
2023-02-27 20:38:20 -05:00
parent 2f743fe9a8
commit 75fcb63fd0
4 changed files with 14 additions and 9 deletions

View File

@@ -23,7 +23,7 @@ import org.springframework.tooling.jdt.ls.commons.classpath.ReusableClasspathLis
@SuppressWarnings("restriction")
public class ClasspathListenerHandler implements IDelegateCommandHandler {
private static final Logger logger = Logger.DEFAULT;
private static final Logger logger = Logger.forEclipsePlugin(() -> JdtLsExtensionPlugin.getInstance());
private static ReusableClasspathListenerHandler handlerImpl = checkSupported();
private static ReusableClasspathListenerHandler checkSupported() {
try {

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019 Pivotal, Inc.
* Copyright (c) 2019, 2023 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,7 +23,7 @@ import com.google.common.base.Suppliers;
@SuppressWarnings("restriction")
public class JavaHelpers {
private static final Logger logger = Logger.DEFAULT;
private static final Logger logger = Logger.forEclipsePlugin(() -> JdtLsExtensionPlugin.getInstance());
final public static Supplier<JavaData> DATA = Suppliers.memoize(() -> new JavaData(element -> HoverInfoProvider.computeSignature(element).getValue(), logger));

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2018, 2019 Pivotal, Inc.
* Copyright (c) 2018, 2023 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,13 +18,10 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.ls.core.internal.IDelegateCommandHandler;
import org.eclipse.jdt.ls.core.internal.javadoc.JavaElementLinks;
import org.springframework.tooling.jdt.ls.commons.Logger;
import org.springframework.tooling.jdt.ls.commons.java.JavaData;
public class JavadocHoverLinkHandler implements IDelegateCommandHandler {
private static final Logger logger = Logger.DEFAULT;
@Override
public Object executeCommand(String commandId, List<Object> arguments, IProgressMonitor monitor) throws Exception {
Map<String, Object> obj = (Map<String, Object>) arguments.get(0);
@@ -40,7 +37,7 @@ public class JavadocHoverLinkHandler implements IDelegateCommandHandler {
return JavaElementLinks.createURI(null, element).replace("(", "%28");
}
} catch (Exception e) {
logger.log(e);
JdtLsExtensionPlugin.getInstance().getLog().error("Failed to compute java data for " + bindingKey + " in project " + uri, e);
}
return null;
}

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2022 VMware, Inc.
* Copyright (c) 2022, 2023 VMware, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,9 +28,12 @@ import org.springframework.tooling.jdt.ls.commons.Logger;
public class JdtLsExtensionPlugin extends Plugin {
private boolean bootProjectPresent = false;
private static JdtLsExtensionPlugin instance = null;
@Override
public void start(BundleContext context) throws Exception {
instance = this;
super.start(context);
Logger logger = Logger.forEclipsePlugin(() -> this);
initializationFuture().thenAccept(v -> {
@@ -59,6 +62,7 @@ public class JdtLsExtensionPlugin extends Plugin {
@Override
public void stop(BundleContext context) throws Exception {
super.stop(context);
instance = null;
}
private CompletableFuture<Void> initializationFuture() {
@@ -97,5 +101,9 @@ public class JdtLsExtensionPlugin extends Plugin {
});
return initFuture;
}
static JdtLsExtensionPlugin getInstance() {
return instance;
}
}