1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 09:16:02 +02:00

Do not show the files in the workspace

This commit is contained in:
Alain Magloire 2004-04-30 04:08:23 +00:00
parent c421d5746a
commit 432ae76aa5
2 changed files with 30 additions and 2 deletions

View file

@ -11,10 +11,15 @@
package org.eclipse.cdt.internal.ui.cview;
import java.util.ArrayList;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.IIncludeReference;
import org.eclipse.cdt.internal.ui.CPluginImages;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.model.IWorkbenchAdapter;
@ -51,7 +56,16 @@ public class IncludeRefContainer implements IAdaptable, IWorkbenchAdapter{
*/
public Object[] getChildren(Object o) {
try {
return fCProject.getIncludeReferences();
IIncludeReference[] references = fCProject.getIncludeReferences();
ArrayList list = new ArrayList(references.length);
for (int i = 0; i < references.length; i++) {
IPath path = references[i].getPath();
IContainer container = references[i].getCModel().getWorkspace().getRoot().getContainerForLocation(path);
if (container == null || !container.isAccessible()) {
list.add(references[i]);
}
}
return list.toArray();
} catch (CModelException e) {
}
return EMPTY;

View file

@ -11,10 +11,15 @@
package org.eclipse.cdt.internal.ui.cview;
import java.util.ArrayList;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.ILibraryReference;
import org.eclipse.cdt.internal.ui.CPluginImages;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.model.IWorkbenchAdapter;
@ -51,7 +56,16 @@ public class LibraryRefContainer implements IAdaptable, IWorkbenchAdapter {
*/
public Object[] getChildren(Object o) {
try {
return fCProject.getLibraryReferences();
ILibraryReference[] references = fCProject.getLibraryReferences();
ArrayList list = new ArrayList(references.length);
for (int i = 0; i < references.length; i++) {
IPath path = references[i].getPath();
IFile file = references[i].getCModel().getWorkspace().getRoot().getFileForLocation(path);
if (file == null || !file.isAccessible()) {
list.add(references[i]);
}
}
return list.toArray();
} catch (CModelException e) {
}
return EMPTY;