"Undo" is one alternative to warning dialogs that users learn to click through mechanically.
There's at least one other: if you're going to implement some irreversible action, find a way to delay it --- like in email programs or file managers where the button labeled "delete" moves things to a trash folder, and the real deletion operation is separately labeled "expunge". Implementing this sort of thing is usually easier than keeping the "real" delete operation, and then implementing a separate "undelete" which works in full generality.