public boolean isEnabled() { return watch.isEnabled(); } public String getQualifiedExpression() {
public String getExpression() { if (watch != null) return watch.getExpression(); else return expression; }
public void perform (Object[] nodes) { int i, k = nodes.length; for (i = 0; i < k; i++) ((JspElWatch) nodes [i]).getWatch().remove (); } },
private static void customize(Watch w) { WatchPanel wp = new WatchPanel(w.getExpression()); JComponent panel = wp.getPanel(); org.openide.DialogDescriptor dd = new org.openide.DialogDescriptor( panel, NbBundle.getMessage(JspWatchesActionsProvider.class, "CTL_Edit_Watch_Dialog_Title", // NOI18N w.getExpression() ) ); dd.setHelpCtx(new HelpCtx("debug.add.watch")); Dialog dialog = DialogDisplayer.getDefault().createDialog(dd); dialog.setVisible(true); dialog.dispose(); if (dd.getValue() != org.openide.DialogDescriptor.OK_OPTION) return; w.setExpression(wp.getExpression()); }
public void setExpression(String expression) { if (watch != null) watch.setExpression(expression); else this.expression = expression; }
public JspElWatch(Watch w, JPDADebugger debugger) { watch = w; this.debugger = debugger; w.addPropertyChangeListener((PropertyChangeListener) WeakListeners.create(PropertyChangeListener.class, this, w)); }
private boolean isEnabled(JPDAWatch jw) { try { // This is clearly missing in the APIs: Method getWatchMethod = jw.getClass().getMethod("getWatch"); getWatchMethod.setAccessible(true); Watch w = (Watch) getWatchMethod.invoke(jw); return w.isEnabled(); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { return true; } }
public String getExpression () { return watch.getExpression(); }
public void perform (final Object[] nodes) { if (!SwingUtilities.isEventDispatchThread()) { SwingUtilities.invokeLater(new Runnable() { public void run() { perform(nodes); } } ); return; } int i, k = nodes.length; for (i = 0; i < k; i++) if (nodes [i] instanceof WatchVariable) { WatchVariable w = (WatchVariable) nodes [i]; w.getNativeWatch().postDelete(false); } else ((Watch) nodes [i]).remove (); } },
private boolean isEnabled(JPDAWatch jw) { try { // This is clearly missing in the APIs: Method getWatchMethod = jw.getClass().getMethod("getWatch"); getWatchMethod.setAccessible(true); Watch w = (Watch) getWatchMethod.invoke(jw); return w.isEnabled(); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { return true; } }
private synchronized void evaluate() { String text = watch.getExpression (); text = text.replace("\"", "\\\""); text = "pageContext.getExpressionEvaluator().evaluate(\"" + text + "\", "+ "java.lang.String.class, "+ "((javax.servlet.jsp.PageContext) pageContext).getVariableResolver(), "+ "null)"; try { variable = debugger.evaluate(text); exception = null; } catch (Exception e) { exception = e; } finally { evaluated = true; } }
/** * Actually delete this NativeWatch, delete it's associated debuggercore * Watch and remove it from watchBag(). */ public void delete() { assert getSubWatches().length == 0 : "NativeWatch.delete(): still have children"; // NOI18N if (watch != null) { watch.remove(); // Will come back as DebuggerManager.watchRemoved() // which will call WatchBag.remove() } else { NativeDebuggerManager.get().watchBag().remove(this); } }
public String getExceptionDescription() { if (!watch.isEnabled()) { return null; } if (!evaluated) { evaluate(); } return exception == null ? null : exception.getMessage(); }
@Override public String getDisplayName(NodeModel original, Object node) throws UnknownTypeException { assert ! (node instanceof NativeWatch) : "WatchModel.get*(): got a NativeWatch"; // NOI18N if (node instanceof EmptyWatch) { return "<_html><font color=\"#808080\"><" + // [TODO] <_html> tag used as workaround, see TreeModelNode.setName() // NOI18N Catalog.get("CTL_WatchesModel_Empty_Watch_Hint") + // NOI18N "></font></html>"; // NOI18N } if (node instanceof Watch) return ((Watch) node).getExpression (); else return super.getDisplayName(original, node); }
public String getValue() { if (!watch.isEnabled()) { return NbBundle.getMessage(JspElWatch.class, "CTL_WatchDisabled"); } if (!evaluated) { evaluate(); } return variable == null ? "" : variable.getValue(); }
/** * Note that a Watch was removed. * Called out from debuggercore. */ // interface DebuggerManagerAdapter @Override public void watchRemoved(Watch watch) { if (Log.Watch.pathway) { System.out.printf("DebuggerManager.watchRemoved('%s')\n", // NOI18N watch.getExpression()); } NativeWatch removed = watchMap.remove(watch); assert removed == null || removed.watch() == watch; watchBag().remove(removed); } /**
public String getType() { if (!watch.isEnabled()) { return ""; } if (!evaluated) { evaluate(); } return variable == null ? "" : variable.getType(); }
if (Log.Watch.pathway) { System.out.printf("DebuggerManager.watchAdded('%s')\n", // NOI18N watch.getExpression()); if (watch.getExpression() == null) {
@Override public String getIconBase(NodeModel original, Object node) throws UnknownTypeException { if (node instanceof WatchVariable) { WatchVariable w = (WatchVariable) node; if (w.getVariableName().startsWith("`")) { // NOI18N // fully qualified (only under dbx) // SHOULD make fully-qualified predicate an interface if (w.isPtr()) return ICON_WATCH2_PTR; else return ICON_WATCH2; } else { if (w.isPtr()) return ICON_WATCH1_PTR; else return ICON_WATCH1; } } else if (node instanceof Watch) { // generic debuggercore watch Watch w = (Watch) node; if (w.getExpression().startsWith("`")) { // NOI18N // fully qualified return ICON_WATCH2; } else { return ICON_WATCH1; } } else { return super.getIconBase(original, node); } }
String expression = w.getExpression(); if (isJSPexpression(expression)) { JspElWatch jw = (JspElWatch) watch2JspElWatch.get(w);