1 19 20 package org.netbeans.modules.web.debug.watchesfiltering; 21 22 import org.netbeans.spi.viewmodel.NodeModel; 23 import org.netbeans.spi.viewmodel.UnknownTypeException; 24 import org.netbeans.spi.viewmodel.ModelListener; 25 import org.netbeans.api.debugger.jpda.InvalidExpressionException; 26 27 32 public class JspWatchesNodeModel implements NodeModel { 33 34 private static final String ICON_BASE ="org/netbeans/modules/debugger/resources/watchesView/Watch"; 35 36 public String getDisplayName(Object node) throws UnknownTypeException { 37 if (!(node instanceof JspElWatch)) throw new UnknownTypeException(node); 38 JspElWatch watch = (JspElWatch) node; 39 return watch.getExpression(); 40 } 41 42 public String getIconBase(Object node) throws UnknownTypeException { 43 if (!(node instanceof JspElWatch)) throw new UnknownTypeException(node); 44 return ICON_BASE; 45 } 46 47 public String getShortDescription(Object node) throws UnknownTypeException { 48 if (!(node instanceof JspElWatch)) throw new UnknownTypeException(node); 49 JspElWatch watch = (JspElWatch) node; 50 51 String t = watch.getType (); 52 String e = watch.getExceptionDescription (); 53 if (e != null) { 54 return watch.getExpression() + " = >" + e + "<"; 55 } 56 if (t == null) { 57 return watch.getExpression() + " = " + watch.getValue(); 58 } else { 59 try { 60 return watch.getExpression() + " = (" + watch.getType () + ") " + watch.getToStringValue(); 61 } catch (InvalidExpressionException ex) { 62 return ex.getLocalizedMessage (); 63 } 64 } 65 } 66 67 public void addModelListener(ModelListener l) { 68 } 69 70 public void removeModelListener(ModelListener l) { 71 } 72 } 73 | Popular Tags |