IEnvironmentVariableManager envManager = CCorePlugin
.getDefault().getBuildEnvironmentManager();
IContributedEnvironment contribEnv = envManager
.getContributedEnvironment();
if (myWarningLevel.getSelection() == true) {
IEnvironmentVariable var = new EnvironmentVariable(
ArduinoConst.ENV_KEY_JANTJE_WARNING_LEVEL,
ArduinoConst.ENV_KEY_WARNING_LEVEL_ON);
contribEnv.addVariable(var, getResDesc()
.getConfiguration());
} else {
IEnvironmentVariable var = new EnvironmentVariable(
ArduinoConst.ENV_KEY_JANTJE_WARNING_LEVEL,
ArduinoConst.ENV_KEY_WARNING_LEVEL_OFF);
contribEnv.addVariable(var, getResDesc()
.getConfiguration());
}
}
}
});
// checkbox show alternative size
mySizeCommand = new Button(usercomp, SWT.CHECK);
mySizeCommand.setText("Use alternative size command?");
mySizeCommand.setEnabled(true);
mySizeCommand.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING,
false, false, 2, 1));
mySizeCommand.addListener(UPDATE, new Listener() {
@Override
public void handleEvent(Event e) {
if (getResDesc().getConfiguration() != null) {
IEnvironmentVariableManager envManager = CCorePlugin
.getDefault().getBuildEnvironmentManager();
IContributedEnvironment contribEnv = envManager
.getContributedEnvironment();
if (mySizeCommand.getSelection() == true) {
IEnvironmentVariable var = new EnvironmentVariable(
ArduinoConst.ENV_KEY_JANTJE_SIZE_SWITCH,
"${" + ArduinoConst.ENV_KEY_JANTJE_SIZE_COMMAND
+ "}");
contribEnv.addVariable(var, getResDesc()
.getConfiguration());
} else {
IEnvironmentVariable var = new EnvironmentVariable(
ArduinoConst.ENV_KEY_JANTJE_SIZE_SWITCH,
"${" + ArduinoConst.ENV_KEY_recipe_size_pattern
+ "}");
contribEnv.addVariable(var, getResDesc()
.getConfiguration());
}
}
}
});
createLine(usercomp, 2);
// edit field add to C & C++ command line
Label label = new Label(usercomp, SWT.LEFT);
label.setText("append to C and C++ ");
label.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false,
false, 1, 1));
myCCppCommand = new Text(usercomp, SWT.SINGLE);
myCCppCommand.setText("");
myCCppCommand
.setMessage("This command is added to the C and C++ compile command.");
myCCppCommand.setEnabled(true);
myCCppCommand.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING,
false, false, 1, 1));
myCCppCommand.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
if (getResDesc().getConfiguration() != null) {
IEnvironmentVariableManager envManager = CCorePlugin
.getDefault().getBuildEnvironmentManager();
IContributedEnvironment contribEnv = envManager
.getContributedEnvironment();
IEnvironmentVariable var = new EnvironmentVariable(
ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_COMPILE_OPTIONS,
myCCppCommand.getText());
contribEnv
.addVariable(var, getResDesc().getConfiguration());
}
}
});
// edit field add to C++ command line
label = new Label(usercomp, SWT.LEFT);
label.setText("append to C++ ");
label.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false,
false, 1, 1));
myCppCommand = new Text(usercomp, SWT.SINGLE);
myCppCommand.setText("");
myCppCommand
.setMessage("This command is added to the C++ compile command.");
myCppCommand.setEnabled(true);
myCppCommand.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING,
false, false, 1, 1));
myCppCommand.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
if (getResDesc().getConfiguration() != null) {
IEnvironmentVariableManager envManager = CCorePlugin
.getDefault().getBuildEnvironmentManager();
IContributedEnvironment contribEnv = envManager
.getContributedEnvironment();
IEnvironmentVariable var = new EnvironmentVariable(
ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_CPP_COMPILE_OPTIONS,
myCppCommand.getText());
contribEnv
.addVariable(var, getResDesc().getConfiguration());
}
}
});
// edit field add to C command line
label = new Label(usercomp, SWT.LEFT);
label.setText("append to C ");
label.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false,
false, 1, 1));
myCCommand = new Text(usercomp, SWT.SINGLE);
myCCommand.setText("");
myCCommand
.setMessage("This command is added to the C compile command.");
myCCommand.setEnabled(true);
myCCommand.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING,
false, false, 1, 1));
myCCommand.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
if (getResDesc().getConfiguration() != null) {
IEnvironmentVariableManager envManager = CCorePlugin
.getDefault().getBuildEnvironmentManager();
IContributedEnvironment contribEnv = envManager
.getContributedEnvironment();
IEnvironmentVariable var = new EnvironmentVariable(
ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_C_COMPILE_OPTIONS,
myCCommand.getText());
contribEnv
.addVariable(var, getResDesc().getConfiguration());
}