|
20 | 20 | import java.lang.ref.WeakReference;
|
21 | 21 | import java.net.URI;
|
22 | 22 | import java.util.Map;
|
| 23 | +import java.util.concurrent.ExecutionException; |
23 | 24 | import java.util.function.Function;
|
| 25 | +import java.util.logging.Level; |
| 26 | +import java.util.logging.Logger; |
24 | 27 | import javax.tools.JavaFileObject;
|
25 | 28 | import javax.tools.SimpleJavaFileObject;
|
26 | 29 | import org.eclipse.lsp4j.services.LanguageClient;
|
|
38 | 41 | import org.openide.util.Lookup;
|
39 | 42 |
|
40 | 43 | class SourceInfo {
|
41 |
| - |
| 44 | + private static final Logger LOG = Logger.getLogger(SourceInfo.class.getName()); |
42 | 45 | private final FileObject file;
|
43 | 46 | private final Project owner;
|
44 | 47 | final JavaFileObject source;
|
@@ -108,10 +111,15 @@ public String getJavaVersion() {
|
108 | 111 | return LspServerTelemetryManager.getJavaRuntimeVersion(lookupFunction);
|
109 | 112 | }
|
110 | 113 |
|
111 |
| - public boolean getPreviewEnabled() { |
112 |
| - return LspServerTelemetryManager.getInstance().isPreviewEnabled(file, |
113 |
| - owner == null ? LspServerTelemetryManager.ProjectType.standalone : LspServerTelemetryManager.getInstance().getProjectType(owner), |
114 |
| - getLanguageClient()); |
| 114 | + public boolean getPreviewEnabled(){ |
| 115 | + try { |
| 116 | + return LspServerTelemetryManager.getInstance().isPreviewEnabled(file, |
| 117 | + owner, |
| 118 | + getLanguageClient()).get(); |
| 119 | + } catch (InterruptedException | ExecutionException ex) { |
| 120 | + LOG.log(Level.FINE, "exception while checking if preview enabled: {0}", (Object) ex); |
| 121 | + } |
| 122 | + return false; |
115 | 123 | }
|
116 | 124 |
|
117 | 125 | public static SourceInfo getSourceObject(ErrorProvider.Context context) {
|
|
0 commit comments