KickJava   Java API By Example, From Geeks To Geeks.

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


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 import org.netbeans.spi.viewmodel.Models;
26 import org.openide.util.NbBundle;
27 import org.openide.util.Utilities;
28 import org.openide.windows.TopComponent;
29
30 // <RAVE>
31
// Implement HelpCtx.Provider interface to provide help ids for help system
32
// public class SourcesView extends TopComponent {
33
// ====
34
public class SourcesView extends TopComponent implements org.openide.util.HelpCtx.Provider {
35 // </RAVE>
36

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

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