Home » Java » java – Eclipse plugin – issue passing empty command arguments from option preference in plugin.xml-Exceptionshub

java – Eclipse plugin – issue passing empty command arguments from option preference in plugin.xml-Exceptionshub

Posted by: admin February 25, 2020 Leave a comment

Questions:

I need to send empty command argument from an option preference implemented in plugin.xml when building the eclipse project.

My approach is the addition of commandGenerator option attribute, very similar implementation as applicabilityCalculator I implemented before and working fine, where you intercept the implementation of the argument in plugin.xml and add your own java code to play around with it, the attribute commandGenerator supposed to override the option commands in case you need to override them. The problem is that after implementing the functionality it doesn’t react as expected, actually it doesn’t even care about it and it doesn’t take into account its implementation, it ignores it, so the question is:

Why is commandGenerator attribute in plugin.xml ignored therefore not executing its java class implementation? Am I missing something else or mixing up some order of execution?

    <tool
        id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.base"
        isAbstract="true"
        name="RISC-V Targets common options">
        <option
            defaultValue=""
            commandGenerator="ilg.gnumcueclipse.managedbuild.cross.riscv.validation.OptionCommandGenerator"
            id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.base.target.validate"
            isAbstract="false"
            name=""
            tip="Architecture-ABI Validation message"
            valueType="string"
            applicabilityCalculator="ilg.gnumcueclipse.managedbuild.cross.riscv.validation.ValidationMsg">
        </option>   

If option is disabled from preferences then it takes the defaultValue="" which is empty and that is perfect, it builds with no errors, but if the option is enabled –> I do apply and close –> and build project then fails as it takes the value form the option and passes that value to the command arguments, which is not supported, so my guess is that I need to pass an empty argument.

I tried to validationMessage.setCommand(""); , validationMessage.setCommandFalse(""); , validationMessage.setValue(""); and validationMessage.setDefaultValue(""); from the IOption variable and still sending the value of the IOption variable to the command line arguments when building the project, therefore failing when building project.

Any idea of what the issue could be and how could it be resolved? Thanks.
Please feel free to ask if extra information is needed to find the issue.
(jus to mention OptionCommandGenerator.java Path is fine)

How to&Answers: