KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > aspectj > debugger > gui > MethodNode


1 /* -*- Mode: JDE; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * This file is part of the debugger and core tools for the AspectJ(tm)
4 * programming language; see http://aspectj.org
5 *
6 * The contents of this file are subject to the Mozilla Public License
7 * Version 1.1 (the "License"); you may not use this file except in
8 * compliance with the License. You may obtain a copy of the License at
9 * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * The Original Code is AspectJ.
17 *
18 * The Initial Developer of the Original Code is Xerox Corporation. Portions
19 * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation.
20 * All Rights Reserved.
21 */

22 package org.aspectj.debugger.gui;
23
24 import java.util.*;
25
26 abstract class MethodNode extends AJTreeNode
27                           implements Sourceable,
28                                      Breakable,
29                                      Advisedable {
30
31     protected MethodHelper helper;
32
33     protected MethodNode(MethodHelper helper) {
34         super(AJIcons.METHOD_ICON);
35         this.helper = helper;
36         setUserObject(helper.getDisplayName());
37         setAlwaysExpand(true);
38     }
39
40     public String JavaDoc getRealName() {
41         return helper.getRealName();
42     }
43
44     public String JavaDoc getToolTipText() {
45         return showClass() + helper.getToolTipText();
46     }
47
48     private String JavaDoc showClass() {
49         if (getParent() instanceof AdviceNode) {
50             return helper.getClassName() + ".";
51         }
52         return "";
53     }
54
55     public void showOnSource(AbstractSourcePane sourcePane) {
56         sourcePane.showSourceForFileAndLine(helper.getRelativePath(),
57                                             helper.getLine());
58     }
59
60     public String JavaDoc getBreakpoint() {
61         return helper.getBreakpoint();
62     }
63
64     public abstract List getAdviceStrings();
65
66     public int getType() {
67         return helper.getType();
68     }
69
70     public static int getType(boolean isCtr,
71                                boolean isStatic,
72                                boolean isPublic,
73                                boolean isPrivate,
74                                boolean isProtected) {
75         if (isStatic) {
76             if (isPublic) return AJIcons.METHOD_STATIC_PUBLIC_ICON;
77             if (isProtected) return AJIcons.METHOD_STATIC_PROTECTED_ICON;
78             if (isPrivate) return AJIcons.METHOD_STATIC_PRIVATE_ICON;
79             else return AJIcons.METHOD_STATIC_PACKAGE_ICON;
80         } else if (isCtr) {
81             if (isPublic) return AJIcons.CTR_PUBLIC_ICON;
82             if (isProtected) return AJIcons.CTR_PROTECTED_ICON;
83             if (isPrivate) return AJIcons.CTR_PRIVATE_ICON;
84             else return AJIcons.CTR_PACKAGE_ICON;
85         } else {
86             if (isPublic) return AJIcons.METHOD_PUBLIC_ICON;
87             if (isProtected) return AJIcons.METHOD_PROTECTED_ICON;
88             if (isPrivate) return AJIcons.METHOD_PRIVATE_ICON;
89             else return AJIcons.METHOD_PACKAGE_ICON;
90         }
91     }
92 }
93
Popular Tags