KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > ui > BreakpointTypeCategory


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.ui;
12
13 import org.eclipse.core.runtime.PlatformObject;
14 import org.eclipse.debug.internal.ui.DebugPluginImages;
15 import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
16 import org.eclipse.jface.resource.ImageDescriptor;
17 import org.eclipse.ui.model.IWorkbenchAdapter;
18
19 /**
20  * Default implementation for a breakpoint type category.
21  * <p>
22  * Clients providing breakpoint type category adapters may instantiate
23  * and subclass this class.
24  * </p>
25  * @since 3.1
26  */

27 public class BreakpointTypeCategory extends PlatformObject implements IBreakpointTypeCategory, IWorkbenchAdapter {
28
29     private String JavaDoc fName;
30     private ImageDescriptor fImageDescriptor = DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_OBJS_BREAKPOINT_TYPE);
31     
32     /**
33      * Constructs a type category for the given type name.
34      *
35      * @param name breakpoint type name
36      */

37     public BreakpointTypeCategory(String JavaDoc name) {
38         fName = name;
39     }
40     
41     /**
42      * Constructs a type category for the given type name with the given
43      * image.
44      *
45      * @param name breakpoint type name
46      * @param descriptor image descriptor
47      */

48     public BreakpointTypeCategory(String JavaDoc name, ImageDescriptor descriptor) {
49         fName = name;
50         if (descriptor != null) {
51             fImageDescriptor = descriptor;
52         }
53     }
54     
55     /**
56      * Returns the name of this category's breakpoint type.
57      *
58      * @return the name of this category's breakpoint type
59      */

60     protected String JavaDoc getName() {
61         return fName;
62     }
63     
64     /* (non-Javadoc)
65      * @see java.lang.Object#equals(java.lang.Object)
66      */

67     public boolean equals(Object JavaDoc object) {
68         if (object instanceof BreakpointTypeCategory) {
69             BreakpointTypeCategory type = (BreakpointTypeCategory) object;
70             return type.getName().equals(getName());
71         }
72         return false;
73     }
74     
75     /* (non-Javadoc)
76      * @see java.lang.Object#hashCode()
77      */

78     public int hashCode() {
79         return getName().hashCode();
80     }
81
82     /* (non-Javadoc)
83      * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
84      */

85     public Object JavaDoc[] getChildren(Object JavaDoc o) {
86         return null;
87     }
88
89     /* (non-Javadoc)
90      * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
91      */

92     public ImageDescriptor getImageDescriptor(Object JavaDoc object) {
93         return fImageDescriptor;
94     }
95
96     /* (non-Javadoc)
97      * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
98      */

99     public String JavaDoc getLabel(Object JavaDoc o) {
100         return getName();
101     }
102
103     /* (non-Javadoc)
104      * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
105      */

106     public Object JavaDoc getParent(Object JavaDoc o) {
107         return null;
108     }
109 }
110
Popular Tags