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 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 public class SourcesView extends TopComponent implements org.openide.util.HelpCtx.Provider { 35 37 private transient JComponent tree; 38 private transient ViewModelListener viewModelListener; 39 40 41 public SourcesView () { 42 setIcon (Utilities.loadImage ("org/netbeans/modules/debugger/jpda/resources/root.gif")); } 44 45 protected String 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 ()); 57 tree = Models.createView (Models.EMPTY_MODEL); 58 tree.setName (NbBundle.getMessage (ClassesView.class, "CTL_Sources_tooltip")); add (tree, "Center"); } 61 if (viewModelListener != null) 62 throw new InternalError (); 63 viewModelListener = new ViewModelListener ( 64 "SourcesView", 65 tree 66 ); 67 } 68 69 protected void componentHidden () { 70 super.componentHidden (); 71 viewModelListener.destroy (); 72 } 73 74 public org.openide.util.HelpCtx getHelpCtx() { 77 return new org.openide.util.HelpCtx("NetbeansDebuggerSourcesNode"); } 79 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 getName () { 92 return NbBundle.getMessage (SourcesView.class, "CTL_Sourcess_view"); 93 } 94 95 public String getToolTipText () { 96 return NbBundle.getMessage (SourcesView.class, "CTL_Sources_tooltip"); } 98 } 99 | Popular Tags |