Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Inglis2003-12-15 13:22:43 -0500
committerDavid Inglis2003-12-15 13:22:43 -0500
commit8c5882d03640b4f73f3c3656c0d146020d48e2c5 (patch)
tree644b1b1583e4bb0ca49c06f79827f8697eb8db37
parent9e74a89f051c0216a5e5805dcf40777119aa959e (diff)
downloadorg.eclipse.cdt-8c5882d03640b4f73f3c3656c0d146020d48e2c5.tar.gz
org.eclipse.cdt-8c5882d03640b4f73f3c3656c0d146020d48e2c5.tar.xz
org.eclipse.cdt-8c5882d03640b4f73f3c3656c0d146020d48e2c5.zip
Fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=48619
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DefaultCEditorTextHover.java93
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CParameterListValidator.java6
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/FunctionPrototypeSummary.java2
3 files changed, 47 insertions, 54 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DefaultCEditorTextHover.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DefaultCEditorTextHover.java
index e8057f45896..02f79870b98 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DefaultCEditorTextHover.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DefaultCEditorTextHover.java
@@ -5,24 +5,16 @@ package org.eclipse.cdt.internal.ui.editor;
* All Rights Reserved.
*/
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.cdt.internal.ui.CCompletionContributorManager;
+import org.eclipse.cdt.internal.ui.text.CWordFinder;
+import org.eclipse.cdt.internal.ui.text.HTMLPrinter;
+import org.eclipse.cdt.ui.IFunctionSummary;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextHover;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.Region;
import org.eclipse.swt.graphics.Point;
-import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-
-
-import org.eclipse.cdt.internal.ui.CCompletionContributorManager;
-import org.eclipse.cdt.internal.ui.text.CWordFinder;
-import org.eclipse.cdt.internal.ui.text.HTMLPrinter;
-import org.eclipse.cdt.ui.IFunctionSummary;
public class DefaultCEditorTextHover implements ITextHover
{
@@ -41,31 +33,32 @@ public class DefaultCEditorTextHover implements ITextHover
*/
public String getHoverInfo( ITextViewer viewer, IRegion region )
{
-// String expression = null;
-//
-// if(fEditor == null)
-// return null;
-// try
-// {
-// expression = viewer.getDocument().get( region.getOffset(), region.getLength() );
-// expression = expression.trim();
-// if ( expression.length() == 0 )
-// return null;
-//
-// StringBuffer buffer = new StringBuffer();
-//
-// // We are just doing some C, call the Help to get info
-//
-// IFunctionSummary fs = CCompletionContributorManager.getDefault().getFunctionInfo(expression);
-// if(fs != null) {
-// buffer.append("<b>");
-// buffer.append(HTMLPrinter.convertToHTMLContent(fs.getName()));
-// buffer.append("()</b>");
-// buffer.append(HTMLPrinter.convertToHTMLContent(fs.getPrototype().getPrototypeString(false)));
-// if(fs.getDescription() != null) {
-// buffer.append("<br><br>");
-// buffer.append(HTMLPrinter.convertToHTMLContent(fs.getDescription()));
-// }
+ String expression = null;
+
+ if(fEditor == null)
+ return null;
+ try
+ {
+ expression = viewer.getDocument().get( region.getOffset(), region.getLength() );
+ expression = expression.trim();
+ if ( expression.length() == 0 )
+ return null;
+
+ StringBuffer buffer = new StringBuffer();
+
+ // We are just doing some C, call the Help to get info
+
+ IFunctionSummary fs = CCompletionContributorManager.getDefault().getFunctionInfo(expression);
+ if(fs != null) {
+ buffer.append("<b>Name:</b> ");
+ buffer.append(HTMLPrinter.convertToHTMLContent(fs.getName()));
+ buffer.append("<br><b>Protoype:</b> ");
+ buffer.append(HTMLPrinter.convertToHTMLContent(fs.getPrototype().getPrototypeString(false)));
+ if(fs.getDescription() != null) {
+ buffer.append("<br><b>Description:</b><br>");
+ //Don't convert this description since it could already be formatted
+ buffer.append(fs.getDescription());
+ }
// int i;
// for(i = 0; i < buffer.length(); i++) {
// if(buffer.charAt(i) == '\\') {
@@ -74,7 +67,8 @@ public class DefaultCEditorTextHover implements ITextHover
// }
// }
// }
-// } else {
+ }
+// else {
// // Query the C model
// IndexModel model = IndexModel.getDefault();
// IEditorInput input = fEditor.getEditorInput();
@@ -109,20 +103,15 @@ public class DefaultCEditorTextHover implements ITextHover
// }
// }
// }
-// if (buffer.length() > 0) {
-// HTMLPrinter.insertPageProlog(buffer, 0);
-// HTMLPrinter.addPageEpilog(buffer);
-// return buffer.toString();
-// }
-// }
-// catch( BadLocationException x )
-// {
-// // ignore
-// }
-// catch( CoreException x )
-// {
-// // ignore
-// }
+ if (buffer.length() > 0) {
+ HTMLPrinter.insertPageProlog(buffer, 0);
+ HTMLPrinter.addPageEpilog(buffer);
+ return buffer.toString();
+ }
+ } catch(Exception ex) {
+ /* Ignore */
+ }
+
return null;
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CParameterListValidator.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CParameterListValidator.java
index dc37c219d0b..71dd825e4b7 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CParameterListValidator.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CParameterListValidator.java
@@ -177,8 +177,12 @@ public class CParameterListValidator implements IContextInformationValidator, IC
presentation.clear();
fCurrentParameter= currentParameter;
- String s= fInformation.getInformationDisplayString().trim();
+ //Don't presume what has been done to the string, rather use as is
+ String s= fInformation.getInformationDisplayString();
+ //@@@ This is obviously going to have problems with functions such
+ //int myfunction(int (*function_argument)(void * extra, int param), void * extra)
+ //int myfunction(/*A comment, indeed */int a);
int start= 0;
int occurrences= 0;
while (occurrences < fCurrentParameter) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/FunctionPrototypeSummary.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/FunctionPrototypeSummary.java
index 2719d367a72..2bd5685a276 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/FunctionPrototypeSummary.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/FunctionPrototypeSummary.java
@@ -73,7 +73,7 @@ public class FunctionPrototypeSummary implements IFunctionSummary.IFunctionProto
public String getPrototypeString(boolean namefirst) {
StringBuffer buffer = new StringBuffer();
if(!namefirst) {
- buffer.append(getArguments());
+ buffer.append(getReturnType());
buffer.append(" ");
}
buffer.append(getName());

Back to the top