KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > ui > classpath > ClasspathLabelProvider


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.jdt.internal.debug.ui.classpath;
12
13 import org.eclipse.debug.core.ILaunchConfiguration;
14 import org.eclipse.jdt.debug.ui.launchConfigurations.JavaClasspathTab;
15 import org.eclipse.jdt.internal.debug.ui.launcher.RuntimeClasspathEntryLabelProvider;
16 import org.eclipse.jface.viewers.IColorProvider;
17 import org.eclipse.jface.viewers.ILabelProvider;
18 import org.eclipse.jface.viewers.ILabelProviderListener;
19 import org.eclipse.swt.SWT;
20 import org.eclipse.swt.graphics.Color;
21 import org.eclipse.swt.graphics.Image;
22 import org.eclipse.swt.widgets.Display;
23
24 /**
25  * Label provider for classpath elements
26  */

27 public class ClasspathLabelProvider implements ILabelProvider, IColorProvider {
28     
29     private RuntimeClasspathEntryLabelProvider runtimeClasspathLabelProvider= new RuntimeClasspathEntryLabelProvider();
30
31     /* (non-Javadoc)
32      * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
33      */

34     public Image getImage(Object JavaDoc element) {
35         if (element instanceof ClasspathEntry) {
36             ClasspathEntry entry = (ClasspathEntry) element;
37             return runtimeClasspathLabelProvider.getImage(entry);
38         }
39         
40         return JavaClasspathTab.getClasspathImage();
41     }
42
43     /* (non-Javadoc)
44      * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
45      */

46     public String JavaDoc getText(Object JavaDoc element) {
47         if (element instanceof ClasspathEntry) {
48             ClasspathEntry entry = (ClasspathEntry) element;
49             return runtimeClasspathLabelProvider.getText(entry.getDelegate());
50         }
51         return element.toString();
52     }
53
54     /* (non-Javadoc)
55      * @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object)
56      */

57     public Color getBackground(Object JavaDoc element) {
58         if (element instanceof ClasspathGroup) {
59             Display display= Display.getCurrent();
60             return display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
61         } else if (element instanceof ClasspathEntry) {
62             
63         }
64         return null;
65     }
66
67     /* (non-Javadoc)
68      * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
69      */

70     public Color getForeground(Object JavaDoc element) {
71         return null;
72     }
73
74     /* (non-Javadoc)
75      * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
76      */

77     public void addListener(ILabelProviderListener listener) {
78     }
79
80     /* (non-Javadoc)
81      * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
82      */

83     public void dispose() {
84         runtimeClasspathLabelProvider.dispose();
85     }
86
87     /* (non-Javadoc)
88      * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
89      */

90     public boolean isLabelProperty(Object JavaDoc element, String JavaDoc property) {
91         return false;
92     }
93
94     /* (non-Javadoc)
95      * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
96      */

97     public void removeListener(ILabelProviderListener listener) {
98     }
99
100     /**
101      * @param configuration
102      */

103     public void setLaunchConfiguration(ILaunchConfiguration configuration) {
104         runtimeClasspathLabelProvider.setLaunchConfiguration(configuration);
105     }
106 }
107
Popular Tags