// Update the argument to input map and the argument names in the code gem
Map<String, PartInput> newArgNameToInputMap = cGem.getArgNameToInputMap();
newArgNameToInputMap.put(newArgName.getUnqualifiedName(), newArgNameToInputMap.get(oldArgName.getUnqualifiedName()));
newArgNameToInputMap.remove(oldArgName.getUnqualifiedName());
arguments[i] = new NameTypePair(newArgName.getUnqualifiedName(), arguments[i].getType());
cGem.definitionUpdate(cGem.getCode(), arguments, cGem.getCodeResultType(), newArgNameToInputMap, cGem.getQualificationMap(), cGem.getVisibleCode());
// Replace the code in the editor and make sure the old argument name is no longer in the editor's list of arguments.
codeGemEditor.getGemCodePanel().getCALEditorPane().setText(updatedVisibleCode);
codeGemEditor.changeArgumentToQualification(oldArgName.getUnqualifiedName(), newName.getModuleName());