/** * Map a debuggercore Session to one of ours */ public static NativeSession map(Session coreSession) { return coreSession.lookupFirst(null, NativeSession.class); }
@Override public void propertyChange(PropertyChangeEvent e) { if (org.netbeans.api.debugger.DebuggerManager.PROP_CURRENT_SESSION.equals(e.getPropertyName())) { if (Log.Start.debug) { System.out.printf("DebuggerManager.PROP_CURRENT_SESSION\n"); // NOI18N } //System.err.println("DDM.propertyChange: PROP_CURRENT_SESSION"); // Our sessions have only one debugger engine // If we get a non-native session, we'll get _some_ engine // and if it's not a native engine then lookup() will return a null // and that will make switchOutput do the correct thing as well. NativeDebugger odebugger = null; Session osession = (Session) e.getOldValue(); if (osession != null) { DebuggerEngine oengine = osession.getCurrentEngine(); odebugger = oengine.lookupFirst(null, NativeDebugger.class); } NativeDebugger ndebugger = null; Session nsession = (Session) e.getNewValue(); if (nsession != null) { DebuggerEngine nengine = nsession.getCurrentEngine(); ndebugger = nengine.lookupFirst(null, NativeDebugger.class); } switchOutput(odebugger, ndebugger); } } private final Map<Watch, NativeWatch> watchMap = new HashMap<Watch, NativeWatch>();
@Override public DebuggerEngine[] getEngines() { DebuggerEngine[] engines = javalb.getGroupProperties().getEngines(); if (engines == null) { return null; } for (int i = 0; i < engines.length; i++) { DebuggerEngine de = engines[i].lookupFirst(null, Session.class).getEngineForLanguage ("JSP"); if (de != null) { engines[i] = de; } } return engines; }
Session s = sessions[i]; if (s != null) { AttachingDICookie attCookie = (AttachingDICookie)s.lookupFirst(null, AttachingDICookie.class); if (attCookie != null) { if (sdi.getTransport().equals(ServerDebugInfo.TRANSPORT_SHMEM)) { String shmem = attCookie.getSharedMemoryName(); if (shmem != null && shmem.equalsIgnoreCase(sdi.getShmemName())) { s.kill(); if (host != null && isSameHost(host, sdi.getHost()) && attCookie.getPortNumber() == sdi.getPort()) { s.kill();
return null; DebuggerEngine engine = session.getCurrentEngine(); if (engine != session.getEngineForLanguage(JSUtils.JS_STRATUM)) { return null;
boolean displayJSStacks = DebuggingJSFramesInJavaModelFilter.preferences. getBoolean(DebuggingJSFramesInJavaModelFilter.PREF_DISPLAY_JS_STACKS, true); if (displayJSStacks || JSUtils.JS_STRATUM.equals(session.getCurrentLanguage())) { Object[] jsChildren = DebuggingJSTreeModel.createChildrenWithJSStack(stack); if (jsChildren != null) {
private void setSessionTitle(Session s) { if (s != null) { //getTabComponentAt(1).setVisible(false); setTitleAt(0, s.getName()); setEnabledAt(1, false); } else { setProjectTitle(MainProjectManager.getDefault().getMainProject()); setEnabledAt(1, true); } }
public void kill() { coreSession.kill(); }
public void doAction (Object action) { if (breakpoint != null) { DebuggerManager.getDebuggerManager ().removeBreakpoint (breakpoint); breakpoint = null; } breakpoint = JspLineBreakpoint.create ( Context.getCurrentURL(), Context.getCurrentLineNumber() ); breakpoint.setHidden(true); DebuggerManager.getDebuggerManager().addBreakpoint (breakpoint); DebuggerEngine jspEngine = session.getEngineForLanguage("JSP"); if (jspEngine == null) { jspEngine = session.getCurrentEngine(); } jspEngine.getActionsManager ().doAction ( ActionsManager.ACTION_CONTINUE ); } }
boolean displayJSStacks = DebuggingJSFramesInJavaModelFilter.preferences. getBoolean(DebuggingJSFramesInJavaModelFilter.PREF_DISPLAY_JS_STACKS, true); if (displayJSStacks || JSUtils.JS_STRATUM.equals(session.getCurrentLanguage())) { Object[] jsChildren = DebuggingJSTreeModel.createChildrenWithJSStack(stack); if (jsChildren != null) {
private void setSessionTitle(Session s) { if (s != null) { //getTabComponentAt(1).setVisible(false); setTitleAt(0, s.getName()); setEnabledAt(1, false); } else { setProjectTitle(MainProjectManager.getDefault().getMainProject()); setEnabledAt(1, true); } }
private void registerListener(Session session) { final JPDADebugger jpda = (JPDADebugger)session.lookupFirst(null, JPDADebugger.class); if (jpda != null) { jpda.addPropertyChangeListener(JPDADebugger.PROP_STATE, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { RequestProcessor.Task task; synchronized (DebuggerStateListener.this) { if (refreshTask == null) { refreshTask = DEBUGGER_STATE_PROCESSOR.create(new Runnable() { public void run() { if (jpda.getState() == JPDADebugger.STATE_STOPPED) { setServerState(ServerInstance.STATE_SUSPENDED); } else { setServerState(ServerInstance.STATE_DEBUGGING); } } }); } task = refreshTask; } // group fast arriving refresh calls task.schedule(500); } }); } } }
return ; DebuggerEngine engine = session.getCurrentEngine(); if (engine != session.getEngineForLanguage(JSUtils.JS_STRATUM)) { return ;
public Collection<NativeDebugger> nativeDebuggers() { ArrayList<NativeDebugger> list = new ArrayList<NativeDebugger>(); NativeSession[] sessions = getSessions(); for (int sx = 0; sx < sessions.length; sx++) { NativeSession s = sessions[sx]; DebuggerEngine engine = s.coreSession().getCurrentEngine(); NativeDebugger debugger = engine.lookupFirst(null, NativeDebugger.class); if (debugger != null) { list.add(debugger); } } return list; }
public static void setupContext(JEditorPane editorPane) { EditorKit kit = CloneableEditorSupport.getEditorKit("text/x-scala"); editorPane.setEditorKit(kit); DebuggerEngine en = DebuggerManager.getDebuggerManager ().getCurrentEngine(); JPDADebugger d = en.lookupFirst(null, JPDADebugger.class); CallStackFrame csf = d.getCurrentCallStackFrame(); if (csf != null) { String language = DebuggerManager.getDebuggerManager ().getCurrentSession().getCurrentLanguage(); SourcePath sp = en.lookupFirst(null, SourcePath.class); String url = sp.getURL(csf, language); int line = csf.getLineNumber(language); setupContext(editorPane, url, line); } }
@Override protected Pair<String, Object> evaluate(String expression, DebuggerEngine engine) throws CancellationException { Session session = engine.lookupFirst(null, Session.class); if (engine != session.getEngineForLanguage(JSUtils.JS_STRATUM)) { return null;
@Override public DebuggingView.DVSupport getDVSupport() { return debugger.session().coreSession().lookupFirst(null, DebuggingView.DVSupport.class); }
/** * Spread 'nativeWatch' to all sessions other than 'origin'. * If 'origin' is null then it is spread to all sessions. */ public void spreadWatchCreation(NativeDebugger origin, NativeWatch nativeWatch) { if (Log.Watch.pathway) { System.out.println("Spreading watch creation ..."); // NOI18N } for (NativeSession s : getSessions()) { DebuggerEngine engine = s.coreSession().getCurrentEngine(); NativeDebugger debugger = engine.lookupFirst(null, NativeDebugger.class); if (debugger == null) { if (Log.Watch.pathway) { System.out.println("\t... null debugger"); // NOI18N } continue; } else if (debugger == origin) { if (Log.Watch.pathway) { System.out.println("\t... origin debugger (skipped)"); // NOI18N } continue; } else { if (Log.Watch.pathway) { System.out.println("\t... " + debugger); // NOI18N } debugger.spreadWatchCreation(nativeWatch); } } }
private JPDADebugger getCurrentDebugger() { Session s = DebuggerManager.getDebuggerManager().getCurrentSession(); if (s != null) { JPDADebugger debugger = s.lookupFirst(null, JPDADebugger.class); if (debugger != null) { debugger.addPropertyChangeListener(JPDADebugger.PROP_BREAKPOINTS_ACTIVE, this); } return debugger; } else { return null; } }
/** * Update all sessions' shadow list of unsaved files * If 'debugger' is non-null then only that debuggers list is updated. * If 'debugger' is null then all sessions' lists are updated. */ private void notifyUnsavedFiles(NativeDebugger debugger, List<String> fileNames) { String file[] = new String[fileNames.size()]; file = fileNames.toArray(file); if (debugger != null) { debugger.notifyUnsavedFiles(file); } else { for (NativeSession s : getSessions()) { DebuggerEngine engine = s.coreSession().getCurrentEngine(); NativeDebugger nd = engine.lookupFirst(null, NativeDebugger.class); if (nd != null) { nd.notifyUnsavedFiles(file); } } } }