diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/chelp/CHelpProviderTester.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/chelp/CHelpProviderTester.java
index d1ee03f2cad..d27cef82d13 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/chelp/CHelpProviderTester.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/chelp/CHelpProviderTester.java
@@ -111,6 +111,7 @@ public class CHelpProviderTester{
private String fPrototype = "Prototype";
private String fSummary = "Summary";
private String fSynopsis = "Synopsis";
+ private IRequiredInclude[] incs = new IRequiredInclude[] { new RequiredInclude("dummy.h")};
private class RequiredInclude implements IRequiredInclude {
private String include;
@@ -152,7 +153,7 @@ public class CHelpProviderTester{
public IFunctionPrototypeSummary getPrototype() { return new FunctionPrototypeSummary(); }
public IRequiredInclude[] getIncludes() {
- return (IRequiredInclude[])null;
+ return incs;
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorMessages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorMessages.properties
index 1b8d0c4845f..6f98159932f 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorMessages.properties
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorMessages.properties
@@ -114,8 +114,10 @@ AddIncludeOnSelectionAction.error.noInput=no Editor Input
DefaultCEditorTextHover.html.name=Name:
DefaultCEditorTextHover.html.prototype=
Prototype:
DefaultCEditorTextHover.html.description=
Description:
+DefaultCEditorTextHover.html.includes=
Referring Includes:
CContentOutlinePage.menu.fileSearch=File Search
CContentOutlinePage.error.noInput=no Editor Input
+CDocHover.0=Referring Includes:
CEditor.menu.fileSearch=File Search
CEditor.menu.search=Search
CEditor.menu.folding=F&olding
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/HTMLPrinter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/HTMLPrinter.java
index e07049e7286..f1bb39e6428 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/HTMLPrinter.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/HTMLPrinter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000 2005 IBM Corporation and others.
+ * Copyright (c) 2000 2008 IBM Corporation and others.
* 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
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* QNX Software System
+ * Intel corp.
*******************************************************************************/
package org.eclipse.cdt.internal.ui.text;
@@ -19,7 +20,12 @@ import java.io.Reader;
* Provides a set of convenience methods for creating HTML pages.
*/
public class HTMLPrinter {
-
+
+ private static final String LB = "<"; //$NON-NLS-1$
+ private static final String CB = ""; //$NON-NLS-1$
+ private static final String RB = ">"; //$NON-NLS-1$
+
+
private HTMLPrinter() {
}
@@ -31,7 +37,7 @@ public class HTMLPrinter {
if (current == -1)
return text;
- StringBuffer buffer= new StringBuffer();
+ StringBuilder buffer= new StringBuilder();
while (current > -1) {
buffer.append(text.substring(previous, current));
buffer.append(s);
@@ -50,7 +56,7 @@ public class HTMLPrinter {
public static String read(Reader rd) {
- StringBuffer buffer= new StringBuffer();
+ StringBuilder buffer= new StringBuilder();
char[] readBuffer= new char[2048];
try {
@@ -70,47 +76,104 @@ public class HTMLPrinter {
buffer.insert(position, "
"); //$NON-NLS-1$ buffer.append(paragraph); } } - + + public static void addParagraph(StringBuilder buffer, String paragraph) { + if (paragraph != null) { + buffer.append("
"); //$NON-NLS-1$
+ buffer.append(paragraph);
+ }
+ }
+
public static void addParagraph(StringBuffer buffer, Reader paragraphReader) {
if (paragraphReader != null)
addParagraph(buffer, read(paragraphReader));
}
+
+ public static void addParagraph(StringBuilder buffer, Reader paragraphReader) {
+ if (paragraphReader != null)
+ addParagraph(buffer, read(paragraphReader));
+ }
+
}
\ No newline at end of file
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CDocHover.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CDocHover.java
index 325535f58a3..05600e19a7e 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CDocHover.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CDocHover.java
@@ -12,15 +12,6 @@
package org.eclipse.cdt.internal.ui.text.c.hover;
-import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.cdt.internal.ui.CHelpProviderManager;
-import org.eclipse.cdt.internal.ui.editor.CEditorMessages;
-import org.eclipse.cdt.internal.ui.text.CWordFinder;
-import org.eclipse.cdt.internal.ui.text.HTMLPrinter;
-import org.eclipse.cdt.ui.CUIPlugin;
-import org.eclipse.cdt.ui.IFunctionSummary;
-import org.eclipse.cdt.ui.IFunctionSummary.IFunctionPrototypeSummary;
-import org.eclipse.cdt.ui.text.ICHelpInvocationContext;
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
@@ -28,6 +19,18 @@ import org.eclipse.jface.text.Region;
import org.eclipse.swt.graphics.Point;
import org.eclipse.ui.IEditorInput;
+import org.eclipse.cdt.core.model.ITranslationUnit;
+import org.eclipse.cdt.ui.CUIPlugin;
+import org.eclipse.cdt.ui.IFunctionSummary;
+import org.eclipse.cdt.ui.IRequiredInclude;
+import org.eclipse.cdt.ui.IFunctionSummary.IFunctionPrototypeSummary;
+import org.eclipse.cdt.ui.text.ICHelpInvocationContext;
+
+import org.eclipse.cdt.internal.ui.CHelpProviderManager;
+import org.eclipse.cdt.internal.ui.editor.CEditorMessages;
+import org.eclipse.cdt.internal.ui.text.CWordFinder;
+import org.eclipse.cdt.internal.ui.text.HTMLPrinter;
+
public class CDocHover extends AbstractCEditorTextHover {
/**
@@ -50,7 +53,7 @@ public class CDocHover extends AbstractCEditorTextHover {
if (expression.length() == 0)
return null;
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
// call the Help to get info
@@ -84,6 +87,19 @@ public class CDocHover extends AbstractCEditorTextHover {
//Don't convert this description since it could already be formatted
buffer.append(fs.getDescription());
}
+ IRequiredInclude[] incs = fs.getIncludes();
+ if (incs != null && incs.length > 0) {
+ buffer.append(CEditorMessages.getString("DefaultCEditorTextHover.html.includes")); //$NON-NLS-1$
+ int count = 0;
+ for (IRequiredInclude inc : incs) {
+ buffer.append(inc.getIncludeName());
+ buffer.append("
"); //$NON-NLS-1$
+ if (count++ > 4) {
+ buffer.append("...
"); //$NON-NLS-1$
+ break; // too long list: do not display all
+ }
+ }
+ }
}
if (buffer.length() > 0) {
HTMLPrinter.insertPageProlog(buffer, 0);