1 /*******************************************************************************
2 * Copyright (c) 2000, 2008 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * IBM Corporation - initial API and implementation
10 * Anton Leherbauer (Wind River Systems)
11 *******************************************************************************/
12 package org.eclipse.cdt.internal.ui.workingsets;
14 import java.util.ArrayList;
15 import java.util.List;
17 import org.eclipse.core.resources.IProject;
18 import org.eclipse.core.resources.IWorkspaceRoot;
20 import org.eclipse.cdt.core.model.CoreModel;
21 import org.eclipse.cdt.core.model.ICProject;
23 import org.eclipse.cdt.internal.ui.BaseCElementContentProvider;
25 class CElementWorkingSetPageContentProvider extends BaseCElementContentProvider {
28 * @see org.eclipse.cdt.internal.ui.BaseCElementContentProvider#getChildren(java.lang.Object)
31 public Object[] getChildren(Object element) {
32 if (element instanceof IWorkspaceRoot) {
33 IWorkspaceRoot root = (IWorkspaceRoot)element;
34 IProject[] projects = root.getProjects();
35 List<ICProject> list = new ArrayList<ICProject>(projects.length);
36 for (int i = 0; i < projects.length; i++) {
37 if (CoreModel.hasCNature(projects[i])) {
38 list.add(CoreModel.getDefault().create(projects[i]));
41 return list.toArray();
43 return super.getChildren(element);