KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > callhierarchy > MethodWrapperWorkbenchAdapter


1 /*******************************************************************************
2  * Copyright (c) 2000, 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
12 package org.eclipse.jdt.internal.ui.callhierarchy;
13
14 import org.eclipse.core.runtime.Assert;
15
16 import org.eclipse.jface.resource.ImageDescriptor;
17
18 import org.eclipse.ui.model.IWorkbenchAdapter;
19
20 import org.eclipse.jdt.internal.corext.callhierarchy.MethodWrapper;
21
22 public class MethodWrapperWorkbenchAdapter implements IWorkbenchAdapter {
23
24     private final MethodWrapper fMethodWrapper;
25
26     public MethodWrapperWorkbenchAdapter(MethodWrapper methodWrapper) {
27         Assert.isNotNull(methodWrapper);
28         fMethodWrapper= methodWrapper;
29     }
30
31     public MethodWrapper getMethodWrapper() {
32         return fMethodWrapper;
33     }
34
35     public Object JavaDoc[] getChildren(Object JavaDoc o) { //should not be called
36
return new Object JavaDoc[0];
37     }
38
39     /* (non-Javadoc)
40      * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
41      */

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

49     public String JavaDoc getLabel(Object JavaDoc o) {
50         return fMethodWrapper.getMember().getElementName();
51     }
52
53     /* (non-Javadoc)
54      * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
55      */

56     public Object JavaDoc getParent(Object JavaDoc o) {
57         return fMethodWrapper.getParent();
58     }
59     
60     /*
61      * (non-Javadoc)
62      * @see java.lang.Object#equals(java.lang.Object)
63      */

64     public boolean equals(Object JavaDoc obj) {
65         //Note: A MethodWrapperWorkbenchAdapter is equal to its MethodWrapper and vice versa (bug 101677).
66
return fMethodWrapper.equals(obj);
67     }
68
69     /*
70      * (non-Javadoc)
71      * @see java.lang.Object#hashCode()
72      */

73     public int hashCode() {
74         //Note: A MethodWrapperWorkbenchAdapter is equal to its MethodWrapper and vice versa (bug 101677).
75
return fMethodWrapper.hashCode();
76     }
77     
78 }
79
Popular Tags