I think it would be useful to add 'extract constant' refactoring, vaguely similar to 'extract procedure':
procedure P;
begin
x := y + 17;
end;
=>
procedure P;
const
LocalConst = 17;
begin
x := y + LocalConst;
end;Refactoring dialog should request the name of the constant, and, optionally:
1) Whether to replace all other instances of the literal with the same constant name
2) Whether to put the constant at the procedure or unit level.
