1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 235117 - [Editor] using F2 on a selection opens a hover containing 'null'

This commit is contained in:
Anton Leherbauer 2008-10-08 15:00:38 +00:00
parent 7a212506c0
commit 3f17f6cdbd
2 changed files with 12 additions and 4 deletions

View file

@ -19,6 +19,7 @@ import org.eclipse.jface.text.IInformationControlCreator;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.information.IInformationProvider;
import org.eclipse.jface.text.information.IInformationProviderExtension;
import org.eclipse.jface.text.information.IInformationProviderExtension2;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
@ -33,7 +34,7 @@ import org.eclipse.ui.IWorkbenchWindow;
* @see CTypeHover
* @since 5.0
*/
public class CInformationProvider implements IInformationProvider, IInformationProviderExtension2 {
public class CInformationProvider implements IInformationProvider, IInformationProviderExtension, IInformationProviderExtension2 {
/**
* Default control creator.
@ -124,6 +125,9 @@ public class CInformationProvider implements IInformationProvider, IInformationP
* @see IInformationProviderExtension2#getInformationPresenterControlCreator()
*/
public IInformationControlCreator getInformationPresenterControlCreator() {
if (fImplementation != null) {
return ((IInformationProviderExtension2) fImplementation).getInformationPresenterControlCreator();
}
if (fPresenterControlCreator == null)
fPresenterControlCreator= new ControlCreator();
return fPresenterControlCreator;

View file

@ -16,7 +16,7 @@ import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextHoverExtension;
import org.eclipse.jface.text.ITextHoverExtension2;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.information.IInformationProviderExtension2;
import org.eclipse.ui.IEditorPart;
import org.eclipse.cdt.ui.text.c.hover.ICEditorTextHover;
@ -25,7 +25,7 @@ import org.eclipse.cdt.ui.text.c.hover.ICEditorTextHover;
* Aggregator of problem and doc hovers.
* @since 5.0
*/
public class CTypeHover implements ICEditorTextHover, ITextHoverExtension, ITextHoverExtension2 {
public class CTypeHover implements ICEditorTextHover, ITextHoverExtension, ITextHoverExtension2, IInformationProviderExtension2 {
private AbstractCEditorTextHover fProblemHover;
private AbstractCEditorTextHover fCDocHover;
@ -57,7 +57,11 @@ public class CTypeHover implements ICEditorTextHover, ITextHoverExtension, IText
* @see ITextHover#getHoverInfo(ITextViewer, IRegion)
*/
public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
return String.valueOf(getHoverInfo2(textViewer, hoverRegion));
Object info= getHoverInfo2(textViewer, hoverRegion);
if (info != null) {
return String.valueOf(info);
}
return null;
}
/*