@Override public void actionPerformed(ActionEvent e) { CommandImpl command = commandProducer.createCommand(); commandExecutor.executeCommand(command); } }
/** 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(); }
@Override protected void dispatch(CommandUpdatedHandler handler) { handler.onCommandUpdated(this); }
/** 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())); }
@Override public void onCommandLineChanged() { editedCommand.setCommandLine(view.getCommandLine()); listener.onDirtyStateChanged(); } }
@Override public void onSave() { commandLineInitial = editedCommand.getCommandLine(); }
@Override protected void initialize() { String goal = editedCommand.getGoal(); initialGoal = isNullOrEmpty(goal) ? goalRegistry.getDefaultGoal().getId() : goal; view.setAvailableGoals(goalRegistry.getAllGoals()); view.setGoal(initialGoal); }
@Override public boolean isDirty() { if (editedCommand == null) { return false; } ApplicableContext context = editedCommand.getApplicableContext(); return !(applicableProjectsInitial.equals(context.getApplicableProjects())); }
@Override protected void updateCommandPropertyValue(String content) { editedCommand.setCommandLine(content); }
@Override public String getTitle() { return command.getName(); }
@Override public void onCommandRun() { commandExecutor.executeCommand(editedCommand); }
@Override protected void dispatch(CommandsLoadedHandler handler) { handler.onCommandsLoaded(this); }
@Override protected void dispatch(CommandAddedHandler handler) { handler.onCommandAdded(this); }
@Override protected void dispatch(CommandRemovedHandler handler) { handler.onCommandRemoved(this); }
@Override public void onWorkingDirectoryChanged() { editedCommandModel.setWorkingDirectory(view.getWorkingDirectory()); editedCommand.setCommandLine(editedCommandModel.toCommandLine()); listener.onDirtyStateChanged(); }
@Override protected String getCommandPropertyValue() { return editedCommand.getCommandLine(); }
@Override protected void initialize() { final ApplicableContext context = editedCommand.getApplicableContext(); applicableProjectsInitial = new HashSet<>(context.getApplicableProjects()); refreshProjects(); }
@Override public void actionPerformed(ActionEvent e) { commandExecutor.executeCommand(command); } }
@Override public void resetFrom(CommandImpl command) { editedCommand = command; commandLineInitial = command.getCommandLine(); }