mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Content Assist work: Bug fixing
This commit is contained in:
parent
4ae8242ff6
commit
4ce12b38ca
4 changed files with 45 additions and 2 deletions
|
@ -1,3 +1,6 @@
|
|||
2003-12-31 Hoda Amer
|
||||
- Changed ASTUtil.getType to include parameter initializer clause in returned string.
|
||||
|
||||
2003-12-22 Hoda Amer
|
||||
Content Assist Work : Returned the results size of the IASTNode lookup
|
||||
to help in determining the scope relevance
|
||||
|
|
|
@ -18,7 +18,9 @@ import org.eclipse.cdt.core.parser.ast.ASTClassKind;
|
|||
import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTExpression;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTFunction;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
|
||||
|
@ -89,9 +91,27 @@ public class ASTUtil {
|
|||
type.append(getArrayQualifiers(declaration));
|
||||
|
||||
type.append(getPointerToFunctionType(declaration));
|
||||
if (declaration instanceof IASTParameterDeclaration)
|
||||
type.append(getInitializerClause((IASTParameterDeclaration)declaration));
|
||||
return type.toString();
|
||||
}
|
||||
|
||||
public static String getInitializerClause(IASTParameterDeclaration declaration){
|
||||
StringBuffer initializer = new StringBuffer();
|
||||
if(declaration != null){
|
||||
IASTInitializerClause clause = declaration.getDefaultValue();
|
||||
if(clause != null){
|
||||
IASTExpression expression = clause.getAssigmentExpression();
|
||||
if(expression != null){
|
||||
String literal = expression.getLiteralString();
|
||||
if(literal.length() > 0)
|
||||
initializer.append("=");
|
||||
initializer.append(literal);
|
||||
}
|
||||
}
|
||||
}
|
||||
return initializer.toString();
|
||||
}
|
||||
public static String getPointerToFunctionType(IASTAbstractDeclaration declaration){
|
||||
StringBuffer type = new StringBuffer();
|
||||
ASTPointerOperator po = declaration.getPointerToFunctionOperator();
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
2003-12-20 Hoda Amer
|
||||
2003-12-31 Hoda Amer
|
||||
Displayed "No Completions Found" message in status bar
|
||||
|
||||
2003-12-30 Hoda Amer
|
||||
- Fix for bug#44359: Content Assist: foo(void) does not require args to be filled
|
||||
- Fix for bug#44378: Content Assist: easy keyboard exit of argument-providing mode
|
||||
|
||||
|
|
|
@ -85,6 +85,7 @@ import org.eclipse.ui.texteditor.ContentAssistAction;
|
|||
import org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess;
|
||||
import org.eclipse.ui.texteditor.DefaultRangeIndicator;
|
||||
import org.eclipse.ui.texteditor.ExtendedTextEditorPreferenceConstants;
|
||||
import org.eclipse.ui.texteditor.IEditorStatusLine;
|
||||
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
|
||||
import org.eclipse.ui.texteditor.MarkerAnnotation;
|
||||
import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
|
||||
|
@ -763,7 +764,12 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
|||
if (getTextWidget() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (operation) {
|
||||
case CONTENTASSIST_PROPOSALS:
|
||||
String msg= fContentAssistant.showPossibleCompletions();
|
||||
setStatusLineErrorMessage(msg);
|
||||
return;
|
||||
}
|
||||
super.doOperation(operation);
|
||||
}
|
||||
|
||||
|
@ -921,4 +927,15 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
|||
sourceViewer.invalidateTextPresentation();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the given message as error message to this editor's status line.
|
||||
*
|
||||
* @param msg message to be set
|
||||
*/
|
||||
protected void setStatusLineErrorMessage(String msg) {
|
||||
IEditorStatusLine statusLine= (IEditorStatusLine) getAdapter(IEditorStatusLine.class);
|
||||
if (statusLine != null)
|
||||
statusLine.setMessage(true, msg, null);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue