private ICommand createCommand(IProjectDescription description, String name, Map<String, String> arguments) { ICommand command = description.newCommand(); command.setBuilderName(name); command.setArguments(ImmutableMap.copyOf(arguments)); return command; }
private static ICommand toCommand(String name, Map<String, String> arguments, IProjectDescription description) { ICommand command = description.newCommand(); command.setBuilderName(name); command.setArguments(arguments); return command; } }
private List<ICommand> toEntries(String commands) { try { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); Document document = documentBuilder.parse(new ByteArrayInputStream(commands.getBytes())); List<ICommand> result = Lists.newArrayList(); NodeList commandNodeList = document.getElementsByTagName(TAG_COMMAND); for (int i = 0; i < commandNodeList.getLength(); i++) { Element eElement = (Element) commandNodeList.item(i); ICommand command = this.project.getDescription().newCommand(); command.setBuilderName(eElement.getAttribute(ATTRIBUTE_NAME)); NodeList argumentNodeList = eElement.getElementsByTagName(TAG_ARGUMENT); Map<String, String> argumentsMap = Maps.newHashMap(); for (int j = 0; j < argumentNodeList.getLength(); j++) { Element argumentElement = (Element) argumentNodeList.item(j); argumentsMap.put(argumentElement.getAttribute(ATTRIBUTE_KEY), argumentElement.getTextContent()); } command.setArguments(argumentsMap); result.add(command); } return result; } catch (Exception e) { CorePlugin.logger().warn("Cannot load build commands", e); return Collections.emptyList(); } }
command.setArguments(args); return command;
buildCommand.setArguments(args);
newCommand.setArguments(args);