[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.newcomer] Re: Need to change the default Launch Configuration name

Darren Frenette wrote:
Hello,

I have created a custom launch configuration, and am looking for a way to change the default 'New_configuration' to a more meaningful string.

I have made some progress with this, but fear I am heading down the path to ugly code. Here is what I have tried so far:

1) Looked at ILaunchConfiguration and noticed there is only a getName(), but no setName().

2) Looked at the eclipse source to find where the default name gets set, and found RunDebugPropertiesPage.java. Great to know, but this doesn't help me out much.

3) Figured out a way to access the text control that contains the launch configuration name. Then added a VerifyEvent to that text box. Here I can substitute my name in, which then shows up in the GUI. The problem is I can't save my working configuration, as I have no access to it in the VerifyEvent.

Looking for some guidance, hoping there is an easier way to do this.

I'm not sure how you arrived at the RunDebugPropertiesPage, but I don't think that is related (that appears to be a Preferences page, not part of the Launch Configuration dialog where these things are actually created).
I would start by looking at the class org.eclipse.debug.internal.ui.launchConfigurations.CreateLaunchConfigurationAction which is what is invoked when the user presses the "New launch configuration" button in the dialog.
(I used Plug-in Spy Alt+Shift+F1) to learn about the classes that implement that dialog).


Another avenue to explore would be to look at how other code does it; for example, if you select a class with a main() method, right-click, and select Run As > Java Application, it will create a launch configuration with a reasonable name. You can use the Plug-in Spy on Menus (Alt+Shift+F2) to learn what code implements that menu action.

Hope this helps,
Eric