11/*******************************************************************************
2- * Copyright (c) 2022, 2024 VMware Inc. and others.
2+ * Copyright (c) 2022, 2025 VMware Inc. and others.
33 * This program and the accompanying materials are made
44 * available under the terms of the Eclipse Public License 2.0
55 * which is available at https://www.eclipse.org/legal/epl-2.0/
1818
1919import org .eclipse .core .runtime .FileLocator ;
2020import org .eclipse .core .runtime .IProgressMonitor ;
21+ import org .eclipse .jdt .annotation .NonNull ;
2122import org .eclipse .jdt .annotation .Nullable ;
2223import org .eclipse .jdt .internal .codeassist .RelevanceConstants ;
2324import org .eclipse .jdt .internal .ui .text .java .AbstractJavaCompletionProposal ;
24- import org .eclipse .jdt .internal .ui .text .java .hover .JavadocBrowserInformationControlInput ;
2525import org .eclipse .jdt .internal .ui .text .java .hover .JavadocHover ;
2626import org .eclipse .jdt .ui .PreferenceConstants ;
2727import org .eclipse .jdt .ui .text .java .IJavaCompletionProposal ;
28- import org .eclipse .jface .internal .text .html .BrowserInformationControl ;
2928import org .eclipse .jface .internal .text .html .HTMLPrinter ;
3029import org .eclipse .jface .resource .ColorRegistry ;
3130import org .eclipse .jface .resource .JFaceResources ;
3231import org .eclipse .jface .text .IInformationControlCreator ;
3332import org .eclipse .lsp4e .LanguageServerPlugin ;
3433import org .eclipse .lsp4e .operations .completion .LSCompletionProposal ;
35- import org .eclipse .lsp4e .ui .UI ;
3634import org .eclipse .swt .graphics .FontData ;
3735import org .eclipse .swt .graphics .RGB ;
38- import org .eclipse .swt .widgets .Shell ;
39- import org .eclipse .ui .IWorkbenchPart ;
4036import org .osgi .framework .Bundle ;
4137import org .osgi .framework .FrameworkUtil ;
4238
@@ -98,21 +94,10 @@ private int computeBaseRelevance() {
9894 return base ;
9995 }
10096
101- /*
102- * Copied from org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal.getInformationControlCreator()
103- */
10497 @ Override
10598 public @ Nullable IInformationControlCreator getInformationControlCreator () {
106- Shell shell = UI .getActiveShell ();
107- if (shell == null || !BrowserInformationControl .isAvailable (shell ))
108- return null ;
109-
11099 if (infoControlCreator == null ) {
111- /*
112- * see https://bugs.eclipse.org/bugs/show_bug.cgi?id=232024
113- */
114- IWorkbenchPart part = UI .getActivePart ();
115- JavadocHover .PresenterControlCreator presenterControlCreator = new JavadocHover .PresenterControlCreator (part == null ? null : part .getSite ());
100+ IInformationControlCreator presenterControlCreator = super .getInformationControlCreator ();
116101 infoControlCreator = new JavadocHover .HoverControlCreator (presenterControlCreator , true );
117102 }
118103 return infoControlCreator ;
@@ -129,10 +114,14 @@ public Object getAdditionalProposalInfo(IProgressMonitor monitor) {
129114 RGB bgRGB = registry .getRGB ("org.eclipse.jdt.ui.Javadoc.backgroundColor" ); //$NON-NLS-1$
130115 HTMLPrinter .insertPageProlog (buffer , 0 , fgRGB , bgRGB , getCSSStyles ());
131116 HTMLPrinter .addPageEpilog (buffer );
132- return new JavadocBrowserInformationControlInput (null , null , buffer .toString (), 0 );
133-
117+ return buffer .toString ();
134118 }
135119
120+ @ Override
121+ public @ NonNull String getInformationDisplayString () {
122+ return item .getLabel ();
123+ }
124+
136125 /**
137126 * Returns the style information for displaying HTML (Javadoc) content.
138127 * Copied from org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal.getCSSStyles()
0 commit comments