bugid-68715: Autocomplete only changes name field if creating a new link

I cleaned up some indenting of if/else statements as well as introducing a new variable called "method". Method is a string that indicates the state before opening the link dialog. The values are either "new", "new-from-selection", or "existing". The autocomplete callback will only change the name field if the method is "new".