Changing launch arguments

Changing the evaluation directory

The evaluation directory (where the files are generated) is specified in the launch configuration. You can update the launch configuration using Java APIs:

public static void main(String[] args) throws CoreException {
    ...
    // Load a launch configuration
    File file = new File("c:\\deploy\\myLaunch.launch");
    LaunchConfiguration configuration = manager.loadLaunchConfiguration(file);
    configuration.setEvaluationDirectory(new File("c:\\generated"));
    ...
}

Changing launch parameters

Let's now assume the launch configuration is defined to execute a rule, which owner ruleset expects an input UML model. You can override the actual model reader used to load this input UML model from Java code:

public static void main(String[] args) throws CoreException {
    ...
    // Load a launch configuration
    File file = new File("c:\\deploy\\myLaunch.launch");
    LaunchConfiguration configuration = manager.loadLaunchConfiguration(file);
    
    // change the input model of the ruleset
    LaunchEntryPoint entryPoint = configuration.getEntryPoint();
    LaunchModelArgument argument = (LaunchModelArgument) entryPoint.getArguments().get(0);
    argument.setConnectorName("XMI");
    argument.setURI("c:\\deploy\\myModel.xmi");
    ...
}

You could also override other types of arguments: an output model, a String parameter, a Boolean parameter, etc.

Saving an updated launch configuration

You can optionally save the changes in the launch configuration using the save(File) method:

    ...
    configuration.save(configuration.getFile());
    ...

Related reference
LaunchConfiguration interface