public PasteType[] getPasteTypes(final Object node, final Transferable t) throws UnknownTypeException {
if (node != TreeModel.ROOT && getWatch(node) == null) {
return null;
}
DataFlavor[] flavors = t.getTransferDataFlavors();
final DataFlavor textFlavor = DataFlavor.selectBestTextFlavor(flavors);
if (textFlavor != null) {
return new PasteType[] { new PasteType() {
public Transferable paste() {
try {
java.io.Reader r = textFlavor.getReaderForText(t);
java.nio.CharBuffer cb = java.nio.CharBuffer.allocate(1000);
r.read(cb);
cb.flip();
Watch w = getWatch(node);
if (w != null) {
w.setExpression(cb.toString());
//fireModelChange(new ModelEvent.NodeChanged(WatchesNodeModel.this, node));
} else {
// Root => add a new watch
DebuggerManager.getDebuggerManager().createWatch(cb.toString());
}
} catch (Exception ex) {}
return null;
}
} };
} else {
return null;
}
}
WatchesNodeModel.java 文件源码
java
阅读 24
收藏 0
点赞 0
评论 0
项目:incubator-netbeans
作者:
评论列表
文章目录