1

这是当 NetBeans 用户从“调试”菜单中选择“附加调试器...”项时出现的对话框。

在此处输入图像描述

我想预设端口字段的值,因此用户只需单击确定即可开始调试我的模块已启动的进程。

4

1 回答 1

0

要使用此技术,您的模块将需要依赖,Debugger Core API并且以下内容可以进入您的Installer(在 NetBeans 6.9.1 上测试):

    // get the _debugger_ properties
    org.netbeans.api.debugger.Properties props = 
            Properties.getDefault().getProperties("debugger");

    Map<String, Map<String, String>> toSave = new HashMap<String, Map<String, String>>();
    Map<String, String> values = new HashMap<String, String>();
    values.put("port", "123"); // <- this is what you're after
    toSave.put("com.sun.jdi.SocketAttach", values);

    props.setMap("connection_settings", toSave);

作为参考,此设置位于:

~/.netbeans/6.9/config/Services/org-netbeans-modules-debugger-Settings.properties

运行此代码后,您将看到如下部分:

debugger.connection_settings:# java.util.HashMap
debugger.connection_settings.0-key:"com.sun.jdi.SocketAttach"
debugger.connection_settings.0-value:# java.util.HashMap
debugger.connection_settings.0-value.0 -key:“端口”
debugger.connection_settings.0-value.0-value:“123”
debugger.connection_settings.0-value.length:1
debugger.connection_settings.length:1

于 2011-11-15T05:05:04.297 回答