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.
Some nice API was introduced in for run history
It would be great to have the same API for Run-Debug and Attach-Debug actions as well.
O.K., scheduling for the next release, we're after feature freeze of 7.4 already.
It looks like we can reuse BuildExecutionSupport for the debugger action.
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...
Created attachment 147843 [details]
This is how it will look like - two sections of the menu will grow with past debugging sessions.
Created attachment 147881 [details]
The proposed API change to get rid of reflection calls.
Please review the last attachment - introduction of PersistentController.
Created attachment 147942 [details]
After issue #245350 is integrated, this patch adds the history into the menu.
in case nobody objects i will integrate tomomorrow
integrated core-main #d90620216dec
Integrated into 'main-silver', will be available in build *201407190718* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Tomas Stupka <firstname.lastname@example.org>
Log: Issue #193872 - Need to have history for Run-Debug and re-implement history support for Attach-Debug
Thanks Tomas for the push of menu history.
The API change that introduces PersistentController is pushed in
Integrated into 'main-silver', will be available in build *201407230001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Log: #193872: PersistentController introduced.
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.
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.
OK, [x] button would be satisfactory. I filed it as #245920. Thanks.
Works like a charm!