1 19 20 package org.netbeans.modules.debugger.delegatingview; 21 22 import java.beans.PropertyChangeListener ; 23 import java.beans.PropertyChangeEvent ; 24 import javax.swing.*; 25 26 27 import org.netbeans.modules.debugger.*; 28 import org.netbeans.modules.debugger.GUIManager.*; 29 30 import org.openide.TopManager; 31 import org.netbeans.modules.debugger.support.DebuggerModule; 32 import org.netbeans.modules.debugger.support.DelegatingView2; 33 import org.netbeans.modules.debugger.support.View2; 34 import org.netbeans.modules.debugger.support.View2Support; 35 import org.netbeans.modules.debugger.support.nodes.DebuggerNode; 36 37 38 43 public class DVModule extends org.openide.modules.ModuleInstall { 44 45 DelegatingView2 breakpointsView; 46 DelegatingView2 threadsView; 47 DelegatingView2 callStackView; 48 DelegatingView2 sessionsView; 49 DelegatingView2 watchesView; 50 DelegatingView2 classesView; 51 View2Support variablesListView; 52 53 55 56 public void installed () { 57 restored (); 58 } 59 60 61 public void restored () { 62 breakpointsView = 64 new DelegatingView2 (new View2 [] { 65 DebuggerModule.BREAKPOINTS_VIEW, new View2Support ( DebuggerNode.getLocalizedString ("CTL_Breakpoints_view"), "/org/netbeans/modules/debugger/resources/breakpoints", "org.netbeans.modules.debugger.delegatingview.BreakpointsView", false, true, true, false ) 75 }); 76 threadsView = 77 new DelegatingView2 (new View2 [] { 78 DebuggerModule.THREADS_VIEW, new View2Support ( DebuggerNode.getLocalizedString ("CTL_Threads_view"), "/org/netbeans/core/resources/threads", "org.netbeans.modules.debugger.delegatingview.ThreadsView", false, true, false, false ) 88 }); 89 callStackView = 90 new DelegatingView2 (new View2 [] { 91 DebuggerModule.CALL_STACK_VIEW, new View2Support ( DebuggerNode.getLocalizedString ("CTL_Call_stack_view"), "/org/netbeans/core/resources/callstack", "org.netbeans.modules.debugger.delegatingview.CallStackView", false, true, true, false ) 101 }); 102 final DelegatingView2 sessionsView = 103 new DelegatingView2 (new View2 [] { 104 DebuggerModule.SESSIONS_VIEW, new View2Support ( DebuggerNode.getLocalizedString ("CTL_Sessions_view"), "/org/netbeans/modules/debugger/multisession/resources/sessions", "org.netbeans.modules.debugger.delegatingview.SessionsView", false, true, false, false ) 114 }); 115 watchesView = 116 new DelegatingView2 (new View2 [] { 117 DebuggerModule.WATCHES_VIEW, new View2Support ( DebuggerNode.getLocalizedString ("CTL_Watches_view"), "/org/netbeans/core/resources/watches", "org.netbeans.modules.debugger.delegatingview.WatchesView", false, true, true, false ) 127 }); 128 classesView = 129 new DelegatingView2 (new View2 [] { 130 DebuggerModule.CLASSES_VIEW, null }); 133 variablesListView = 134 new View2Support ( DebuggerModule.VARIABLES_VIEW.getDisplayName (), DebuggerModule.VARIABLES_VIEW.getIconBase (), 137 "org.netbeans.modules.debugger.support.nodes.VariablesView", DebuggerModule.VARIABLES_VIEW.hasFixedSize (), DebuggerModule.VARIABLES_VIEW.canBeHidden (), true, DebuggerModule.VARIABLES_VIEW.isSeparated () ); 143 144 View[] vs = GUIManager.getDefault ().getViews (); 146 int i, k = vs.length; 147 View[] nvs = new View [k]; 148 for (i = 0; i < k; i++) 149 if (vs [i] == DebuggerModule.WATCHES_VIEW) { 150 nvs [i] = watchesView; 151 } else 152 if (vs [i] == DebuggerModule.SESSIONS_VIEW) { 153 nvs [i] = sessionsView; 154 } else 155 if (vs [i] == DebuggerModule.CALL_STACK_VIEW) { 156 nvs [i] = callStackView; 157 } else 158 if (vs [i] == DebuggerModule.THREADS_VIEW) { 159 nvs [i] = threadsView; 160 } else 161 if (vs [i] == DebuggerModule.BREAKPOINTS_VIEW) { 162 nvs [i] = breakpointsView; 163 } else 164 if (vs [i] == DebuggerModule.CLASSES_VIEW) { 165 nvs [i] = classesView; 166 } else 167 if (vs [i] == DebuggerModule.VARIABLES_VIEW) { 168 nvs [i] = variablesListView; 169 } else 170 nvs [i] = vs [i]; 171 GUIManager.getDefault ().setViews (nvs); 172 173 try { 175 final CoreDebugger cd = (CoreDebugger) TopManager.getDefault().getDebugger(); 176 cd.addPropertyChangeListener (new PropertyChangeListener () { 177 public void propertyChange (PropertyChangeEvent e) { 178 if (e.getPropertyName () == null) return; 179 if (!e.getPropertyName ().equals (CoreDebugger.PROP_CURRENT_DEBUGGER)) return; 180 AbstractDebugger d = cd.getCurrentDebugger (); 181 if (d == null) return; 182 if (d.getClass ().getName ().indexOf ("JPDADebugger") >= 0) { 183 SwingUtilities.invokeLater (new Runnable () { 185 public void run () { 186 breakpointsView.setCurrentView (0); 187 classesView.setCurrentView (0); 188 sessionsView.setCurrentView (0); 189 threadsView.setCurrentView (0); 190 callStackView.setCurrentView (0); 191 watchesView.setCurrentView (0); 192 watchesView.refreshViews (); 193 } 194 }); 195 } else 196 if (d.getClass ().getName ().indexOf ("ToolsDebugger") >= 0) { 197 SwingUtilities.invokeLater (new Runnable () { 199 public void run () { 200 breakpointsView.setCurrentView (1); 201 classesView.setCurrentView (1); 202 sessionsView.setCurrentView (1); 203 threadsView.setCurrentView (1); 204 callStackView.setCurrentView (1); 205 watchesView.setCurrentView (1); 206 watchesView.refreshViews (); 207 } 208 }); 209 } 210 } 211 }); 212 } catch (org.openide.debugger.DebuggerNotFoundException ex) { 213 ex.printStackTrace(); 214 } 215 } 216 } 217 218 | Popular Tags |