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

View file

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