1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 08:55:25 +02:00

Fix some more outline view label and synchronization issues

This commit is contained in:
Anton Leherbauer 2006-12-13 16:10:24 +00:00
parent b1c047d23a
commit 52deae97f4
4 changed files with 26 additions and 8 deletions

View file

@ -521,6 +521,7 @@ public class ASTStringUtil {
appendQualifiedNameString(buffer, elaboratedTypeSpec.getName());
} else if (declSpecifier instanceof IASTEnumerationSpecifier) {
final IASTEnumerationSpecifier enumerationSpec= (IASTEnumerationSpecifier)declSpecifier;
buffer.append(Keywords.ENUM).append(' ');
appendQualifiedNameString(buffer, enumerationSpec.getName());
} else if (declSpecifier instanceof IASTSimpleDeclSpecifier) {
final IASTSimpleDeclSpecifier simpleDeclSpec= (IASTSimpleDeclSpecifier)declSpecifier;

View file

@ -218,6 +218,8 @@ public class CModelBuilder2 implements IContributedModelBuilder {
* @see org.eclipse.cdt.core.model.IContributedModelBuilder#parse(boolean)
*/
public void parse(boolean quickParseMode) throws Exception {
// always parse fast
quickParseMode= true;
IIndex index= CCorePlugin.getIndexManager().getIndex(fTranslationUnit.getCProject());
try {
if (index != null) {
@ -541,8 +543,7 @@ public class CModelBuilder2 implements IContributedModelBuilder {
}
}
}
final CElement compositeType= createCompositeType(parent, (IASTCompositeTypeSpecifier)declSpecifier, isTemplate);
return compositeType;
return createCompositeType(parent, (IASTCompositeTypeSpecifier)declSpecifier, isTemplate);
} else if (declSpecifier instanceof IASTElaboratedTypeSpecifier) {
if (declarator == null) {
return createElaboratedTypeDeclaration(parent, (IASTElaboratedTypeSpecifier)declSpecifier, isTemplate);
@ -550,6 +551,16 @@ public class CModelBuilder2 implements IContributedModelBuilder {
return createTypedefOrFunctionOrVariable(parent, declSpecifier, declarator, isTemplate);
}
} else if (declSpecifier instanceof IASTEnumerationSpecifier) {
if (declarator != null) {
// create type nested
CElement element= createTypedefOrFunctionOrVariable(parent, declSpecifier, declarator, isTemplate);
if (element instanceof IParent) {
parent= (Parent)element;
if (!isTemplate) {
setBodyPosition((SourceManipulation)element, declSpecifier.getParent());
}
}
}
return createEnumeration(parent, (IASTEnumerationSpecifier)declSpecifier);
} else if (declSpecifier instanceof IASTNamedTypeSpecifier) {
return createTypedefOrFunctionOrVariable(parent, declSpecifier, declarator, isTemplate);

View file

@ -1884,10 +1884,10 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IR
int caret= 0;
if (sourceViewer instanceof ITextViewerExtension5) {
ITextViewerExtension5 extension= (ITextViewerExtension5)sourceViewer;
caret= extension.widgetOffset2ModelOffset(styledText.getCaretOffset());
caret= extension.widgetOffset2ModelOffset(styledText.getSelection().x);
} else {
int offset= sourceViewer.getVisibleRegion().getOffset();
caret= offset + styledText.getCaretOffset();
caret= offset + styledText.getSelection().x;
}
ICElement element= getElementAt(caret, false);

View file

@ -533,8 +533,11 @@ public class CElementLabels {
}
if( getFlag( flags, M_APP_RETURNTYPE ) && func.exists()) {
buf.append( DECL_STRING );
buf.append( func.getReturnType() );
String typeName= func.getReturnType();
if (typeName != null && typeName.length() > 0) {
buf.append( DECL_STRING );
buf.append(typeName);
}
}
// post qualification
@ -573,8 +576,11 @@ public class CElementLabels {
buf.append( typedef.getElementName() );
if( getFlag( flags, F_APP_TYPE_SIGNATURE ) && typedef.exists()) {
buf.append( DECL_STRING );
buf.append( typedef.getTypeName() );
String typeName= typedef.getTypeName();
if (typeName != null && typeName.length() > 0) {
buf.append( DECL_STRING );
buf.append(typeName);
}
}
// post qualification