01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.internal.ide.model;
11:
12: import org.eclipse.core.resources.IContainer;
13: import org.eclipse.core.resources.IResource;
14: import org.eclipse.core.runtime.CoreException;
15: import org.eclipse.jface.resource.ImageDescriptor;
16: import org.eclipse.ui.ISharedImages;
17: import org.eclipse.ui.PlatformUI;
18:
19: /**
20: * An IWorkbenchAdapter that represents IFolders.
21: */
22: public class WorkbenchFolder extends WorkbenchResource {
23: /**
24: * Answer the appropriate base image to use for the passed resource, optionally
25: * considering the passed open status as well iff appropriate for the type of
26: * passed resource
27: */
28: protected ImageDescriptor getBaseImage(IResource resource) {
29: return PlatformUI.getWorkbench().getSharedImages()
30: .getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
31: }
32:
33: /**
34: * Returns the children of this container.
35: */
36: public Object[] getChildren(Object o) {
37: try {
38: return ((IContainer) o).members();
39: } catch (CoreException e) {
40: return NO_CHILDREN;
41: }
42: }
43: }
|