private void findDefinitionInsertLocation(IProgressMonitor pm) throws CoreException { if (definitionInsertLocation != null) { return; } IASTSimpleDeclaration decl = context.existingFields.get(0); MethodDefinitionInsertLocationFinder locationFinder = new MethodDefinitionInsertLocationFinder(); InsertLocation location = locationFinder.find(tu, decl.getFileLocation(), decl.getParent(), astCache, pm); if (location.getFile() == null || NodeHelper.isContainedInTemplateDeclaration(decl)) { location.setNodeToInsertAfter(NodeHelper.findTopLevelParent(decl), tu); } definitionInsertLocation = location; }