How to use eclipse startup configuration line string for two values?

The user hint in the launch configuration of the external Eclipse tool is quite simple:

${string_prompt:"Enter a string":"DefaultString"} 

However, is there a way to configure my launch configuration to use this as two separate arguments for my external tool? Something that will result in:

 my.exe --arg1=${string_prompt1} --arg2=${string_prompt1} 

I definitely don't want to embed this logic in the application myself. I just want to simplify the local test assembly configuration. Any ideas?

+7
source share
2 answers

You can have only one invitation, in which you can pass as many arguments as you want separated by spaces. The lines that you provide with the invitation will be assigned to the args variable of the public static void main method of your class.

To provide default values ​​for more than argument, you can use something like this:

 ${string_prompt:"Enter two values separated by space":firstDefault secondDefault} 

If you need to repeat the test many times with the same parameters, you can think about using the configuration of the saved run in which you correct your parameters (just list them in the "Program Settings" on the "Arguments" tab).

+4
source

In the launch configuration, you can use several string_prompt entries. This is what I am currently using for the user / password command in the program arguments.

 ${string_prompt:Username:DefaultUsername} ${string_prompt:Password} 

The first string_prompt shows a dialog box with the message "Please enter a value for the username", with the default DefaultUsername filled in. The second reads "Please enter a password value" with no default value. Both arguments are passed at each start. It works great!

+2
source

All Articles