NetBeans infrastructure allows to have Attach-Debug history. The history items appears in the menu associated with debug button on the main toolbar.
Currently it's implemented the following way. The class implementing Controller interface should have 3 additional methods: save, load and getDisplayName. All of them are called via reflection from the general attach debugging infrastructure. See the following changeset as an example of implementation:
The better approach would be to extend Controller interface and add these three methods into it. And the general infrastructure can check if the Controller object is an instance of this new interface and call the methods without reflection.
It would be great to have a history for the Run-Debug also. It should work exactly the same as for Attach-Debug.
Created attachment 147842[details]
Implementation with the use of BuildExecutionSupportImplementation
I managed to implement this with the help of org.netbeans.modules.project.uiapi.BuildExecutionSupportImplementation, which is not public API, unfortunately. I do not think that adding implementation dependency just because of that is nice, therefore I'll request some public API for this...
Product Version: NetBeans IDE Dev (Build 201407230001)
Java: 1.8.0_11; Java HotSpot(TM) Client VM 25.11-b03
Runtime: Java(TM) SE Runtime Environment 1.8.0_11-b12
System: Linux version 3.13.0-24-generic running on i386; UTF-8; en_US (nb)
Verified. However, is there a chance to remove some items from the archive? I used wrong host name which caused the attach to fail but it now occupies space in the pull down menu uselessly.
Comment 15Martin Entlicher
2014-07-23 09:21:16 UTC
I can imagine a small [x] button on the menu item, like on tabs in Firefox.
But this is not currently in any NetBeans menu AFAIK and I was not sure how sever the inability to remove menu items is.
Feel free to submit an enhancement for that.