Implements canUndo()/canRedo()

Add undo/redo capability check to disable the buttons when not available. Note that because line change listener is fired before an undo is stored you will need to check canUndo()/canRedo() in a Swing thread invoked later.