Element (@NotNull String sourceToolName, @NotNull Element sourceElement, @NotNull Element toolElement) { if (CONSTANT_ON_LHS.equals(sourceToolName) && Boolean.parseBoolean(sourceElement.getAttributeValue("enabled", "false"))) { toolElement.setAttribute("enabled", "true"); } else if (CONSTANT_ON_RHS.equals(sourceToolName) && !Boolean.parseBoolean(toolElement.getAttributeValue("enabled", "false")) && Boolean.parseBoolean(sourceElement.getAttributeValue("enabled", "false"))) { toolElement.addContent(new Element("option").setAttribute("name", "myConstantShouldGoLeft").setAttribute("value", "false")); toolElement.setAttribute("enabled", "true"); } return toolElement; }