1 19 20 package org.netbeans.modules.debugger.jpda.ui.views; 21 22 import java.awt.BorderLayout ; 23 import java.util.ArrayList ; 24 import javax.swing.JComponent ; 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 public class ClassesView extends TopComponent implements org.openide.util.HelpCtx.Provider { 38 40 private transient JComponent tree; 41 private transient ViewModelListener viewModelListener; 42 43 44 public ClassesView () { 45 setIcon (Utilities.loadImage ("org/netbeans/modules/debugger/resources/classesView/Classes.gif")); } 47 48 protected String 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 ()); 60 tree = Models.createView (Models.EMPTY_MODEL); 61 tree.setName (NbBundle.getMessage (ClassesView.class, "CTL_Classes_tooltip")); add (tree, "Center"); } 64 if (viewModelListener != null) 65 throw new InternalError (); 66 viewModelListener = new ViewModelListener ( 67 "ClassesView", 68 tree 69 ); 70 } 71 72 protected void componentHidden () { 73 super.componentHidden (); 74 viewModelListener.destroy (); 75 } 76 77 public org.openide.util.HelpCtx getHelpCtx() { 80 return new org.openide.util.HelpCtx("NetbeansDebuggerClassNode"); } 82 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 getName () { 95 return NbBundle.getMessage (ClassesView.class, "CTL_Classes_view"); 96 } 97 98 public String getToolTipText () { 99 return NbBundle.getMessage (ClassesView.class, "CTL_Classes_tooltip"); } 101 } 102 | Popular Tags |