1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-29 11:55:40 +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()); appendQualifiedNameString(buffer, elaboratedTypeSpec.getName());
} else if (declSpecifier instanceof IASTEnumerationSpecifier) { } else if (declSpecifier instanceof IASTEnumerationSpecifier) {
final IASTEnumerationSpecifier enumerationSpec= (IASTEnumerationSpecifier)declSpecifier; final IASTEnumerationSpecifier enumerationSpec= (IASTEnumerationSpecifier)declSpecifier;
buffer.append(Keywords.ENUM).append(' ');
appendQualifiedNameString(buffer, enumerationSpec.getName()); appendQualifiedNameString(buffer, enumerationSpec.getName());
} else if (declSpecifier instanceof IASTSimpleDeclSpecifier) { } else if (declSpecifier instanceof IASTSimpleDeclSpecifier) {
final IASTSimpleDeclSpecifier simpleDeclSpec= (IASTSimpleDeclSpecifier)declSpecifier; 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) * @see org.eclipse.cdt.core.model.IContributedModelBuilder#parse(boolean)
*/ */
public void parse(boolean quickParseMode) throws Exception { public void parse(boolean quickParseMode) throws Exception {
// always parse fast
quickParseMode= true;
IIndex index= CCorePlugin.getIndexManager().getIndex(fTranslationUnit.getCProject()); IIndex index= CCorePlugin.getIndexManager().getIndex(fTranslationUnit.getCProject());
try { try {
if (index != null) { if (index != null) {
@ -541,8 +543,7 @@ public class CModelBuilder2 implements IContributedModelBuilder {
} }
} }
} }
final CElement compositeType= createCompositeType(parent, (IASTCompositeTypeSpecifier)declSpecifier, isTemplate); return createCompositeType(parent, (IASTCompositeTypeSpecifier)declSpecifier, isTemplate);
return compositeType;
} else if (declSpecifier instanceof IASTElaboratedTypeSpecifier) { } else if (declSpecifier instanceof IASTElaboratedTypeSpecifier) {
if (declarator == null) { if (declarator == null) {
return createElaboratedTypeDeclaration(parent, (IASTElaboratedTypeSpecifier)declSpecifier, isTemplate); return createElaboratedTypeDeclaration(parent, (IASTElaboratedTypeSpecifier)declSpecifier, isTemplate);
@ -550,6 +551,16 @@ public class CModelBuilder2 implements IContributedModelBuilder {
return createTypedefOrFunctionOrVariable(parent, declSpecifier, declarator, isTemplate); return createTypedefOrFunctionOrVariable(parent, declSpecifier, declarator, isTemplate);
} }
} else if (declSpecifier instanceof IASTEnumerationSpecifier) { } 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); return createEnumeration(parent, (IASTEnumerationSpecifier)declSpecifier);
} else if (declSpecifier instanceof IASTNamedTypeSpecifier) { } else if (declSpecifier instanceof IASTNamedTypeSpecifier) {
return createTypedefOrFunctionOrVariable(parent, declSpecifier, declarator, isTemplate); return createTypedefOrFunctionOrVariable(parent, declSpecifier, declarator, isTemplate);

View file

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

View file

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