首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何以编程方式更改Attach对话框上Port字段的默认值?

如何以编程方式更改Attach对话框上Port字段的默认值?
EN

Stack Overflow用户
提问于 2011-02-09 04:26:35
回答 1查看 397关注 0票数 1

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

我想要预先设置Port字段的值,这样用户只需单击OK即可开始调试我的模块已启动的进程。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-11-15 13:05:04

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

代码语言:javascript
复制
    // 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-值:# java.util.HashMap

debugger.connection_settings.0-value.0-key:"port“

debugger.connection_settings.0-value.0-value:"123“

debugger.connection_settings.0-value.length:1

debugger.connection_settings.length:1

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4938008

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档