mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
This commit is contained in:
parent
15c39a3ed3
commit
1148b378c8
4 changed files with 52 additions and 54 deletions
|
@ -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
|
||||
Updated CompletionEngine to deal with new signatures/exceptions in parser.
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Add table
Reference in a new issue