@Override public void execute(AbstractFile file) throws IOException { Command command; // Attemps to find a command that matches the specified target. if ((command = CommandManager.getCommandForFile(file, allowDefault)) == null) throw new UnsupportedOperationException(); // If found, executes it. ProcessRunner.execute(command.getTokens(file), file); }
@Override public boolean canExecute(AbstractFile file) { if (allowDefault) return true; return CommandManager.getCommandForFile(file, false) != null; }