1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00
David Inglis 2003-12-15 18:28:51 +00:00
parent 15c39a3ed3
commit 1148b378c8
4 changed files with 52 additions and 54 deletions

View file

@ -1,3 +1,8 @@
2003-12-15 Thomas Fletcher
Re-activate the hover help based on the function summary extension point.
Fix a bug in the FunctionSummary class which displayed arguments as
the return value for functions.
2003-12-11 John Camelon 2003-12-11 John Camelon
Updated CompletionEngine to deal with new signatures/exceptions in parser. Updated CompletionEngine to deal with new signatures/exceptions in parser.

View file

@ -5,24 +5,16 @@ package org.eclipse.cdt.internal.ui.editor;
* All Rights Reserved. * All Rights Reserved.
*/ */
import org.eclipse.core.resources.IProject; import org.eclipse.cdt.internal.ui.CCompletionContributorManager;
import org.eclipse.core.runtime.CoreException; import org.eclipse.cdt.internal.ui.text.CWordFinder;
import org.eclipse.core.runtime.Status; import org.eclipse.cdt.internal.ui.text.HTMLPrinter;
import org.eclipse.jface.text.BadLocationException; import org.eclipse.cdt.ui.IFunctionSummary;
import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextHover; import org.eclipse.jface.text.ITextHover;
import org.eclipse.jface.text.ITextViewer; import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.Region; import org.eclipse.jface.text.Region;
import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Point;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart; 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 public class DefaultCEditorTextHover implements ITextHover
{ {
@ -41,31 +33,32 @@ public class DefaultCEditorTextHover implements ITextHover
*/ */
public String getHoverInfo( ITextViewer viewer, IRegion region ) public String getHoverInfo( ITextViewer viewer, IRegion region )
{ {
// String expression = null; String expression = null;
//
// if(fEditor == null) if(fEditor == null)
// return null; return null;
// try try
// { {
// expression = viewer.getDocument().get( region.getOffset(), region.getLength() ); expression = viewer.getDocument().get( region.getOffset(), region.getLength() );
// expression = expression.trim(); expression = expression.trim();
// if ( expression.length() == 0 ) if ( expression.length() == 0 )
// return null; return null;
//
// StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
//
// // We are just doing some C, call the Help to get info // We are just doing some C, call the Help to get info
//
// IFunctionSummary fs = CCompletionContributorManager.getDefault().getFunctionInfo(expression); IFunctionSummary fs = CCompletionContributorManager.getDefault().getFunctionInfo(expression);
// if(fs != null) { if(fs != null) {
// buffer.append("<b>"); buffer.append("<b>Name:</b> ");
// buffer.append(HTMLPrinter.convertToHTMLContent(fs.getName())); buffer.append(HTMLPrinter.convertToHTMLContent(fs.getName()));
// buffer.append("()</b>"); buffer.append("<br><b>Protoype:</b> ");
// buffer.append(HTMLPrinter.convertToHTMLContent(fs.getPrototype().getPrototypeString(false))); buffer.append(HTMLPrinter.convertToHTMLContent(fs.getPrototype().getPrototypeString(false)));
// if(fs.getDescription() != null) { if(fs.getDescription() != null) {
// buffer.append("<br><br>"); buffer.append("<br><b>Description:</b><br>");
// buffer.append(HTMLPrinter.convertToHTMLContent(fs.getDescription())); //Don't convert this description since it could already be formatted
// } buffer.append(fs.getDescription());
}
// int i; // int i;
// for(i = 0; i < buffer.length(); i++) { // for(i = 0; i < buffer.length(); i++) {
// if(buffer.charAt(i) == '\\') { // if(buffer.charAt(i) == '\\') {
@ -74,7 +67,8 @@ public class DefaultCEditorTextHover implements ITextHover
// } // }
// } // }
// } // }
// } else { }
// else {
// // Query the C model // // Query the C model
// IndexModel model = IndexModel.getDefault(); // IndexModel model = IndexModel.getDefault();
// IEditorInput input = fEditor.getEditorInput(); // IEditorInput input = fEditor.getEditorInput();
@ -109,20 +103,15 @@ public class DefaultCEditorTextHover implements ITextHover
// } // }
// } // }
// } // }
// if (buffer.length() > 0) { if (buffer.length() > 0) {
// HTMLPrinter.insertPageProlog(buffer, 0); HTMLPrinter.insertPageProlog(buffer, 0);
// HTMLPrinter.addPageEpilog(buffer); HTMLPrinter.addPageEpilog(buffer);
// return buffer.toString(); return buffer.toString();
// } }
// } } catch(Exception ex) {
// catch( BadLocationException x ) /* Ignore */
// { }
// // ignore
// }
// catch( CoreException x )
// {
// // ignore
// }
return null; return null;
} }

View file

@ -177,8 +177,12 @@ public class CParameterListValidator implements IContextInformationValidator, IC
presentation.clear(); presentation.clear();
fCurrentParameter= currentParameter; 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 start= 0;
int occurrences= 0; int occurrences= 0;
while (occurrences < fCurrentParameter) { while (occurrences < fCurrentParameter) {

View file

@ -73,7 +73,7 @@ public class FunctionPrototypeSummary implements IFunctionSummary.IFunctionProto
public String getPrototypeString(boolean namefirst) { public String getPrototypeString(boolean namefirst) {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
if(!namefirst) { if(!namefirst) {
buffer.append(getArguments()); buffer.append(getReturnType());
buffer.append(" "); buffer.append(" ");
} }
buffer.append(getName()); buffer.append(getName());