2011-02-08 13 views
1

これは、NetBeansユーザーが[デバッグ]メニューの[デバッガを接続...]項目を選択したときに表示されるダイアログです。[添付]ダイアログの[ポート]フィールドのデフォルト値をプログラムで変更するにはどうすればよいですか?

enter image description here

私は、ユーザーがちょうど私のモジュールが開始されたプロセスのデバッグを開始するには、[OK]をクリックする必要があるので、ポート]フィールドの値をプリセットします。

答えて

0

(NetBeansの6.9.1でテスト)あなたのモジュールがDebugger Core APIへの依存が必要になりますし、次はあなたのInstallerに行くことができるこの技術を使用するには:

// 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 /設定/サービス/ org-netbeans-modules-debugger-Settings.properties

そして、このコードを実行した後、次のようなセクションがあります:

debugger.connection_settings:#java.util.HashMapを
debugger.connection_settings.0キー: "com.sun.jdi.SocketAttach" を
debugger.connection_settings.0値:#java.util.HashMapを
debugger.connection_settings.0-value.0キー: "ポート"
debugger.connection_settings.0-value.0値: "123"
debugger.connection_settings.0-value.length:1
debugger.connection_settings.length:1

関連する問題