KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > sourcelookup > SourceContainerWorkbenchAdapter


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.debug.internal.ui.sourcelookup;
12
13 import java.io.File JavaDoc;
14
15 import org.eclipse.core.runtime.IPath;
16 import org.eclipse.core.runtime.Path;
17 import org.eclipse.debug.core.sourcelookup.containers.ArchiveSourceContainer;
18 import org.eclipse.debug.core.sourcelookup.containers.DirectorySourceContainer;
19 import org.eclipse.debug.core.sourcelookup.containers.ExternalArchiveSourceContainer;
20 import org.eclipse.debug.core.sourcelookup.containers.FolderSourceContainer;
21 import org.eclipse.jface.resource.ImageDescriptor;
22 import org.eclipse.ui.model.IWorkbenchAdapter;
23
24 /**
25  * Workbench adapter for standard source containers.
26  *
27  * @since 3.0
28  */

29 public class SourceContainerWorkbenchAdapter implements IWorkbenchAdapter {
30     /* (non-Javadoc)
31      * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
32      */

33     public Object JavaDoc[] getChildren(Object JavaDoc o) {
34         return null;
35     }
36     /* (non-Javadoc)
37      * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
38      */

39     public ImageDescriptor getImageDescriptor(Object JavaDoc object) {
40         return null;
41     }
42     /* (non-Javadoc)
43      * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
44      */

45     public String JavaDoc getLabel(Object JavaDoc o) {
46         if (o instanceof DirectorySourceContainer) {
47             DirectorySourceContainer container = (DirectorySourceContainer) o;
48             File JavaDoc file = container.getDirectory();
49             IPath path = new Path(file.getAbsolutePath());
50             return SourceElementWorkbenchAdapter.getQualifiedName(path);
51         }
52         if (o instanceof FolderSourceContainer) {
53             FolderSourceContainer container = (FolderSourceContainer) o;
54             return SourceElementWorkbenchAdapter.getQualifiedName(container.getContainer().getFullPath());
55         }
56         if (o instanceof ArchiveSourceContainer) {
57             ArchiveSourceContainer container = (ArchiveSourceContainer)o;
58             return SourceElementWorkbenchAdapter.getQualifiedName(container.getFile().getFullPath());
59         }
60         if (o instanceof ExternalArchiveSourceContainer) {
61             ExternalArchiveSourceContainer container = (ExternalArchiveSourceContainer)o;
62             IPath path = new Path(container.getName());
63             return SourceElementWorkbenchAdapter.getQualifiedName(path);
64         }
65         return ""; //$NON-NLS-1$
66
}
67     /* (non-Javadoc)
68      * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
69      */

70     public Object JavaDoc getParent(Object JavaDoc o) {
71         return null;
72     }
73 }
74
Popular Tags