// RobotBuilder Version: 1.5
//
// This file was generated by RobotBuilder. It contains sections of
// code that are automatically generated and assigned by robotbuilder.
// These sections will be updated in the future when you export to
// Java from RobotBuilder. Do not put any code or make any change in
// the blocks indicating autogenerated code or it will be lost on an
// update. Deleting the comments indicating the section will prevent
// it from being updated in the future.


package org.usfirst.frc4915.MecanumDrive;

import org.usfirst.frc4915.MecanumDrive.commands.*;

import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.buttons.JoystickButton;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;


/**
 * This class is the glue that binds the controls on the physical operator
 * interface to the commands and command groups that allow control of the robot.
 */
public class OI {
    //// CREATING BUTTONS
    // One type of button is a joystick button which is any button on a joystick.
    // You create one by telling it which joystick it's on and which button
    // number it is.
    // Joystick stick = new Joystick(port);
    // Button button = new JoystickButton(stick, buttonNumber);
    
    // There are a few additional built in buttons you can use. Additionally,
    // by subclassing Button you can create custom triggers and bind those to
    // commands the same as any other Button.
    
    //// TRIGGERING COMMANDS WITH BUTTONS
    // Once you have a button, it's trivial to bind it to a button in one of
    // three ways:
    
    // Start the command when the button is pressed and let it run the command
    // until it is finished as determined by it's isFinished method.
    // button.whenPressed(new ExampleCommand());
    
    // Run the command while the button is being held down and interrupt it once
    // the button is released.
    // button.whileHeld(new ExampleCommand());
    
    // Start the command when the button is released  and let it run the command
    // until it is finished as determined by it's isFinished method.
    // button.whenReleased(new ExampleCommand());

    
    public Joystick driveStick;
    public Joystick elevatorStick;
    public JoystickButton elevatorJumpToPositionZero;
    public JoystickButton elevatorJumpToPositionOne;
    public JoystickButton elevatorJumpToPositionTwo;
    public JoystickButton elevatorJumpToPositionThree;
    public JoystickButton elevatorJumpToPositionFour;
    public JoystickButton elevatorJumpToPositionFive;
    public JoystickButton elevatorJumpToPositionSix;
    
    public OI() {
    	
        driveStick = new Joystick(0);
        elevatorStick = new Joystick(1);
        
        elevatorJumpToPositionZero = new JoystickButton(elevatorStick, 2); // TODO find buttons number
        elevatorJumpToPositionZero.whenPressed(new ElevatorJumpToPosition0());
        elevatorJumpToPositionOne = new JoystickButton(elevatorStick, 7); // TODO find buttons number
        elevatorJumpToPositionOne.whenPressed(new ElevatorJumpToPosition1());
        elevatorJumpToPositionTwo = new JoystickButton(elevatorStick, 8); // TODO find buttons number
        elevatorJumpToPositionTwo.whenPressed(new ElevatorJumpToPosition2());
        elevatorJumpToPositionThree = new JoystickButton(elevatorStick, 9); // TODO find buttons number
        elevatorJumpToPositionThree.whenPressed(new ElevatorJumpToPosition3());
        elevatorJumpToPositionFour = new JoystickButton(elevatorStick, 10); // TODO find buttons number
        elevatorJumpToPositionFour.whenPressed(new ElevatorJumpToPosition4());
        elevatorJumpToPositionFive = new JoystickButton(elevatorStick, 11); // TODO find buttons number
        elevatorJumpToPositionFive.whenPressed(new ElevatorJumpToPosition5());
        elevatorJumpToPositionSix = new JoystickButton(elevatorStick, 12); // TODO find buttons number
        elevatorJumpToPositionSix.whenPressed(new ElevatorJumpToPosition6());
	    
        // SmartDashboard Buttons
        SmartDashboard.putData("Autonomous Command", new AutonomousCommand());
        SmartDashboard.putData("Move Straight 5 feet", new MoveStraightGivenDistanceCommand(5));
        SmartDashboard.putData("Move Backwards 5 feet", new MoveStraightGivenDistanceCommand(-5));
        
        // LiveWindowSendable info (Test mode)
        LiveWindow.addSensor("Other Sensors", "Accelerometer", RobotMap.accelerometer);
        LiveWindow.addSensor("Drive Train", "Distance Sensor", Robot.driveTrain.distanceSensor);

        // Shows the current version number on the driver station
        SmartDashboard.putString("Code Version", VersionFinder.parseVersionFromManifest(this));
    }
    
    /**
     * For driving
     * @return the drive stick
     */
    public Joystick getDriveStick1() {
        return driveStick;
    }

    /**
     * For lifting
     * @return the elevator stick
     */
    public Joystick getElevatorStick() {
    	return elevatorStick;
    }

}


@@ -4748,24 +4748,102 @@
 er station%0D%0A
+        String parsedVersion = VersionFinder.parseVersionFromManifest(this);%0D%0A
         Smar
@@ -4883,52 +4883,60 @@
 n%22, 
+parsed
 Version
-Finder.
+ == null? %22%3Cnot found%3E%22 : 
 parse
+d
 Version
-FromManifest(this)
 );%0D%0A

Handle null values