1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-10 03:53:21 +02:00

Bug 447622: Display better message when information is missing

Change-Id: I9c908c53e88311fbdd067a1fbfe61de62ef04ae0
This commit is contained in:
Jonah Graham 2019-12-30 16:38:01 -05:00
parent 6da6e91cc1
commit caaeb7489d
3 changed files with 10 additions and 1 deletions

View file

@ -320,7 +320,14 @@ public class AbstractAnnotationHover extends AbstractCEditorTextHover {
StyledText text = new StyledText(composite, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY);
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
text.setLayoutData(data);
text.setText(annotation.getText());
String annotationText = annotation.getText();
if (annotationText == null) {
// This shouldn't happen, but it really does sometimes. See Bug 447622
// Therefore we have to provide a sensible fallback
text.setText(CHoverMessages.AbstractAnnotationHover_annotation_text_null_message);
} else {
text.setText(annotationText);
}
}
private void createCompletionProposalsControl(Composite parent, ICompletionProposal[] proposals) {

View file

@ -20,6 +20,7 @@ import org.eclipse.osgi.util.NLS;
public final class CHoverMessages extends NLS {
public static String AbstractAnnotationHover_action_configureAnnotationPreferences;
public static String AbstractAnnotationHover_annotation_text_null_message;
public static String AbstractAnnotationHover_message_singleQuickFix;
public static String AbstractAnnotationHover_message_multipleQuickFix;

View file

@ -14,6 +14,7 @@
# Sergey Prigogin (Google)
###############################################################################
AbstractAnnotationHover_action_configureAnnotationPreferences= Configure Annotation Preferences
AbstractAnnotationHover_annotation_text_null_message=Additional information is not available for this annotation.
AbstractAnnotationHover_message_singleQuickFix= 1 quick fix available:
AbstractAnnotationHover_message_multipleQuickFix= {0} quick fixes available: