KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > ui > threadgroups > JavaThreadGroupLabelAdapter


1 /*******************************************************************************
2  * Copyright (c) 2006 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.threadgroups;
12
13 import com.ibm.icu.text.MessageFormat;
14
15 import org.eclipse.core.runtime.CoreException;
16 import org.eclipse.debug.internal.ui.viewers.provisional.AsynchronousLabelAdapter;
17 import org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext;
18 import org.eclipse.jdt.debug.core.IJavaThreadGroup;
19 import org.eclipse.jdt.internal.debug.ui.JavaDebugImages;
20 import org.eclipse.jface.resource.ImageDescriptor;
21 import org.eclipse.swt.graphics.FontData;
22 import org.eclipse.swt.graphics.RGB;
23
24 /**
25  * Label adapter for thread group.
26  *
27  * @since 3.2
28  */

29 public class JavaThreadGroupLabelAdapter extends AsynchronousLabelAdapter {
30     
31     private static ImageDescriptor[] image = new ImageDescriptor[]{JavaDebugImages.getImageDescriptor(JavaDebugImages.IMG_OBJS_THREAD_GROUP)};
32
33     /* (non-Javadoc)
34      * @see org.eclipse.debug.internal.ui.viewers.AsynchronousLabelAdapter#getLabels(java.lang.Object, org.eclipse.debug.internal.ui.viewers.IPresentationContext)
35      */

36     protected String JavaDoc[] getLabels(Object JavaDoc element, IPresentationContext context) throws CoreException {
37         if (element instanceof IJavaThreadGroup) {
38             IJavaThreadGroup group = (IJavaThreadGroup) element;
39             return new String JavaDoc[]{MessageFormat.format(ThreadGroupMessages.AsyncThreadGroupLabelAdapter_0, new String JavaDoc[]{group.getName()})};
40         }
41         return new String JavaDoc[]{""}; //$NON-NLS-1$
42
}
43
44     /* (non-Javadoc)
45      * @see org.eclipse.debug.internal.ui.viewers.AsynchronousLabelAdapter#getImageDescriptors(java.lang.Object, org.eclipse.debug.internal.ui.viewers.IPresentationContext)
46      */

47     protected ImageDescriptor[] getImageDescriptors(Object JavaDoc element, IPresentationContext context) throws CoreException {
48         return image;
49     }
50
51     /* (non-Javadoc)
52      * @see org.eclipse.debug.internal.ui.viewers.AsynchronousLabelAdapter#getFontDatas(java.lang.Object, org.eclipse.debug.internal.ui.viewers.IPresentationContext)
53      */

54     protected FontData[] getFontDatas(Object JavaDoc element, IPresentationContext context) throws CoreException {
55         return null;
56     }
57
58     /* (non-Javadoc)
59      * @see org.eclipse.debug.internal.ui.viewers.AsynchronousLabelAdapter#getForegrounds(java.lang.Object, org.eclipse.debug.internal.ui.viewers.IPresentationContext)
60      */

61     protected RGB[] getForegrounds(Object JavaDoc element, IPresentationContext context) throws CoreException {
62         return null;
63     }
64
65     /* (non-Javadoc)
66      * @see org.eclipse.debug.internal.ui.viewers.AsynchronousLabelAdapter#getBackgrounds(java.lang.Object, org.eclipse.debug.internal.ui.viewers.IPresentationContext)
67      */

68     protected RGB[] getBackgrounds(Object JavaDoc element, IPresentationContext context) throws CoreException {
69         return null;
70     }
71
72 }
73
Popular Tags