Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Magloire2004-06-05 01:36:01 +0000
committerAlain Magloire2004-06-05 01:36:01 +0000
commit272ee95ac1f2062bbf0ce79b1848bef380c86ea3 (patch)
tree105156676c9bb074542c889223a4738f537e4d6b
parent00f6c5f14639291b35362b44697dc7d7067c776e (diff)
downloadorg.eclipse.cdt-272ee95ac1f2062bbf0ce79b1848bef380c86ea3.tar.gz
org.eclipse.cdt-272ee95ac1f2062bbf0ce79b1848bef380c86ea3.tar.xz
org.eclipse.cdt-272ee95ac1f2062bbf0ce79b1848bef380c86ea3.zip
Do not show includes/libraries Container if they no children
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewContentProvider.java44
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java4
2 files changed, 27 insertions, 21 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewContentProvider.java
index bfc24ea985e..ba7ce8ed1dc 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewContentProvider.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewContentProvider.java
@@ -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;
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java
index 8542ebe752d..8c5dd27ef5e 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java
@@ -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);

Back to the top