1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Do not show includes/libraries Container if they no children

This commit is contained in:
Alain Magloire 2004-06-05 01:36:01 +00:00
parent 00f6c5f146
commit 272ee95ac1
2 changed files with 27 additions and 21 deletions

View file

@ -84,26 +84,26 @@ public class CViewContentProvider extends CElementContentProvider {
extras = o;
}
}
try {
ILibraryReference[] libRefs = cproject.getLibraryReferences();
if (libRefs != null && libRefs.length > 0) {
Object[] o = new Object[] {new LibraryRefContainer(cproject)};
if (extras != null && extras.length > 0) {
extras = concatenate(extras, o);
} else {
extras = o;
}
LibraryRefContainer libRefCont = new LibraryRefContainer(cproject);
Object[] libRefs = libRefCont.getChildren(cproject);
if (libRefs != null && libRefs.length > 0) {
Object[] o = new Object[] {libRefCont};
if (extras != null && extras.length > 0) {
extras = concatenate(extras, o);
} else {
extras = o;
}
IIncludeReference[] incRefs = cproject.getIncludeReferences();
if (incRefs != null && incRefs.length > 0) {
Object[] o = new Object[] {new IncludeRefContainer(cproject)};
if (extras != null && extras.length > 0) {
extras = concatenate(extras, o);
} else {
extras = o;
}
}
IncludeRefContainer incRefCont = new IncludeRefContainer(cproject);
Object[] incRefs = incRefCont.getChildren(cproject);
if (incRefs != null && incRefs.length > 0) {
Object[] o = new Object[] {incRefCont};
if (extras != null && extras.length > 0) {
extras = concatenate(extras, o);
} else {
extras = o;
}
} catch (CModelException e) {
}
return extras;
}
@ -112,7 +112,7 @@ public class CViewContentProvider extends CElementContentProvider {
*/
public Object internalGetParent(Object element) {
// since we insert logical containers we have to fix
// up the parent for includereference so that they refer
// up the parent for {IInclude,ILibrary}Reference so that they refer
// to the container and containers refere to the project
Object parent = super.internalGetParent(element);
if (element instanceof IIncludeReference) {
@ -121,6 +121,12 @@ public class CViewContentProvider extends CElementContentProvider {
}
} else if (element instanceof IncludeRefContainer) {
parent = ((IncludeRefContainer)element).getCProject();
} if (element instanceof ILibraryReference) {
if (parent instanceof ICProject) {
parent = new LibraryRefContainer((ICProject)parent);
}
} else if (element instanceof LibraryRefContainer) {
parent = ((LibraryRefContainer)element).getCProject();
}
return parent;
}

View file

@ -391,7 +391,7 @@ public class CDocumentProvider extends TextFileDocumentProvider {
super(resource);
}
public void setCompilationUnit(ITranslationUnit unit) {
public void setTranslationUnit(ITranslationUnit unit) {
fTranslationUnit= unit;
}
@ -825,7 +825,7 @@ public class CDocumentProvider extends TextFileDocumentProvider {
if (tuInfo.fModel instanceof TranslationUnitAnnotationModel) {
TranslationUnitAnnotationModel model= (TranslationUnitAnnotationModel) tuInfo.fModel;
model.setCompilationUnit(tuInfo.fCopy);
model.setTranslationUnit(tuInfo.fCopy);
}
if (tuInfo.fModel != null)
tuInfo.fModel.addAnnotationModelListener(fGlobalAnnotationModelListener);