@Override public Promise<CommandImpl> createCommand(String goalId, String typeId) { return createCommand(goalId, typeId, null, null, new HashMap<>(), new ApplicableContext()); }
@Override public Promise<CommandImpl> createCommand( String goalId, String typeId, String name, String commandLine, Map<String, String> attributes) { return createCommand(goalId, typeId, name, commandLine, attributes, new ApplicableContext()); }
/** Returns the default {@link ApplicableContext} for the new command. */ private ApplicableContext getDefaultContext() { final ApplicableContext context = new ApplicableContext(); if (appContext.getProjects().length > 0) { context.setWorkspaceApplicable(false); Arrays.stream(appContext.getProjects()).forEach(p -> context.addProject(p.getPath())); } return context; }
commands.put( workspaceCommand.getName(), new CommandImpl(workspaceCommand, new ApplicableContext()))); new CommandImpl( projectCommand, new ApplicableContext(project.getPath()))); } else { if (projectCommand.equalsIgnoreContext(existedCommand)) {
private Promise<CommandImpl> addCommand(Project project, CommandDto commandDto) { final String name = project.getName() + ": " + commandDto.getName(); final String absoluteProjectPath = appContext.getProjectsRoot().append(project.getPath()).toString(); final String commandLine = commandDto.getCommandLine().replaceAll(PROJECT_PATH_MACRO_REGEX, absoluteProjectPath); final CommandImpl command = new CommandImpl( name, commandLine, commandDto.getType(), commandDto.getAttributes(), new ApplicableContext(project.getPath())); return commandManager.createCommand(command); }
/** Creates copy of the given {@code command}. */ public CommandImpl(CommandImpl command) { this( command.getName(), command.getCommandLine(), command.getType(), new HashMap<>(command.getAttributes()), new ApplicableContext(command.getApplicableContext())); }
/** Creates new {@link CommandImpl} based on the provided data. */ public CommandImpl( String name, String commandLine, String typeId, Map<String, String> attributes) { this.name = name; this.commandLine = commandLine; this.typeId = typeId; this.attributes = attributes; this.context = new ApplicableContext(); }