KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > debugger > jpda > ui > views > ClassesView


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.debugger.jpda.ui.views;
21
22 import java.awt.BorderLayout JavaDoc;
23 import java.util.ArrayList JavaDoc;
24 import javax.swing.JComponent JavaDoc;
25
26 import org.netbeans.spi.viewmodel.Models;
27
28 import org.openide.util.NbBundle;
29 import org.openide.util.Utilities;
30 import org.openide.windows.TopComponent;
31
32
33 // <RAVE>
34
// Implement HelpCtx.Provider interface to provide help ids for help system
35
// public class ClassesView extends TopComponent {
36
// ====
37
public class ClassesView extends TopComponent implements org.openide.util.HelpCtx.Provider {
38 // </RAVE>
39

40     private transient JComponent JavaDoc tree;
41     private transient ViewModelListener viewModelListener;
42     
43     
44     public ClassesView () {
45         setIcon (Utilities.loadImage ("org/netbeans/modules/debugger/resources/classesView/Classes.gif")); // NOI18N
46
}
47
48     protected String JavaDoc preferredID() {
49         return this.getClass().getName();
50     }
51
52     protected void componentShowing () {
53         super.componentShowing ();
54         if (viewModelListener != null) {
55             viewModelListener.setUp();
56             return;
57         }
58         if (tree == null) {
59             setLayout (new BorderLayout JavaDoc ());
60             tree = Models.createView (Models.EMPTY_MODEL);
61             tree.setName (NbBundle.getMessage (ClassesView.class, "CTL_Classes_tooltip")); // NOI18N
62
add (tree, "Center"); //NOI18N
63
}
64         if (viewModelListener != null)
65             throw new InternalError JavaDoc ();
66         viewModelListener = new ViewModelListener (
67             "ClassesView",
68             tree
69         );
70     }
71     
72     protected void componentHidden () {
73         super.componentHidden ();
74         viewModelListener.destroy ();
75     }
76     
77     // <RAVE>
78
// Implement getHelpCtx() with the correct helpID
79
public org.openide.util.HelpCtx getHelpCtx() {
80         return new org.openide.util.HelpCtx("NetbeansDebuggerClassNode"); // NOI18N
81
}
82     // </RAVE>
83

84     public int getPersistenceType () {
85         return PERSISTENCE_ALWAYS;
86     }
87         
88     public boolean requestFocusInWindow () {
89         super.requestFocusInWindow ();
90         if (tree == null) return false;
91         return tree.requestFocusInWindow ();
92     }
93     
94     public String JavaDoc getName () {
95         return NbBundle.getMessage (ClassesView.class, "CTL_Classes_view");
96     }
97     
98     public String JavaDoc getToolTipText () {
99         return NbBundle.getMessage (ClassesView.class, "CTL_Classes_tooltip");// NOI18N
100
}
101 }
102
Popular Tags